Read NiParticleBomb

macos_ci_fix
Alexei Kotov 1 year ago
parent 536a167bb4
commit 0748e2094d

@ -308,6 +308,7 @@ namespace Nif
// Modifiers, 4.0.0.2 // Modifiers, 4.0.0.2
{ "NiGravity", &construct<NiGravity, RC_NiGravity> }, { "NiGravity", &construct<NiGravity, RC_NiGravity> },
{ "NiParticleBomb", &construct<NiParticleBomb, RC_NiParticleBomb> },
{ "NiParticleColorModifier", &construct<NiParticleColorModifier, RC_NiParticleColorModifier> }, { "NiParticleColorModifier", &construct<NiParticleColorModifier, RC_NiParticleColorModifier> },
{ "NiParticleGrowFade", &construct<NiParticleGrowFade, RC_NiParticleGrowFade> }, { "NiParticleGrowFade", &construct<NiParticleGrowFade, RC_NiParticleGrowFade> },
{ "NiParticleRotation", &construct<NiParticleRotation, RC_NiParticleRotation> }, { "NiParticleRotation", &construct<NiParticleRotation, RC_NiParticleRotation> },

@ -51,6 +51,20 @@ namespace Nif
nif->read(mDirection); 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<DecayType>(nif->get<uint32_t>());
mSymmetryType = static_cast<SymmetryType>(nif->get<uint32_t>());
nif->read(mPosition);
nif->read(mDirection);
}
void NiParticleCollider::read(NIFStream* nif) void NiParticleCollider::read(NIFStream* nif)
{ {
NiParticleModifier::read(nif); NiParticleModifier::read(nif);
@ -294,10 +308,10 @@ namespace Nif
mBombObject.read(nif); mBombObject.read(nif);
nif->read(mBombAxis); nif->read(mBombAxis);
nif->read(mDecay); nif->read(mRange);
nif->read(mDeltaV); nif->read(mStrength);
nif->read(mDecayType); mDecayType = static_cast<DecayType>(nif->get<uint32_t>());
nif->read(mSymmetryType); mSymmetryType = static_cast<SymmetryType>(nif->get<uint32_t>());
} }
void NiPSysBombModifier::post(Reader& nif) void NiPSysBombModifier::post(Reader& nif)

@ -40,6 +40,20 @@ namespace Nif
Point = 1, // Fixed origin 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 struct NiGravity : NiParticleModifier
{ {
float mDecay{ 0.f }; float mDecay{ 0.f };
@ -51,6 +65,20 @@ namespace Nif
void read(NIFStream* nif) override; 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 struct NiParticleCollider : NiParticleModifier
{ {
float mBounceFactor; float mBounceFactor;
@ -210,10 +238,10 @@ namespace Nif
{ {
NiAVObjectPtr mBombObject; NiAVObjectPtr mBombObject;
osg::Vec3f mBombAxis; osg::Vec3f mBombAxis;
float mDecay; float mRange;
float mDeltaV; float mStrength;
uint32_t mDecayType; DecayType mDecayType;
uint32_t mSymmetryType; SymmetryType mSymmetryType;
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
void post(Reader& nif) override; void post(Reader& nif) override;

@ -206,6 +206,7 @@ namespace Nif
RC_NiMultiTargetTransformController, RC_NiMultiTargetTransformController,
RC_NiNode, RC_NiNode,
RC_NiPalette, RC_NiPalette,
RC_NiParticleBomb,
RC_NiParticleColorModifier, RC_NiParticleColorModifier,
RC_NiParticleGrowFade, RC_NiParticleGrowFade,
RC_NiParticleRotation, RC_NiParticleRotation,

Loading…
Cancel
Save