|
|
|
@ -320,7 +320,7 @@ void NiSkinData::read(NIFStream *nif)
|
|
|
|
|
|
|
|
|
|
int boneNum = nif->getInt();
|
|
|
|
|
if (nif->getVersion() >= NIFFile::NIFVersion::VER_MW && nif->getVersion() <= NIFStream::generateVersion(10,1,0,0))
|
|
|
|
|
nif->skip(4); // NiSkinPartition link
|
|
|
|
|
partitions.read(nif);
|
|
|
|
|
|
|
|
|
|
// Has vertex weights flag
|
|
|
|
|
if (nif->getVersion() > NIFStream::generateVersion(4,2,1,0) && !nif->getBoolean())
|
|
|
|
@ -345,6 +345,69 @@ void NiSkinData::read(NIFStream *nif)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiSkinData::post(NIFFile *nif)
|
|
|
|
|
{
|
|
|
|
|
partitions.post(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiSkinPartition::read(NIFStream *nif)
|
|
|
|
|
{
|
|
|
|
|
unsigned int num = nif->getUInt();
|
|
|
|
|
data.resize(num);
|
|
|
|
|
for (auto& partition : data)
|
|
|
|
|
partition.read(nif);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiSkinPartition::Partition::read(NIFStream *nif)
|
|
|
|
|
{
|
|
|
|
|
unsigned short numVertices = nif->getUShort();
|
|
|
|
|
unsigned short numTriangles = nif->getUShort();
|
|
|
|
|
unsigned short numBones = nif->getUShort();
|
|
|
|
|
unsigned short numStrips = nif->getUShort();
|
|
|
|
|
unsigned short bonesPerVertex = nif->getUShort();
|
|
|
|
|
if (numBones)
|
|
|
|
|
nif->getUShorts(bones, numBones);
|
|
|
|
|
|
|
|
|
|
bool hasVertexMap = true;
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10,1,0,0))
|
|
|
|
|
hasVertexMap = nif->getBoolean();
|
|
|
|
|
if (hasVertexMap && numVertices)
|
|
|
|
|
nif->getUShorts(vertexMap, numVertices);
|
|
|
|
|
|
|
|
|
|
bool hasVertexWeights = true;
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10,1,0,0))
|
|
|
|
|
hasVertexWeights = nif->getBoolean();
|
|
|
|
|
if (hasVertexWeights && numVertices && bonesPerVertex)
|
|
|
|
|
nif->getFloats(weights, numVertices * bonesPerVertex);
|
|
|
|
|
|
|
|
|
|
std::vector<unsigned short> stripLengths;
|
|
|
|
|
if (numStrips)
|
|
|
|
|
nif->getUShorts(stripLengths, numStrips);
|
|
|
|
|
|
|
|
|
|
bool hasFaces = true;
|
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10,1,0,0))
|
|
|
|
|
hasFaces = nif->getBoolean();
|
|
|
|
|
if (hasFaces)
|
|
|
|
|
{
|
|
|
|
|
if (numStrips)
|
|
|
|
|
{
|
|
|
|
|
strips.resize(numStrips);
|
|
|
|
|
for (unsigned short i = 0; i < numStrips; i++)
|
|
|
|
|
nif->getUShorts(strips[i], stripLengths[i]);
|
|
|
|
|
}
|
|
|
|
|
else if (numTriangles)
|
|
|
|
|
nif->getUShorts(triangles, numTriangles * 3);
|
|
|
|
|
}
|
|
|
|
|
bool hasBoneIndices = nif->getChar() != 0;
|
|
|
|
|
if (hasBoneIndices && numVertices && bonesPerVertex)
|
|
|
|
|
nif->getChars(boneIndices, numVertices * bonesPerVertex);
|
|
|
|
|
if (nif->getBethVersion() > NIFFile::BethVersion::BETHVER_FO3)
|
|
|
|
|
{
|
|
|
|
|
nif->getChar(); // LOD level
|
|
|
|
|
nif->getBoolean(); // Global VB
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void NiMorphData::read(NIFStream *nif)
|
|
|
|
|
{
|
|
|
|
|
int morphCount = nif->getInt();
|
|
|
|
|