Merge branch 'anythingandeverything' into 'master'

Read all official base Skyrim and SSE NIF files

See merge request OpenMW/openmw!3443
macos_ci_fix
psi29a 1 year ago
commit a722518b4b

@ -460,6 +460,50 @@ namespace Nif
mData.post(nif); mData.post(nif);
} }
void NiBoneLODController::read(NIFStream* nif)
{
NiTimeController::read(nif);
nif->read(mLOD);
mNodeGroups.resize(nif->get<uint32_t>());
nif->read(mNumNodeGroups);
for (NiAVObjectList& group : mNodeGroups)
readRecordList(nif, group);
if (nif->getBethVersion() != 0 || nif->getVersion() < NIFStream::generateVersion(4, 2, 2, 0))
return;
mSkinnedShapeGroups.resize(nif->get<uint32_t>());
for (std::vector<SkinInfo>& group : mSkinnedShapeGroups)
{
group.resize(nif->get<uint32_t>());
for (SkinInfo& info : group)
{
info.mShape.read(nif);
info.mSkin.read(nif);
}
}
readRecordList(nif, mShapeGroups);
}
void NiBoneLODController::post(Reader& nif)
{
NiTimeController::post(nif);
for (NiAVObjectList& group : mNodeGroups)
postRecordList(nif, group);
for (std::vector<SkinInfo>& group : mSkinnedShapeGroups)
{
for (SkinInfo& info : group)
{
info.mShape.post(nif);
info.mSkin.post(nif);
}
}
postRecordList(nif, mShapeGroups);
}
void bhkBlendController::read(NIFStream* nif) void bhkBlendController::read(NIFStream* nif)
{ {
NiTimeController::read(nif); NiTimeController::read(nif);
@ -509,6 +553,49 @@ namespace Nif
nif->read(mMaximumDistance); nif->read(mMaximumDistance);
} }
void BSProceduralLightningController::read(NIFStream* nif)
{
NiTimeController::read(nif);
mGenerationInterp.read(nif);
mMutationInterp.read(nif);
mSubdivisionInterp.read(nif);
mNumBranchesInterp.read(nif);
mNumBranchesVarInterp.read(nif);
mLengthInterp.read(nif);
mLengthVarInterp.read(nif);
mWidthInterp.read(nif);
mArcOffsetInterp.read(nif);
nif->read(mSubdivisions);
nif->read(mNumBranches);
nif->read(mNumBranchesVar);
nif->read(mLength);
nif->read(mLengthVar);
nif->read(mWidth);
nif->read(mChildWidthMult);
nif->read(mArcOffset);
nif->read(mFadeMainBolt);
nif->read(mFadeChildBolts);
nif->read(mAnimateArcOffset);
mShaderProperty.read(nif);
}
void BSProceduralLightningController::post(Reader& nif)
{
NiTimeController::post(nif);
mGenerationInterp.post(nif);
mMutationInterp.post(nif);
mSubdivisionInterp.post(nif);
mNumBranchesInterp.post(nif);
mNumBranchesVarInterp.post(nif);
mLengthInterp.post(nif);
mLengthVarInterp.post(nif);
mWidthInterp.post(nif);
mArcOffsetInterp.post(nif);
mShaderProperty.post(nif);
}
void NiControllerManager::read(NIFStream* nif) void NiControllerManager::read(NIFStream* nif)
{ {
NiTimeController::read(nif); NiTimeController::read(nif);
@ -600,6 +687,26 @@ namespace Nif
mPercentData.post(nif); mPercentData.post(nif);
} }
void NiLookAtInterpolator::read(NIFStream* nif)
{
nif->read(mLookAtFlags);
mLookAt.read(nif);
nif->read(mLookAtName);
if (nif->getVersion() <= NIFStream::generateVersion(20, 4, 0, 12))
nif->read(mTransform);
mTranslation.read(nif);
mRoll.read(nif);
mScale.read(nif);
}
void NiLookAtInterpolator::post(Reader& nif)
{
mLookAt.post(nif);
mTranslation.post(nif);
mRoll.post(nif);
mScale.post(nif);
}
void NiBlendInterpolator::read(NIFStream* nif) void NiBlendInterpolator::read(NIFStream* nif)
{ {
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 112)) if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 112))

@ -300,6 +300,24 @@ namespace Nif
void post(Reader& nif) override; void post(Reader& nif) override;
}; };
struct NiBoneLODController : NiTimeController
{
struct SkinInfo
{
NiTriBasedGeomPtr mShape;
NiSkinInstancePtr mSkin;
};
uint32_t mLOD;
uint32_t mNumNodeGroups;
std::vector<NiAVObjectList> mNodeGroups;
std::vector<std::vector<SkinInfo>> mSkinnedShapeGroups;
NiTriBasedGeomList mShapeGroups;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct bhkBlendController : public NiTimeController struct bhkBlendController : public NiTimeController
{ {
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
@ -336,6 +354,34 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct BSProceduralLightningController : NiTimeController
{
NiInterpolatorPtr mGenerationInterp;
NiInterpolatorPtr mMutationInterp;
NiInterpolatorPtr mSubdivisionInterp;
NiInterpolatorPtr mNumBranchesInterp;
NiInterpolatorPtr mNumBranchesVarInterp;
NiInterpolatorPtr mLengthInterp;
NiInterpolatorPtr mLengthVarInterp;
NiInterpolatorPtr mWidthInterp;
NiInterpolatorPtr mArcOffsetInterp;
uint16_t mSubdivisions;
uint16_t mNumBranches;
uint16_t mNumBranchesVar;
float mLength;
float mLengthVar;
float mWidth;
float mChildWidthMult;
float mArcOffset;
bool mFadeMainBolt;
bool mFadeChildBolts;
bool mAnimateArcOffset;
BSShaderPropertyPtr mShaderProperty;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct NiControllerManager : public NiTimeController struct NiControllerManager : public NiTimeController
{ {
bool mCumulative; bool mCumulative;
@ -419,6 +465,21 @@ namespace Nif
void post(Reader& nif) override; void post(Reader& nif) override;
}; };
struct NiLookAtInterpolator : NiInterpolator
{
// Uses the same flags as NiLookAtController
uint16_t mLookAtFlags{ 0 };
NiAVObjectPtr mLookAt;
std::string mLookAtName;
NiQuatTransform mTransform;
NiInterpolatorPtr mTranslation;
NiInterpolatorPtr mRoll;
NiInterpolatorPtr mScale;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
// Abstract // Abstract
struct NiBlendInterpolator : public NiInterpolator struct NiBlendInterpolator : public NiInterpolator
{ {

@ -19,7 +19,7 @@ namespace Nif
switch (recType) switch (recType)
{ {
case RC_NiPSysData: case RC_NiPSysData:
// case RC_NiMeshPSysData: case RC_NiMeshPSysData:
case RC_BSStripPSysData: case RC_BSStripPSysData:
isPSysData = true; isPSysData = true;
break; break;

@ -72,6 +72,7 @@ namespace Nif
{ "BSDebrisNode", &construct<BSRangeNode, RC_NiNode> }, { "BSDebrisNode", &construct<BSRangeNode, RC_NiNode> },
{ "BSFadeNode", &construct<NiNode, RC_NiNode> }, { "BSFadeNode", &construct<NiNode, RC_NiNode> },
{ "BSLeafAnimNode", &construct<NiNode, RC_NiNode> }, { "BSLeafAnimNode", &construct<NiNode, RC_NiNode> },
{ "BSMasterParticleSystem", &construct<BSMasterParticleSystem, RC_NiNode> },
{ "BSMultiBoundNode", &construct<BSMultiBoundNode, RC_NiNode> }, { "BSMultiBoundNode", &construct<BSMultiBoundNode, RC_NiNode> },
{ "BSOrderedNode", &construct<BSOrderedNode, RC_NiNode> }, { "BSOrderedNode", &construct<BSOrderedNode, RC_NiNode> },
{ "BSRangeNode", &construct<BSRangeNode, RC_NiNode> }, { "BSRangeNode", &construct<BSRangeNode, RC_NiNode> },
@ -117,6 +118,7 @@ namespace Nif
{ "NiVisController", &construct<NiVisController, RC_NiVisController> }, { "NiVisController", &construct<NiVisController, RC_NiVisController> },
// Gamebryo // Gamebryo
{ "NiBoneLODController", &construct<NiBoneLODController, RC_NiBoneLODController> },
{ "NiControllerManager", &construct<NiControllerManager, RC_NiControllerManager> }, { "NiControllerManager", &construct<NiControllerManager, RC_NiControllerManager> },
{ "NiLightDimmerController", &construct<NiFloatInterpController, RC_NiLightDimmerController> }, { "NiLightDimmerController", &construct<NiFloatInterpController, RC_NiLightDimmerController> },
{ "NiTransformController", &construct<NiKeyframeController, RC_NiKeyframeController> }, { "NiTransformController", &construct<NiKeyframeController, RC_NiKeyframeController> },
@ -136,6 +138,8 @@ namespace Nif
{ "BSFrustumFOVController", &construct<NiFloatInterpController, RC_BSFrustumFOVController> }, { "BSFrustumFOVController", &construct<NiFloatInterpController, RC_BSFrustumFOVController> },
{ "BSKeyframeController", &construct<BSKeyframeController, RC_BSKeyframeController> }, { "BSKeyframeController", &construct<BSKeyframeController, RC_BSKeyframeController> },
{ "BSLagBoneController", &construct<BSLagBoneController, RC_BSLagBoneController> }, { "BSLagBoneController", &construct<BSLagBoneController, RC_BSLagBoneController> },
{ "BSProceduralLightningController",
&construct<BSProceduralLightningController, RC_BSProceduralLightningController> },
{ "BSMaterialEmittanceMultController", { "BSMaterialEmittanceMultController",
&construct<NiFloatInterpController, RC_BSMaterialEmittanceMultController> }, &construct<NiFloatInterpController, RC_BSMaterialEmittanceMultController> },
{ "BSNiAlphaPropertyTestRefController", { "BSNiAlphaPropertyTestRefController",
@ -153,6 +157,7 @@ namespace Nif
{ "BSLightingShaderPropertyFloatController", { "BSLightingShaderPropertyFloatController",
&construct<BSEffectShaderPropertyFloatController, RC_BSLightingShaderPropertyFloatController> }, &construct<BSEffectShaderPropertyFloatController, RC_BSLightingShaderPropertyFloatController> },
{ "bhkBlendController", &construct<bhkBlendController, RC_bhkBlendController> }, { "bhkBlendController", &construct<bhkBlendController, RC_bhkBlendController> },
{ "NiBSBoneLODController", &construct<NiBoneLODController, RC_NiBoneLODController> },
// Interpolators, Gamebryo // Interpolators, Gamebryo
{ "NiBlendBoolInterpolator", &construct<NiBlendBoolInterpolator, RC_NiBlendBoolInterpolator> }, { "NiBlendBoolInterpolator", &construct<NiBlendBoolInterpolator, RC_NiBlendBoolInterpolator> },
@ -164,6 +169,7 @@ namespace Nif
{ "NiBoolTimelineInterpolator", &construct<NiBoolInterpolator, RC_NiBoolTimelineInterpolator> }, { "NiBoolTimelineInterpolator", &construct<NiBoolInterpolator, RC_NiBoolTimelineInterpolator> },
{ "NiColorInterpolator", &construct<NiColorInterpolator, RC_NiColorInterpolator> }, { "NiColorInterpolator", &construct<NiColorInterpolator, RC_NiColorInterpolator> },
{ "NiFloatInterpolator", &construct<NiFloatInterpolator, RC_NiFloatInterpolator> }, { "NiFloatInterpolator", &construct<NiFloatInterpolator, RC_NiFloatInterpolator> },
{ "NiLookAtInterpolator", &construct<NiLookAtInterpolator, RC_NiLookAtInterpolator> },
{ "NiPathInterpolator", &construct<NiPathInterpolator, RC_NiPathInterpolator> }, { "NiPathInterpolator", &construct<NiPathInterpolator, RC_NiPathInterpolator> },
{ "NiPoint3Interpolator", &construct<NiPoint3Interpolator, RC_NiPoint3Interpolator> }, { "NiPoint3Interpolator", &construct<NiPoint3Interpolator, RC_NiPoint3Interpolator> },
{ "NiTransformInterpolator", &construct<NiTransformInterpolator, RC_NiTransformInterpolator> }, { "NiTransformInterpolator", &construct<NiTransformInterpolator, RC_NiTransformInterpolator> },
@ -281,6 +287,7 @@ namespace Nif
{ "NiParticleSystem", &construct<NiParticleSystem, RC_NiParticleSystem> }, { "NiParticleSystem", &construct<NiParticleSystem, RC_NiParticleSystem> },
{ "NiMeshParticleSystem", &construct<NiParticleSystem, RC_NiParticleSystem> }, { "NiMeshParticleSystem", &construct<NiParticleSystem, RC_NiParticleSystem> },
{ "NiPSysData", &construct<NiPSysData, RC_NiPSysData> }, { "NiPSysData", &construct<NiPSysData, RC_NiPSysData> },
{ "NiMeshPSysData", &construct<NiMeshPSysData, RC_NiMeshPSysData> },
// Geometry, Bethesda // Geometry, Bethesda
{ "BSStripParticleSystem", &construct<NiParticleSystem, RC_BSStripParticleSystem> }, { "BSStripParticleSystem", &construct<NiParticleSystem, RC_BSStripParticleSystem> },
@ -303,8 +310,11 @@ namespace Nif
{ "NiPSysPositionModifier", &construct<NiPSysModifier, RC_NiPSysPositionModifier> }, { "NiPSysPositionModifier", &construct<NiPSysModifier, RC_NiPSysPositionModifier> },
{ "NiPSysRotationModifier", &construct<NiPSysRotationModifier, RC_NiPSysRotationModifier> }, { "NiPSysRotationModifier", &construct<NiPSysRotationModifier, RC_NiPSysRotationModifier> },
{ "NiPSysSpawnModifier", &construct<NiPSysSpawnModifier, RC_NiPSysSpawnModifier> }, { "NiPSysSpawnModifier", &construct<NiPSysSpawnModifier, RC_NiPSysSpawnModifier> },
{ "NiPSysMeshUpdateModifier", &construct<NiPSysMeshUpdateModifier, RC_NiPSysMeshUpdateModifier> },
// Modifiers, Bethesda // Modifiers, Bethesda
{ "BSParentVelocityModifier", &construct<BSParentVelocityModifier, RC_BSParentVelocityModifier> },
{ "BSPSysHavokUpdateModifier", &construct<BSPSysHavokUpdateModifier, RC_BSPSysHavokUpdateModifier> },
{ "BSPSysInheritVelocityModifier", { "BSPSysInheritVelocityModifier",
&construct<BSPSysInheritVelocityModifier, RC_BSPSysInheritVelocityModifier> }, &construct<BSPSysInheritVelocityModifier, RC_BSPSysInheritVelocityModifier> },
{ "BSPSysLODModifier", &construct<BSPSysLODModifier, RC_BSPSysLODModifier> }, { "BSPSysLODModifier", &construct<BSPSysLODModifier, RC_BSPSysLODModifier> },
@ -350,6 +360,10 @@ namespace Nif
{ "NiPSysInitialRotAngleVarCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysInitialRotAngleVarCtlr> }, { "NiPSysInitialRotAngleVarCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysInitialRotAngleVarCtlr> },
{ "NiPSysModifierActiveCtlr", &construct<NiPSysModifierBoolCtlr, RC_NiPSysModifierActiveCtlr> }, { "NiPSysModifierActiveCtlr", &construct<NiPSysModifierBoolCtlr, RC_NiPSysModifierActiveCtlr> },
// Modifier controllers, Bethesda
{ "BSPSysMultiTargetEmitterCtlr",
&construct<BSPSysMultiTargetEmitterCtlr, RC_BSPSysMultiTargetEmitterCtlr> },
// Modifier controller data, Gamebryo // Modifier controller data, Gamebryo
{ "NiPSysEmitterCtlrData", &construct<NiPSysEmitterCtlrData, RC_NiPSysEmitterCtlrData> }, { "NiPSysEmitterCtlrData", &construct<NiPSysEmitterCtlrData, RC_NiPSysEmitterCtlrData> },
@ -383,10 +397,15 @@ namespace Nif
// Constraint records, Bethesda // Constraint records, Bethesda
{ "bhkBallAndSocketConstraint", &construct<bhkBallAndSocketConstraint, RC_bhkBallAndSocketConstraint> }, { "bhkBallAndSocketConstraint", &construct<bhkBallAndSocketConstraint, RC_bhkBallAndSocketConstraint> },
{ "bhkBallSocketConstraintChain",
&construct<bhkBallSocketConstraintChain, RC_bhkBallSocketConstraintChain> },
{ "bhkHingeConstraint", &construct<bhkHingeConstraint, RC_bhkHingeConstraint> }, { "bhkHingeConstraint", &construct<bhkHingeConstraint, RC_bhkHingeConstraint> },
{ "bhkLimitedHingeConstraint", &construct<bhkLimitedHingeConstraint, RC_bhkLimitedHingeConstraint> }, { "bhkLimitedHingeConstraint", &construct<bhkLimitedHingeConstraint, RC_bhkLimitedHingeConstraint> },
{ "bhkRagdollConstraint", &construct<bhkRagdollConstraint, RC_bhkRagdollConstraint> }, { "bhkRagdollConstraint", &construct<bhkRagdollConstraint, RC_bhkRagdollConstraint> },
{ "bhkStiffSpringConstraint", &construct<bhkStiffSpringConstraint, RC_bhkStiffSpringConstraint> }, { "bhkStiffSpringConstraint", &construct<bhkStiffSpringConstraint, RC_bhkStiffSpringConstraint> },
{ "bhkPrismaticConstraint", &construct<bhkPrismaticConstraint, RC_bhkPrismaticConstraint> },
{ "bhkMalleableConstraint", &construct<bhkMalleableConstraint, RC_bhkMalleableConstraint> },
{ "bhkBreakableConstraint", &construct<bhkBreakableConstraint, RC_bhkBreakableConstraint> },
// Physics body records, Bethesda // Physics body records, Bethesda
{ "bhkRigidBody", &construct<bhkRigidBody, RC_bhkRigidBody> }, { "bhkRigidBody", &construct<bhkRigidBody, RC_bhkRigidBody> },
@ -404,9 +423,11 @@ namespace Nif
{ "bhkConvexVerticesShape", &construct<bhkConvexVerticesShape, RC_bhkConvexVerticesShape> }, { "bhkConvexVerticesShape", &construct<bhkConvexVerticesShape, RC_bhkConvexVerticesShape> },
{ "bhkListShape", &construct<bhkListShape, RC_bhkListShape> }, { "bhkListShape", &construct<bhkListShape, RC_bhkListShape> },
{ "bhkMoppBvTreeShape", &construct<bhkMoppBvTreeShape, RC_bhkMoppBvTreeShape> }, { "bhkMoppBvTreeShape", &construct<bhkMoppBvTreeShape, RC_bhkMoppBvTreeShape> },
{ "bhkMultiSphereShape", &construct<bhkMultiSphereShape, RC_bhkMultiSphereShape> },
{ "bhkNiTriStripsShape", &construct<bhkNiTriStripsShape, RC_bhkNiTriStripsShape> }, { "bhkNiTriStripsShape", &construct<bhkNiTriStripsShape, RC_bhkNiTriStripsShape> },
{ "bhkPackedNiTriStripsShape", &construct<bhkPackedNiTriStripsShape, RC_bhkPackedNiTriStripsShape> }, { "bhkPackedNiTriStripsShape", &construct<bhkPackedNiTriStripsShape, RC_bhkPackedNiTriStripsShape> },
{ "hkPackedNiTriStripsData", &construct<hkPackedNiTriStripsData, RC_hkPackedNiTriStripsData> }, { "hkPackedNiTriStripsData", &construct<hkPackedNiTriStripsData, RC_hkPackedNiTriStripsData> },
{ "bhkPlaneShape", &construct<bhkPlaneShape, RC_bhkPlaneShape> },
{ "bhkSimpleShapePhantom", &construct<bhkSimpleShapePhantom, RC_bhkSimpleShapePhantom> }, { "bhkSimpleShapePhantom", &construct<bhkSimpleShapePhantom, RC_bhkSimpleShapePhantom> },
{ "bhkSphereShape", &construct<bhkSphereShape, RC_bhkSphereShape> }, { "bhkSphereShape", &construct<bhkSphereShape, RC_bhkSphereShape> },
{ "bhkTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> }, { "bhkTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> },

@ -150,6 +150,21 @@ namespace Nif
nif->readVector(mRotations, mNumVertices); nif->readVector(mRotations, mNumVertices);
} }
void BSMasterParticleSystem::read(NIFStream* nif)
{
NiNode::read(nif);
nif->read(mMaxEmitters);
readRecordList(nif, mParticleSystems);
}
void BSMasterParticleSystem::post(Reader& nif)
{
NiNode::post(nif);
postRecordList(nif, mParticleSystems);
}
void NiParticleSystem::read(NIFStream* nif) void NiParticleSystem::read(NIFStream* nif)
{ {
// Weird loading to account for inheritance differences starting from SSE // Weird loading to account for inheritance differences starting from SSE
@ -215,6 +230,26 @@ namespace Nif
} }
} }
void NiMeshPSysData::read(NIFStream* nif)
{
NiPSysData::read(nif);
if (nif->getVersion() >= NIFStream::generateVersion(10, 2, 0, 0))
{
nif->read(mDefaultPoolSize);
nif->read(mFillPoolsOnLoad);
nif->readVector(mGenerations, nif->get<uint32_t>());
}
mParticleMeshes.read(nif);
}
void NiMeshPSysData::post(Reader& nif)
{
NiPSysData::post(nif);
mParticleMeshes.post(nif);
}
void BSStripPSysData::read(NIFStream* nif) void BSStripPSysData::read(NIFStream* nif)
{ {
NiPSysData::read(nif); NiPSysData::read(nif);
@ -347,6 +382,20 @@ namespace Nif
nif->read(mBaseScale); nif->read(mBaseScale);
} }
void NiPSysMeshUpdateModifier::read(NIFStream* nif)
{
NiPSysModifier::read(nif);
readRecordList(nif, mMeshes);
}
void NiPSysMeshUpdateModifier::post(Reader& nif)
{
NiPSysModifier::post(nif);
postRecordList(nif, mMeshes);
}
void NiPSysRotationModifier::read(NIFStream* nif) void NiPSysRotationModifier::read(NIFStream* nif)
{ {
NiPSysModifier::read(nif); NiPSysModifier::read(nif);
@ -383,6 +432,27 @@ namespace Nif
nif->read(mLifespanVariation); nif->read(mLifespanVariation);
} }
void BSParentVelocityModifier::read(NIFStream* nif)
{
NiPSysModifier::read(nif);
nif->read(mDamping);
}
void BSPSysHavokUpdateModifier::read(NIFStream* nif)
{
NiPSysMeshUpdateModifier::read(nif);
mModifier.read(nif);
}
void BSPSysHavokUpdateModifier::post(Reader& nif)
{
NiPSysMeshUpdateModifier::post(nif);
mModifier.post(nif);
}
void BSPSysInheritVelocityModifier::read(NIFStream* nif) void BSPSysInheritVelocityModifier::read(NIFStream* nif)
{ {
NiPSysModifier::read(nif); NiPSysModifier::read(nif);
@ -575,6 +645,21 @@ namespace Nif
mVisInterpolator.post(nif); mVisInterpolator.post(nif);
} }
void BSPSysMultiTargetEmitterCtlr::read(NIFStream* nif)
{
NiPSysEmitterCtlr::read(nif);
nif->read(mMaxEmitters);
mMasterPSys.read(nif);
}
void BSPSysMultiTargetEmitterCtlr::post(Reader& nif)
{
NiPSysEmitterCtlr::post(nif);
mMasterPSys.post(nif);
}
void NiPSysEmitterCtlrData::read(NIFStream* nif) void NiPSysEmitterCtlrData::read(NIFStream* nif)
{ {
mFloatKeyList = std::make_shared<FloatKeyMap>(); mFloatKeyList = std::make_shared<FloatKeyMap>();

@ -115,6 +115,15 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct BSMasterParticleSystem : NiNode
{
uint16_t mMaxEmitters;
NiAVObjectList mParticleSystems;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct NiParticleSystem : NiParticles struct NiParticleSystem : NiParticles
{ {
osg::BoundingSpheref mBoundingSphere; osg::BoundingSpheref mBoundingSphere;
@ -138,6 +147,17 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct NiMeshPSysData : NiPSysData
{
uint32_t mDefaultPoolSize;
bool mFillPoolsOnLoad;
std::vector<uint32_t> mGenerations;
NiAVObjectPtr mParticleMeshes;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct BSStripPSysData : NiPSysData struct BSStripPSysData : NiPSysData
{ {
uint16_t mMaxPointCount; uint16_t mMaxPointCount;
@ -252,6 +272,14 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct NiPSysMeshUpdateModifier : NiPSysModifier
{
NiAVObjectList mMeshes;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct NiPSysRotationModifier : NiPSysModifier struct NiPSysRotationModifier : NiPSysModifier
{ {
float mRotationSpeed; float mRotationSpeed;
@ -279,6 +307,21 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct BSParentVelocityModifier : NiPSysModifier
{
float mDamping;
void read(NIFStream* nif) override;
};
struct BSPSysHavokUpdateModifier : NiPSysMeshUpdateModifier
{
NiPSysModifierPtr mModifier;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct BSPSysInheritVelocityModifier : NiPSysModifier struct BSPSysInheritVelocityModifier : NiPSysModifier
{ {
NiAVObjectPtr mInheritObject; NiAVObjectPtr mInheritObject;
@ -460,6 +503,15 @@ namespace Nif
void post(Reader& nif) override; void post(Reader& nif) override;
}; };
struct BSPSysMultiTargetEmitterCtlr : NiPSysEmitterCtlr
{
uint16_t mMaxEmitters;
BSMasterParticleSystemPtr mMasterPSys;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct NiPSysEmitterCtlrData : Record struct NiPSysEmitterCtlrData : Record
{ {
FloatKeyMapPtr mFloatKeyList; FloatKeyMapPtr mFloatKeyList;

@ -345,6 +345,120 @@ namespace Nif
nif->read(mLength); nif->read(mLength);
} }
void bhkPrismaticConstraintCInfo::read(NIFStream* nif)
{
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB)
{
nif->read(mDataA.mPivot);
nif->read(mDataA.mRotation);
nif->read(mDataA.mPlane);
nif->read(mDataA.mSliding);
nif->read(mDataB.mSliding);
nif->read(mDataB.mPivot);
nif->read(mDataB.mRotation);
nif->read(mDataB.mPlane);
}
else
{
nif->read(mDataA.mSliding);
nif->read(mDataA.mRotation);
nif->read(mDataA.mPlane);
nif->read(mDataA.mPivot);
nif->read(mDataB.mSliding);
nif->read(mDataB.mRotation);
nif->read(mDataB.mPlane);
nif->read(mDataB.mPivot);
}
nif->read(mMinDistance);
nif->read(mMaxDistance);
nif->read(mFriction);
if (nif->getVersion() >= NIFFile::NIFVersion::VER_BGS && nif->getBethVersion() >= 17)
mMotor.read(nif);
}
void bhkMalleableConstraintCInfo::read(NIFStream* nif)
{
mType = static_cast<hkConstraintType>(nif->get<uint32_t>());
mInfo.read(nif);
switch (mType)
{
case hkConstraintType::BallAndSocket:
mBallAndSocketInfo.read(nif);
break;
case hkConstraintType::Hinge:
mHingeInfo.read(nif);
break;
case hkConstraintType::LimitedHinge:
mLimitedHingeInfo.read(nif);
break;
case hkConstraintType::Prismatic:
mPrismaticInfo.read(nif);
break;
case hkConstraintType::Ragdoll:
mRagdollInfo.read(nif);
break;
case hkConstraintType::StiffSpring:
mStiffSpringInfo.read(nif);
break;
default:
throw Nif::Exception(
"Unrecognized constraint type in bhkMalleableConstraint", nif->getFile().getFilename());
}
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB)
{
nif->read(mTau);
nif->read(mDamping);
}
else
{
nif->read(mStrength);
}
}
void bhkWrappedConstraintData::read(NIFStream* nif)
{
mType = static_cast<hkConstraintType>(nif->get<uint32_t>());
mInfo.read(nif);
switch (mType)
{
case hkConstraintType::BallAndSocket:
mBallAndSocketInfo.read(nif);
break;
case hkConstraintType::Hinge:
mHingeInfo.read(nif);
break;
case hkConstraintType::LimitedHinge:
mLimitedHingeInfo.read(nif);
break;
case hkConstraintType::Prismatic:
mPrismaticInfo.read(nif);
break;
case hkConstraintType::Ragdoll:
mRagdollInfo.read(nif);
break;
case hkConstraintType::StiffSpring:
mStiffSpringInfo.read(nif);
break;
case hkConstraintType::Malleable:
mMalleableInfo.read(nif);
break;
default:
throw Nif::Exception(
"Unrecognized constraint type in bhkWrappedConstraintData", nif->getFile().getFilename());
}
}
void bhkConstraintChainCInfo::read(NIFStream* nif)
{
readRecordList(nif, mEntities);
mInfo.read(nif);
}
void bhkConstraintChainCInfo::post(Reader& nif)
{
postRecordList(nif, mEntities);
}
/// Record types /// Record types
void bhkCollisionObject::read(NIFStream* nif) void bhkCollisionObject::read(NIFStream* nif)
@ -602,6 +716,29 @@ namespace Nif
nif->skip(12); // Unused nif->skip(12); // Unused
} }
void bhkHeightfieldShape::read(NIFStream* nif)
{
mHavokMaterial.read(nif);
}
void bhkPlaneShape::read(NIFStream* nif)
{
bhkHeightfieldShape::read(nif);
nif->skip(12); // Unused
mPlane = osg::Plane(nif->get<osg::Vec4f>());
nif->read(mExtents);
nif->read(mCenter);
}
void bhkMultiSphereShape::read(NIFStream* nif)
{
bhkSphereRepShape::read(nif);
mShapeProperty.read(nif);
nif->readVector(mSpheres, nif->get<uint32_t>());
}
void bhkListShape::read(NIFStream* nif) void bhkListShape::read(NIFStream* nif)
{ {
readRecordList(nif, mSubshapes); readRecordList(nif, mSubshapes);
@ -739,6 +876,27 @@ namespace Nif
mConstraint.read(nif); mConstraint.read(nif);
} }
void bhkBallSocketConstraintChain::read(NIFStream* nif)
{
uint32_t numPivots = nif->get<uint32_t>();
if (numPivots % 2 != 0)
throw Nif::Exception(
"Invalid number of constraints in bhkBallSocketConstraintChain", nif->getFile().getFilename());
mConstraints.resize(numPivots / 2);
for (bhkBallAndSocketConstraintCInfo& info : mConstraints)
info.read(nif);
nif->read(mTau);
nif->read(mDamping);
nif->read(mConstraintForceMixing);
nif->read(mMaxErrorDistance);
mConstraintChainInfo.read(nif);
}
void bhkBallSocketConstraintChain::post(Reader& nif)
{
mConstraintChainInfo.post(nif);
}
void bhkStiffSpringConstraint::read(NIFStream* nif) void bhkStiffSpringConstraint::read(NIFStream* nif)
{ {
bhkConstraint::read(nif); bhkConstraint::read(nif);
@ -746,4 +904,27 @@ namespace Nif
mConstraint.read(nif); mConstraint.read(nif);
} }
void bhkPrismaticConstraint::read(NIFStream* nif)
{
bhkConstraint::read(nif);
mConstraint.read(nif);
}
void bhkMalleableConstraint::read(NIFStream* nif)
{
bhkConstraint::read(nif);
mConstraint.read(nif);
}
void bhkBreakableConstraint::read(NIFStream* nif)
{
bhkConstraint::read(nif);
mConstraint.read(nif);
nif->read(mThreshold);
nif->read(mRemoveWhenBroken);
}
} // Namespace } // Namespace

@ -5,6 +5,7 @@
#include "record.hpp" #include "record.hpp"
#include "recordptr.hpp" #include "recordptr.hpp"
#include <osg/Plane>
#include <osg/Quat> #include <osg/Quat>
#include <osg/Vec3f> #include <osg/Vec3f>
#include <osg/Vec4f> #include <osg/Vec4f>
@ -363,6 +364,73 @@ namespace Nif
void read(NIFStream* nif); void read(NIFStream* nif);
}; };
struct bhkPrismaticConstraintCInfo
{
struct Data
{
osg::Vec4f mSliding;
osg::Vec4f mRotation;
osg::Vec4f mPlane;
osg::Vec4f mPivot;
};
Data mDataA;
Data mDataB;
float mMinDistance, mMaxDistance;
float mFriction;
bhkConstraintMotorCInfo mMotor;
void read(NIFStream* nif);
};
enum class hkConstraintType : uint32_t
{
BallAndSocket = 0,
Hinge = 1,
LimitedHinge = 2,
Prismatic = 6,
Ragdoll = 7,
StiffSpring = 8,
Malleable = 13,
};
struct bhkWrappedConstraintDataBase
{
hkConstraintType mType;
bhkConstraintCInfo mInfo;
bhkBallAndSocketConstraintCInfo mBallAndSocketInfo;
bhkHingeConstraintCInfo mHingeInfo;
bhkLimitedHingeConstraintCInfo mLimitedHingeInfo;
bhkPrismaticConstraintCInfo mPrismaticInfo;
bhkRagdollConstraintCInfo mRagdollInfo;
bhkStiffSpringConstraintCInfo mStiffSpringInfo;
};
struct bhkMalleableConstraintCInfo : bhkWrappedConstraintDataBase
{
float mTau;
float mDamping;
float mStrength;
void read(NIFStream* nif);
};
struct bhkWrappedConstraintData : bhkWrappedConstraintDataBase
{
bhkMalleableConstraintCInfo mMalleableInfo;
void read(NIFStream* nif);
};
struct bhkConstraintChainCInfo
{
bhkRigidBodyList mEntities;
bhkConstraintCInfo mInfo;
void read(NIFStream* nif);
void post(Reader& nif);
};
/// Record types /// Record types
// Abstract Bethesda Havok object // Abstract Bethesda Havok object
@ -609,9 +677,36 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
// Abstract shape that can collide with an array of spheres
struct bhkHeightfieldShape : bhkShape
{
HavokMaterial mHavokMaterial;
void read(NIFStream* nif) override;
};
// A plane bounded by an AABB
struct bhkPlaneShape : bhkHeightfieldShape
{
osg::Plane mPlane;
osg::Vec4f mExtents;
osg::Vec4f mCenter;
void read(NIFStream* nif) override;
};
// A sphere // A sphere
using bhkSphereShape = bhkConvexShape; using bhkSphereShape = bhkConvexShape;
// Multiple spheres
struct bhkMultiSphereShape : bhkSphereRepShape
{
bhkWorldObjCInfoProperty mShapeProperty;
std::vector<osg::BoundingSpheref> mSpheres;
void read(NIFStream* nif) override;
};
// A list of shapes // A list of shapes
struct bhkListShape : public bhkShapeCollection struct bhkListShape : public bhkShapeCollection
{ {
@ -706,6 +801,19 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct bhkBallSocketConstraintChain : bhkSerializable
{
std::vector<bhkBallAndSocketConstraintCInfo> mConstraints;
float mTau;
float mDamping;
float mConstraintForceMixing;
float mMaxErrorDistance;
bhkConstraintChainCInfo mConstraintChainInfo;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct bhkStiffSpringConstraint : bhkConstraint struct bhkStiffSpringConstraint : bhkConstraint
{ {
bhkStiffSpringConstraintCInfo mConstraint; bhkStiffSpringConstraintCInfo mConstraint;
@ -713,5 +821,28 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct bhkPrismaticConstraint : bhkConstraint
{
bhkPrismaticConstraintCInfo mConstraint;
void read(NIFStream* nif) override;
};
struct bhkMalleableConstraint : bhkConstraint
{
bhkMalleableConstraintCInfo mConstraint;
void read(NIFStream* nif) override;
};
struct bhkBreakableConstraint : bhkConstraint
{
bhkWrappedConstraintData mConstraint;
float mThreshold;
bool mRemoveWhenBroken;
void read(NIFStream* nif) override;
};
} // Namespace } // Namespace
#endif #endif

@ -37,9 +37,11 @@ namespace Nif
RC_MISSING = 0, RC_MISSING = 0,
RC_AvoidNode, RC_AvoidNode,
RC_bhkBallAndSocketConstraint, RC_bhkBallAndSocketConstraint,
RC_bhkBallSocketConstraintChain,
RC_bhkBlendCollisionObject, RC_bhkBlendCollisionObject,
RC_bhkBlendController, RC_bhkBlendController,
RC_bhkBoxShape, RC_bhkBoxShape,
RC_bhkBreakableConstraint,
RC_bhkCapsuleShape, RC_bhkCapsuleShape,
RC_bhkCylinderShape, RC_bhkCylinderShape,
RC_bhkCollisionObject, RC_bhkCollisionObject,
@ -52,10 +54,14 @@ namespace Nif
RC_bhkHingeConstraint, RC_bhkHingeConstraint,
RC_bhkLimitedHingeConstraint, RC_bhkLimitedHingeConstraint,
RC_bhkListShape, RC_bhkListShape,
RC_bhkMalleableConstraint,
RC_bhkMoppBvTreeShape, RC_bhkMoppBvTreeShape,
RC_bhkMultiSphereShape,
RC_bhkNiTriStripsShape, RC_bhkNiTriStripsShape,
RC_bhkPackedNiTriStripsShape, RC_bhkPackedNiTriStripsShape,
RC_bhkPlaneShape,
RC_bhkPhysicsSystem, RC_bhkPhysicsSystem,
RC_bhkPrismaticConstraint,
RC_bhkRagdollConstraint, RC_bhkRagdollConstraint,
RC_bhkRagdollSystem, RC_bhkRagdollSystem,
RC_bhkRigidBody, RC_bhkRigidBody,
@ -94,9 +100,13 @@ namespace Nif
RC_BSMultiBoundSphere, RC_BSMultiBoundSphere,
RC_BSNiAlphaPropertyTestRefController, RC_BSNiAlphaPropertyTestRefController,
RC_BSPackedAdditionalGeometryData, RC_BSPackedAdditionalGeometryData,
RC_BSParentVelocityModifier,
RC_BSProceduralLightningController,
RC_BSPSysArrayEmitter, RC_BSPSysArrayEmitter,
RC_BSPSysHavokUpdateModifier,
RC_BSPSysInheritVelocityModifier, RC_BSPSysInheritVelocityModifier,
RC_BSPSysLODModifier, RC_BSPSysLODModifier,
RC_BSPSysMultiTargetEmitterCtlr,
RC_BSPSysRecycleBoundModifier, RC_BSPSysRecycleBoundModifier,
RC_BSPSysScaleModifier, RC_BSPSysScaleModifier,
RC_BSPSysSimpleColorModifier, RC_BSPSysSimpleColorModifier,
@ -129,6 +139,7 @@ namespace Nif
RC_NiBlendFloatInterpolator, RC_NiBlendFloatInterpolator,
RC_NiBlendPoint3Interpolator, RC_NiBlendPoint3Interpolator,
RC_NiBlendTransformInterpolator, RC_NiBlendTransformInterpolator,
RC_NiBoneLODController,
RC_NiBoolData, RC_NiBoolData,
RC_NiBooleanExtraData, RC_NiBooleanExtraData,
RC_NiBoolInterpolator, RC_NiBoolInterpolator,
@ -172,8 +183,10 @@ namespace Nif
RC_NiLinesData, RC_NiLinesData,
RC_NiLODNode, RC_NiLODNode,
RC_NiLookAtController, RC_NiLookAtController,
RC_NiLookAtInterpolator,
RC_NiMaterialColorController, RC_NiMaterialColorController,
RC_NiMaterialProperty, RC_NiMaterialProperty,
RC_NiMeshPSysData,
RC_NiMorphData, RC_NiMorphData,
RC_NiMultiTargetTransformController, RC_NiMultiTargetTransformController,
RC_NiNode, RC_NiNode,
@ -223,6 +236,7 @@ namespace Nif
RC_NiPSysInitialRotAngleCtlr, RC_NiPSysInitialRotAngleCtlr,
RC_NiPSysInitialRotAngleVarCtlr, RC_NiPSysInitialRotAngleVarCtlr,
RC_NiPSysMeshEmitter, RC_NiPSysMeshEmitter,
RC_NiPSysMeshUpdateModifier,
RC_NiPSysModifierActiveCtlr, RC_NiPSysModifierActiveCtlr,
RC_NiPSysPlanarCollider, RC_NiPSysPlanarCollider,
RC_NiPSysPositionModifier, RC_NiPSysPositionModifier,

@ -129,6 +129,7 @@ namespace Nif
struct NiSourceTexture; struct NiSourceTexture;
struct NiPalette; struct NiPalette;
struct NiParticleModifier; struct NiParticleModifier;
struct BSMasterParticleSystem;
struct NiParticleSystem; struct NiParticleSystem;
struct NiPSysCollider; struct NiPSysCollider;
struct NiPSysColliderManager; struct NiPSysColliderManager;
@ -138,6 +139,7 @@ namespace Nif
struct NiBoolData; struct NiBoolData;
struct NiSkinPartition; struct NiSkinPartition;
struct BSShaderTextureSet; struct BSShaderTextureSet;
struct NiTriBasedGeom;
struct NiGeometryData; struct NiGeometryData;
struct BSShaderProperty; struct BSShaderProperty;
struct NiAlphaProperty; struct NiAlphaProperty;
@ -148,6 +150,7 @@ namespace Nif
struct bhkSerializable; struct bhkSerializable;
struct bhkEntity; struct bhkEntity;
struct bhkConvexShape; struct bhkConvexShape;
struct bhkRigidBody;
struct hkPackedNiTriStripsData; struct hkPackedNiTriStripsData;
struct NiAccumulator; struct NiAccumulator;
struct NiInterpolator; struct NiInterpolator;
@ -177,14 +180,17 @@ 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 BSMasterParticleSystemPtr = RecordPtrT<BSMasterParticleSystem>;
using NiParticleSystemPtr = RecordPtrT<NiParticleSystem>; using NiParticleSystemPtr = RecordPtrT<NiParticleSystem>;
using NiPSysColliderPtr = RecordPtrT<NiPSysCollider>; using NiPSysColliderPtr = RecordPtrT<NiPSysCollider>;
using NiPSysColliderManagerPtr = RecordPtrT<NiPSysColliderManager>; using NiPSysColliderManagerPtr = RecordPtrT<NiPSysColliderManager>;
using NiPSysEmitterCtlrDataPtr = RecordPtrT<NiPSysEmitterCtlrData>; using NiPSysEmitterCtlrDataPtr = RecordPtrT<NiPSysEmitterCtlrData>;
using NiPSysModifierPtr = RecordPtrT<NiPSysModifier>;
using NiPSysSpawnModifierPtr = RecordPtrT<NiPSysSpawnModifier>; using NiPSysSpawnModifierPtr = RecordPtrT<NiPSysSpawnModifier>;
using NiBoolDataPtr = RecordPtrT<NiBoolData>; using NiBoolDataPtr = RecordPtrT<NiBoolData>;
using NiSkinPartitionPtr = RecordPtrT<NiSkinPartition>; using NiSkinPartitionPtr = RecordPtrT<NiSkinPartition>;
using BSShaderTextureSetPtr = RecordPtrT<BSShaderTextureSet>; using BSShaderTextureSetPtr = RecordPtrT<BSShaderTextureSet>;
using NiTriBasedGeomPtr = RecordPtrT<NiTriBasedGeom>;
using NiGeometryDataPtr = RecordPtrT<NiGeometryData>; using NiGeometryDataPtr = RecordPtrT<NiGeometryData>;
using BSShaderPropertyPtr = RecordPtrT<BSShaderProperty>; using BSShaderPropertyPtr = RecordPtrT<BSShaderProperty>;
using NiAlphaPropertyPtr = RecordPtrT<NiAlphaProperty>; using NiAlphaPropertyPtr = RecordPtrT<NiAlphaProperty>;
@ -194,6 +200,7 @@ namespace Nif
using bhkShapePtr = RecordPtrT<bhkShape>; using bhkShapePtr = RecordPtrT<bhkShape>;
using bhkEntityPtr = RecordPtrT<bhkEntity>; using bhkEntityPtr = RecordPtrT<bhkEntity>;
using bhkConvexShapePtr = RecordPtrT<bhkConvexShape>; using bhkConvexShapePtr = RecordPtrT<bhkConvexShape>;
using bhkRigidBodyPtr = RecordPtrT<bhkRigidBody>;
using hkPackedNiTriStripsDataPtr = RecordPtrT<hkPackedNiTriStripsData>; using hkPackedNiTriStripsDataPtr = RecordPtrT<hkPackedNiTriStripsData>;
using NiAccumulatorPtr = RecordPtrT<NiAccumulator>; using NiAccumulatorPtr = RecordPtrT<NiAccumulator>;
using NiInterpolatorPtr = RecordPtrT<NiInterpolator>; using NiInterpolatorPtr = RecordPtrT<NiInterpolator>;
@ -214,8 +221,10 @@ namespace Nif
using bhkShapeList = RecordListT<bhkShape>; using bhkShapeList = RecordListT<bhkShape>;
using bhkSerializableList = RecordListT<bhkSerializable>; using bhkSerializableList = RecordListT<bhkSerializable>;
using bhkEntityList = RecordListT<bhkEntity>; using bhkEntityList = RecordListT<bhkEntity>;
using bhkRigidBodyList = RecordListT<bhkEntity>;
using NiControllerSequenceList = RecordListT<NiControllerSequence>; using NiControllerSequenceList = RecordListT<NiControllerSequence>;
using NiPSysModifierList = RecordListT<NiPSysModifier>; using NiPSysModifierList = RecordListT<NiPSysModifier>;
using NiTriBasedGeomList = RecordListT<NiTriBasedGeom>;
} // Namespace } // Namespace
#endif #endif

Loading…
Cancel
Save