From ac10c5f05cd94034d3ee6b4a0ed97dc9518a8fc9 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 4 Apr 2013 01:26:57 -0700 Subject: [PATCH] Even more particle information --- components/nif/controlled.hpp | 8 +++++--- components/nif/controller.hpp | 29 ++++++++++++++++++++++++----- components/nif/recordptr.hpp | 1 - 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/components/nif/controlled.hpp b/components/nif/controlled.hpp index 36c9a82ac..08c47defe 100644 --- a/components/nif/controlled.hpp +++ b/components/nif/controlled.hpp @@ -66,12 +66,14 @@ typedef Named NiSequenceStreamHelper; class NiParticleGrowFade : public Controlled { public: + float growTime; + float fadeTime; + void read(NIFStream *nif) { Controlled::read(nif); - - // Two floats. - nif->skip(8); + growTime = nif->getFloat(); + fadeTime = nif->getFloat(); } }; diff --git a/components/nif/controller.hpp b/components/nif/controller.hpp index 2ff25a274..aa6a9ef4f 100644 --- a/components/nif/controller.hpp +++ b/components/nif/controller.hpp @@ -65,6 +65,14 @@ public: class NiParticleSystemController : public Controller { public: + struct Particle { + Ogre::Vector3 velocity; + float lifetime; + float lifespan; + float timestamp; + int vertex; + }; + float velocity; float velocityRandom; @@ -88,9 +96,9 @@ public: int numParticles; int activeCount; - //std::vector particles; /*numParticles*/ + std::vector particles; - RecordPtr modifier; + ExtraPtr extra; void read(NIFStream *nif) { @@ -127,10 +135,21 @@ public: numParticles = nif->getUShort(); activeCount = nif->getUShort(); - nif->skip(numParticles*40); + + particles.resize(numParticles); + for(size_t i = 0;i < particles.size();i++) + { + particles[i].velocity = nif->getVector3(); + nif->getVector3(); /* unknown */ + particles[i].lifetime = nif->getFloat(); + particles[i].lifespan = nif->getFloat(); + particles[i].timestamp = nif->getFloat(); + nif->getUShort(); /* unknown */ + particles[i].vertex = nif->getUShort(); + } nif->getUInt(); /* -1? */ - modifier.read(nif); + extra.read(nif); nif->getUInt(); /* -1? */ nif->getChar(); } @@ -139,7 +158,7 @@ public: { Controller::post(nif); emitter.post(nif); - modifier.post(nif); + extra.post(nif); } }; typedef NiParticleSystemController NiBSPArrayController; diff --git a/components/nif/recordptr.hpp b/components/nif/recordptr.hpp index b7cd122bc..c5bafea12 100644 --- a/components/nif/recordptr.hpp +++ b/components/nif/recordptr.hpp @@ -142,7 +142,6 @@ class NiSourceTexture; class NiRotatingParticlesData; class NiAutoNormalParticlesData; -typedef RecordPtrT RecordPtr; typedef RecordPtrT NodePtr; typedef RecordPtrT ExtraPtr; typedef RecordPtrT NiUVDataPtr;