Read more particle information

actorid
Chris Robinson 12 years ago
parent ee0a20f9ce
commit 2f6ae4a915

@ -62,20 +62,87 @@ public:
}
};
class NiBSPArrayController : public Controller
class NiParticleSystemController : public Controller
{
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)
{
Controller::read(nif);
// At the moment, just skip it all
nif->skip(111);
int s = nif->getUShort();
nif->skip(15 + s*40);
velocity = nif->getFloat();
velocityRandom = nif->getFloat();
verticalDir = nif->getFloat();
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
{

@ -165,9 +165,9 @@ public:
class NiAutoNormalParticlesData : public ShapeData
{
public:
int activeCount;
float particleSize;
float activeRadius;
int activeCount;
std::vector<float> sizes;
@ -176,15 +176,15 @@ public:
ShapeData::read(nif);
// Should always match the number of vertices
activeCount = nif->getUShort();
nif->getUShort();
activeRadius = nif->getFloat();
nif->getUShort(); // Number of valid entries in the following arrays ?
particleSize = nif->getFloat();
activeCount = nif->getUShort();
if(nif->getInt())
{
// Particle sizes
nif->getFloats(sizes, activeCount);
nif->getFloats(sizes, vertices.size());
}
}
};
@ -200,10 +200,8 @@ public:
if(nif->getInt())
{
// 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->getQuaternions(rotations, activeCount);
// Rotation quaternions.
nif->getQuaternions(rotations, vertices.size());
}
}
};

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

Loading…
Cancel
Save