1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 09:36:43 +00:00

Read more particle information

This commit is contained in:
Chris Robinson 2013-04-03 20:56:35 -07:00
parent ee0a20f9ce
commit 2f6ae4a915
3 changed files with 82 additions and 16 deletions

View file

@ -62,20 +62,87 @@ public:
} }
}; };
class NiBSPArrayController : public Controller class NiParticleSystemController : public Controller
{ {
public: public:
float velocity;
float velocityRandom;
float verticalDir; // 0=up, pi/2=horizontal, pi=down
float verticalAngle;
float horizontalDir;
float horizontalAngle;
float size;
float startTime;
float stopTime;
float emitRate;
float lifetime;
float lifetimeRandom;
int emitFlags; // Bit 0: Emit Rate toggle bit (0 = auto adjust, 1 = use Emit Rate value)
Ogre::Vector3 offsetRandom;
NodePtr emitter;
int numParticles;
int activeCount;
//std::vector<Particle> particles; /*numParticles*/
RecordPtr modifier;
void read(NIFStream *nif) void read(NIFStream *nif)
{ {
Controller::read(nif); Controller::read(nif);
// At the moment, just skip it all velocity = nif->getFloat();
nif->skip(111); velocityRandom = nif->getFloat();
int s = nif->getUShort(); verticalDir = nif->getFloat();
nif->skip(15 + s*40); verticalAngle = nif->getFloat();
horizontalDir = nif->getFloat();
horizontalAngle = nif->getFloat();
/*normal?*/ nif->getVector3();
/*color?*/ nif->getVector4();
size = nif->getFloat();
startTime = nif->getFloat();
stopTime = nif->getFloat();
nif->getChar();
emitRate = nif->getFloat();
lifetime = nif->getFloat();
lifetimeRandom = nif->getFloat();
emitFlags = nif->getUShort();
offsetRandom = nif->getVector3();
emitter.read(nif);
/* Unknown Short, 0?
* Unknown Float, 1.0?
* Unknown Int, 1?
* Unknown Int, 0?
* Unknown Short, 0?
*/
nif->skip(16);
numParticles = nif->getUShort();
activeCount = nif->getUShort();
nif->skip(numParticles*40);
nif->getUInt(); /* -1? */
modifier.read(nif);
nif->getUInt(); /* -1? */
nif->getChar();
}
void post(NIFFile *nif)
{
Controller::post(nif);
emitter.post(nif);
modifier.post(nif);
} }
}; };
typedef NiBSPArrayController NiParticleSystemController; typedef NiParticleSystemController NiBSPArrayController;
class NiMaterialColorController : public Controller class NiMaterialColorController : public Controller
{ {

View file

@ -165,9 +165,9 @@ public:
class NiAutoNormalParticlesData : public ShapeData class NiAutoNormalParticlesData : public ShapeData
{ {
public: public:
int activeCount; float particleSize;
float activeRadius; int activeCount;
std::vector<float> sizes; std::vector<float> sizes;
@ -176,15 +176,15 @@ public:
ShapeData::read(nif); ShapeData::read(nif);
// Should always match the number of vertices // Should always match the number of vertices
activeCount = nif->getUShort(); nif->getUShort();
activeRadius = nif->getFloat(); particleSize = nif->getFloat();
nif->getUShort(); // Number of valid entries in the following arrays ? activeCount = nif->getUShort();
if(nif->getInt()) if(nif->getInt())
{ {
// Particle sizes // Particle sizes
nif->getFloats(sizes, activeCount); nif->getFloats(sizes, vertices.size());
} }
} }
}; };
@ -200,10 +200,8 @@ public:
if(nif->getInt()) if(nif->getInt())
{ {
// Rotation quaternions. I THINK activeCount is correct here, // Rotation quaternions.
// but verts (vertex number) might also be correct, if there is nif->getQuaternions(rotations, vertices.size());
// any case where the two don't match.
nif->getQuaternions(rotations, activeCount);
} }
} }
}; };

View file

@ -142,6 +142,7 @@ class NiSourceTexture;
class NiRotatingParticlesData; class NiRotatingParticlesData;
class NiAutoNormalParticlesData; class NiAutoNormalParticlesData;
typedef RecordPtrT<Record> RecordPtr;
typedef RecordPtrT<Node> NodePtr; typedef RecordPtrT<Node> NodePtr;
typedef RecordPtrT<Extra> ExtraPtr; typedef RecordPtrT<Extra> ExtraPtr;
typedef RecordPtrT<NiUVData> NiUVDataPtr; typedef RecordPtrT<NiUVData> NiUVDataPtr;