diff --git a/components/nif/niffile.cpp b/components/nif/niffile.cpp index 35a9eee787..81a223e095 100644 --- a/components/nif/niffile.cpp +++ b/components/nif/niffile.cpp @@ -308,6 +308,7 @@ namespace Nif // Modifiers, 4.0.0.2 { "NiGravity", &construct }, + { "NiParticleBomb", &construct }, { "NiParticleColorModifier", &construct }, { "NiParticleGrowFade", &construct }, { "NiParticleRotation", &construct }, diff --git a/components/nif/particle.cpp b/components/nif/particle.cpp index d74473f468..0581c5a1d1 100644 --- a/components/nif/particle.cpp +++ b/components/nif/particle.cpp @@ -51,6 +51,20 @@ namespace Nif nif->read(mDirection); } + void NiParticleBomb::read(NIFStream* nif) + { + NiParticleModifier::read(nif); + + nif->read(mRange); + nif->read(mDuration); + nif->read(mStrength); + nif->read(mStartTime); + mDecayType = static_cast(nif->get()); + mSymmetryType = static_cast(nif->get()); + nif->read(mPosition); + nif->read(mDirection); + } + void NiParticleCollider::read(NIFStream* nif) { NiParticleModifier::read(nif); @@ -294,10 +308,10 @@ namespace Nif mBombObject.read(nif); nif->read(mBombAxis); - nif->read(mDecay); - nif->read(mDeltaV); - nif->read(mDecayType); - nif->read(mSymmetryType); + nif->read(mRange); + nif->read(mStrength); + mDecayType = static_cast(nif->get()); + mSymmetryType = static_cast(nif->get()); } void NiPSysBombModifier::post(Reader& nif) diff --git a/components/nif/particle.hpp b/components/nif/particle.hpp index 45b6296891..1bdbd3a94a 100644 --- a/components/nif/particle.hpp +++ b/components/nif/particle.hpp @@ -40,6 +40,20 @@ namespace Nif Point = 1, // Fixed origin }; + enum class DecayType : uint32_t + { + None = 0, // f(Distance) = 1.0 + Linear = 1, // f(Distance) = (Range - Distance) / Range + Exponential = 2, // f(Distance) = exp(-Distance / Range) + }; + + enum class SymmetryType : uint32_t + { + Spherical = 0, + Cylindrical = 1, // Perpendicular to direction axis + Planar = 2, // Parallel to direction axis + }; + struct NiGravity : NiParticleModifier { float mDecay{ 0.f }; @@ -51,6 +65,20 @@ namespace Nif void read(NIFStream* nif) override; }; + struct NiParticleBomb : NiParticleModifier + { + float mRange; + float mDuration; + float mStrength; + float mStartTime; + DecayType mDecayType; + SymmetryType mSymmetryType; + osg::Vec3f mPosition; + osg::Vec3f mDirection; + + void read(NIFStream* nif); + }; + struct NiParticleCollider : NiParticleModifier { float mBounceFactor; @@ -210,10 +238,10 @@ namespace Nif { NiAVObjectPtr mBombObject; osg::Vec3f mBombAxis; - float mDecay; - float mDeltaV; - uint32_t mDecayType; - uint32_t mSymmetryType; + float mRange; + float mStrength; + DecayType mDecayType; + SymmetryType mSymmetryType; void read(NIFStream* nif) override; void post(Reader& nif) override; diff --git a/components/nif/record.hpp b/components/nif/record.hpp index 79958b361d..d2a30b1317 100644 --- a/components/nif/record.hpp +++ b/components/nif/record.hpp @@ -206,6 +206,7 @@ namespace Nif RC_NiMultiTargetTransformController, RC_NiNode, RC_NiPalette, + RC_NiParticleBomb, RC_NiParticleColorModifier, RC_NiParticleGrowFade, RC_NiParticleRotation,