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
{ "NiGravity", &construct<NiGravity, RC_NiGravity> },
{ "NiParticleBomb", &construct<NiParticleBomb, RC_NiParticleBomb> },
{ "NiParticleColorModifier", &construct<NiParticleColorModifier, RC_NiParticleColorModifier> },
{ "NiParticleGrowFade", &construct<NiParticleGrowFade, RC_NiParticleGrowFade> },
{ "NiParticleRotation", &construct<NiParticleRotation, RC_NiParticleRotation> },

@ -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<DecayType>(nif->get<uint32_t>());
mSymmetryType = static_cast<SymmetryType>(nif->get<uint32_t>());
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<DecayType>(nif->get<uint32_t>());
mSymmetryType = static_cast<SymmetryType>(nif->get<uint32_t>());
}
void NiPSysBombModifier::post(Reader& nif)

@ -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;

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

Loading…
Cancel
Save