Read some missing particle data from NIFs

actorid
Chris Robinson 12 years ago
parent 97d617d43f
commit ee0a20f9ce

@ -167,6 +167,10 @@ class NiAutoNormalParticlesData : public ShapeData
public: public:
int activeCount; int activeCount;
float activeRadius;
std::vector<float> sizes;
void read(NIFStream *nif) void read(NIFStream *nif)
{ {
ShapeData::read(nif); ShapeData::read(nif);
@ -174,14 +178,13 @@ public:
// Should always match the number of vertices // Should always match the number of vertices
activeCount = nif->getUShort(); activeCount = nif->getUShort();
// Skip all the info, we don't support particles yet activeRadius = nif->getFloat();
nif->getFloat(); // Active radius ?
nif->getUShort(); // Number of valid entries in the following arrays ? nif->getUShort(); // Number of valid entries in the following arrays ?
if(nif->getInt()) if(nif->getInt())
{ {
// Particle sizes // Particle sizes
nif->skip(activeCount * sizeof(float)); nif->getFloats(sizes, activeCount);
} }
} }
}; };
@ -189,6 +192,8 @@ public:
class NiRotatingParticlesData : public NiAutoNormalParticlesData class NiRotatingParticlesData : public NiAutoNormalParticlesData
{ {
public: public:
std::vector<Ogre::Quaternion> rotations;
void read(NIFStream *nif) void read(NIFStream *nif)
{ {
NiAutoNormalParticlesData::read(nif); NiAutoNormalParticlesData::read(nif);
@ -198,7 +203,7 @@ public:
// Rotation quaternions. I THINK activeCount is correct here, // Rotation quaternions. I THINK activeCount is correct here,
// but verts (vertex number) might also be correct, if there is // but verts (vertex number) might also be correct, if there is
// any case where the two don't match. // any case where the two don't match.
nif->skip(activeCount * 4*sizeof(float)); nif->getQuaternions(rotations, activeCount);
} }
} }
}; };

@ -168,6 +168,12 @@ public:
for(size_t i = 0;i < vec.size();i++) for(size_t i = 0;i < vec.size();i++)
vec[i] = getVector4(); vec[i] = getVector4();
} }
void getQuaternions(std::vector<Ogre::Quaternion> &quat, size_t size)
{
quat.resize(size);
for(size_t i = 0;i < quat.size();i++)
quat[i] = getQuaternion();
}
}; };
} }

Loading…
Cancel
Save