1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-05 04:45:33 +00:00

Read some missing particle data from NIFs

This commit is contained in:
Chris Robinson 2013-04-03 07:00:24 -07:00
parent 97d617d43f
commit ee0a20f9ce
2 changed files with 15 additions and 4 deletions

View file

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

View file

@ -168,6 +168,12 @@ public:
for(size_t i = 0;i < vec.size();i++)
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();
}
};
}