mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 00:15:35 +00:00
Read particle system modifier controllers
This commit is contained in:
parent
dddfbf806b
commit
c8307ad397
5 changed files with 117 additions and 2 deletions
|
@ -276,7 +276,33 @@ namespace Nif
|
||||||
{ "NiParticleGrowFade", &construct<NiParticleGrowFade, RC_NiParticleGrowFade> },
|
{ "NiParticleGrowFade", &construct<NiParticleGrowFade, RC_NiParticleGrowFade> },
|
||||||
{ "NiParticleRotation", &construct<NiParticleRotation, RC_NiParticleRotation> },
|
{ "NiParticleRotation", &construct<NiParticleRotation, RC_NiParticleRotation> },
|
||||||
|
|
||||||
// Modifier data, Gamebryo
|
// Modifier controllers, Gamebryo
|
||||||
|
{ "NiPSysAirFieldAirFrictionCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysAirFieldAirFrictionCtlr> },
|
||||||
|
{ "NiPSysAirFieldInheritVelocityCtlr",
|
||||||
|
&construct<NiPSysModifierFloatCtlr, RC_NiPSysAirFieldInheritVelocityCtlr> },
|
||||||
|
{ "NiPSysAirFieldSpreadCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysAirFieldSpreadCtlr> },
|
||||||
|
{ "NiPSysEmitterCtlr", &construct<NiPSysEmitterCtlr, RC_NiPSysEmitterCtlr> },
|
||||||
|
{ "NiPSysEmitterDeclinationCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysEmitterDeclinationCtlr> },
|
||||||
|
{ "NiPSysEmitterDeclinationVarCtlr",
|
||||||
|
&construct<NiPSysModifierFloatCtlr, RC_NiPSysEmitterDeclinationVarCtlr> },
|
||||||
|
{ "NiPSysEmitterInitialRadiusCtlr",
|
||||||
|
&construct<NiPSysModifierFloatCtlr, RC_NiPSysEmitterInitialRadiusCtlr> },
|
||||||
|
{ "NiPSysEmitterLifeSpanCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysEmitterLifeSpanCtlr> },
|
||||||
|
{ "NiPSysEmitterPlanarAngleCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysEmitterPlanarAngleCtlr> },
|
||||||
|
{ "NiPSysEmitterPlanarAngleVarCtlr",
|
||||||
|
&construct<NiPSysModifierFloatCtlr, RC_NiPSysEmitterPlanarAngleVarCtlr> },
|
||||||
|
{ "NiPSysEmitterSpeedCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysEmitterSpeedCtlr> },
|
||||||
|
{ "NiPSysFieldAttenuationCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysFieldAttenuationCtlr> },
|
||||||
|
{ "NiPSysFieldMagnitudeCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysFieldMagnitudeCtlr> },
|
||||||
|
{ "NiPSysFieldMaxDistanceCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysFieldMaxDistanceCtlr> },
|
||||||
|
{ "NiPSysGravityStrengthCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysGravityStrengthCtlr> },
|
||||||
|
{ "NiPSysInitialRotSpeedCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysInitialRotSpeedCtlr> },
|
||||||
|
{ "NiPSysInitialRotSpeedVarCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysInitialRotSpeedVarCtlr> },
|
||||||
|
{ "NiPSysInitialRotAngleCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysInitialRotAngleCtlr> },
|
||||||
|
{ "NiPSysInitialRotAngleVarCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysInitialRotAngleVarCtlr> },
|
||||||
|
{ "NiPSysModifierActiveCtlr", &construct<NiPSysModifierBoolCtlr, RC_NiPSysModifierActiveCtlr> },
|
||||||
|
|
||||||
|
// Modifier controller data, Gamebryo
|
||||||
{ "NiPSysEmitterCtlrData", &construct<NiPSysEmitterCtlrData, RC_NiPSysEmitterCtlrData> },
|
{ "NiPSysEmitterCtlrData", &construct<NiPSysEmitterCtlrData, RC_NiPSysEmitterCtlrData> },
|
||||||
|
|
||||||
// Colliders, 4.0.0.2
|
// Colliders, 4.0.0.2
|
||||||
|
|
|
@ -175,6 +175,31 @@ namespace Nif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NiPSysModifierCtlr::read(NIFStream* nif)
|
||||||
|
{
|
||||||
|
NiSingleInterpController::read(nif);
|
||||||
|
|
||||||
|
nif->read(mModifierName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiPSysEmitterCtlr::read(NIFStream* nif)
|
||||||
|
{
|
||||||
|
NiPSysModifierCtlr::read(nif);
|
||||||
|
|
||||||
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
||||||
|
mData.read(nif);
|
||||||
|
else
|
||||||
|
mVisInterpolator.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NiPSysEmitterCtlr::post(Reader& nif)
|
||||||
|
{
|
||||||
|
NiPSysModifierCtlr::post(nif);
|
||||||
|
|
||||||
|
mData.post(nif);
|
||||||
|
mVisInterpolator.post(nif);
|
||||||
|
}
|
||||||
|
|
||||||
void NiPSysEmitterCtlrData::read(NIFStream* nif)
|
void NiPSysEmitterCtlrData::read(NIFStream* nif)
|
||||||
{
|
{
|
||||||
mFloatKeyList = std::make_shared<FloatKeyMap>();
|
mFloatKeyList = std::make_shared<FloatKeyMap>();
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define OPENMW_COMPONENTS_NIF_PARTICLE_HPP
|
#define OPENMW_COMPONENTS_NIF_PARTICLE_HPP
|
||||||
|
|
||||||
#include "base.hpp"
|
#include "base.hpp"
|
||||||
|
#include "controller.hpp"
|
||||||
#include "data.hpp"
|
#include "data.hpp"
|
||||||
|
|
||||||
namespace Nif
|
namespace Nif
|
||||||
|
@ -123,6 +124,47 @@ namespace Nif
|
||||||
void read(NIFStream* nif) override;
|
void read(NIFStream* nif) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Abstract
|
||||||
|
struct NiPSysModifierCtlr : NiSingleInterpController
|
||||||
|
{
|
||||||
|
std::string mModifierName;
|
||||||
|
|
||||||
|
void read(NIFStream* nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class DataPtr>
|
||||||
|
struct TypedNiPSysModifierCtlr : NiPSysModifierCtlr
|
||||||
|
{
|
||||||
|
DataPtr mData;
|
||||||
|
|
||||||
|
void read(NIFStream* nif) override
|
||||||
|
{
|
||||||
|
NiPSysModifierCtlr::read(nif);
|
||||||
|
|
||||||
|
if (nif->getVersion() <= NIFStream::generateVersion(10, 1, 0, 103))
|
||||||
|
mData.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void post(Reader& nif) override
|
||||||
|
{
|
||||||
|
NiPSysModifierCtlr::post(nif);
|
||||||
|
|
||||||
|
mData.post(nif);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
using NiPSysModifierBoolCtlr = TypedNiPSysModifierCtlr<NiVisDataPtr>;
|
||||||
|
using NiPSysModifierFloatCtlr = TypedNiPSysModifierCtlr<NiFloatDataPtr>;
|
||||||
|
|
||||||
|
struct NiPSysEmitterCtlr : NiPSysModifierCtlr
|
||||||
|
{
|
||||||
|
NiPSysEmitterCtlrDataPtr mData;
|
||||||
|
NiInterpolatorPtr mVisInterpolator;
|
||||||
|
|
||||||
|
void read(NIFStream* nif) override;
|
||||||
|
void post(Reader& nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
struct NiPSysEmitterCtlrData : Record
|
struct NiPSysEmitterCtlrData : Record
|
||||||
{
|
{
|
||||||
FloatKeyMapPtr mFloatKeyList;
|
FloatKeyMapPtr mFloatKeyList;
|
||||||
|
|
|
@ -169,8 +169,28 @@ namespace Nif
|
||||||
RC_NiPlanarCollider,
|
RC_NiPlanarCollider,
|
||||||
RC_NiPoint3Interpolator,
|
RC_NiPoint3Interpolator,
|
||||||
RC_NiPosData,
|
RC_NiPosData,
|
||||||
RC_NiPSysEmitterCtlrData,
|
RC_NiPSysAirFieldAirFrictionCtlr,
|
||||||
|
RC_NiPSysAirFieldInheritVelocityCtlr,
|
||||||
|
RC_NiPSysAirFieldSpreadCtlr,
|
||||||
RC_NiPSysData,
|
RC_NiPSysData,
|
||||||
|
RC_NiPSysEmitterCtlr,
|
||||||
|
RC_NiPSysEmitterCtlrData,
|
||||||
|
RC_NiPSysEmitterDeclinationCtlr,
|
||||||
|
RC_NiPSysEmitterDeclinationVarCtlr,
|
||||||
|
RC_NiPSysEmitterInitialRadiusCtlr,
|
||||||
|
RC_NiPSysEmitterLifeSpanCtlr,
|
||||||
|
RC_NiPSysEmitterPlanarAngleCtlr,
|
||||||
|
RC_NiPSysEmitterPlanarAngleVarCtlr,
|
||||||
|
RC_NiPSysEmitterSpeedCtlr,
|
||||||
|
RC_NiPSysFieldAttenuationCtlr,
|
||||||
|
RC_NiPSysFieldMagnitudeCtlr,
|
||||||
|
RC_NiPSysFieldMaxDistanceCtlr,
|
||||||
|
RC_NiPSysGravityStrengthCtlr,
|
||||||
|
RC_NiPSysInitialRotSpeedCtlr,
|
||||||
|
RC_NiPSysInitialRotSpeedVarCtlr,
|
||||||
|
RC_NiPSysInitialRotAngleCtlr,
|
||||||
|
RC_NiPSysInitialRotAngleVarCtlr,
|
||||||
|
RC_NiPSysModifierActiveCtlr,
|
||||||
RC_NiRollController,
|
RC_NiRollController,
|
||||||
RC_NiSequence,
|
RC_NiSequence,
|
||||||
RC_NiSequenceStreamHelper,
|
RC_NiSequenceStreamHelper,
|
||||||
|
|
|
@ -129,6 +129,7 @@ namespace Nif
|
||||||
struct NiSourceTexture;
|
struct NiSourceTexture;
|
||||||
struct NiPalette;
|
struct NiPalette;
|
||||||
struct NiParticleModifier;
|
struct NiParticleModifier;
|
||||||
|
struct NiPSysEmitterCtlrData;
|
||||||
struct NiBoolData;
|
struct NiBoolData;
|
||||||
struct NiSkinPartition;
|
struct NiSkinPartition;
|
||||||
struct BSShaderTextureSet;
|
struct BSShaderTextureSet;
|
||||||
|
@ -170,6 +171,7 @@ namespace Nif
|
||||||
using NiSourceTexturePtr = RecordPtrT<NiSourceTexture>;
|
using NiSourceTexturePtr = RecordPtrT<NiSourceTexture>;
|
||||||
using NiPalettePtr = RecordPtrT<NiPalette>;
|
using NiPalettePtr = RecordPtrT<NiPalette>;
|
||||||
using NiParticleModifierPtr = RecordPtrT<NiParticleModifier>;
|
using NiParticleModifierPtr = RecordPtrT<NiParticleModifier>;
|
||||||
|
using NiPSysEmitterCtlrDataPtr = RecordPtrT<NiPSysEmitterCtlrData>;
|
||||||
using NiBoolDataPtr = RecordPtrT<NiBoolData>;
|
using NiBoolDataPtr = RecordPtrT<NiBoolData>;
|
||||||
using NiSkinPartitionPtr = RecordPtrT<NiSkinPartition>;
|
using NiSkinPartitionPtr = RecordPtrT<NiSkinPartition>;
|
||||||
using BSShaderTextureSetPtr = RecordPtrT<BSShaderTextureSet>;
|
using BSShaderTextureSetPtr = RecordPtrT<BSShaderTextureSet>;
|
||||||
|
|
Loading…
Reference in a new issue