mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Merge branch 'anythingandeverything' into 'master'
Read all official base Skyrim and SSE NIF files See merge request OpenMW/openmw!3443
This commit is contained in:
commit
a722518b4b
10 changed files with 662 additions and 1 deletions
|
@ -460,6 +460,50 @@ namespace 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)
|
||||
{
|
||||
NiTimeController::read(nif);
|
||||
|
@ -509,6 +553,49 @@ namespace Nif
|
|||
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)
|
||||
{
|
||||
NiTimeController::read(nif);
|
||||
|
@ -600,6 +687,26 @@ namespace 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)
|
||||
{
|
||||
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 112))
|
||||
|
|
|
@ -300,6 +300,24 @@ namespace Nif
|
|||
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
|
||||
{
|
||||
void read(NIFStream* nif) override;
|
||||
|
@ -336,6 +354,34 @@ namespace Nif
|
|||
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
|
||||
{
|
||||
bool mCumulative;
|
||||
|
@ -419,6 +465,21 @@ namespace Nif
|
|||
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
|
||||
struct NiBlendInterpolator : public NiInterpolator
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Nif
|
|||
switch (recType)
|
||||
{
|
||||
case RC_NiPSysData:
|
||||
// case RC_NiMeshPSysData:
|
||||
case RC_NiMeshPSysData:
|
||||
case RC_BSStripPSysData:
|
||||
isPSysData = true;
|
||||
break;
|
||||
|
|
|
@ -72,6 +72,7 @@ namespace Nif
|
|||
{ "BSDebrisNode", &construct<BSRangeNode, RC_NiNode> },
|
||||
{ "BSFadeNode", &construct<NiNode, RC_NiNode> },
|
||||
{ "BSLeafAnimNode", &construct<NiNode, RC_NiNode> },
|
||||
{ "BSMasterParticleSystem", &construct<BSMasterParticleSystem, RC_NiNode> },
|
||||
{ "BSMultiBoundNode", &construct<BSMultiBoundNode, RC_NiNode> },
|
||||
{ "BSOrderedNode", &construct<BSOrderedNode, RC_NiNode> },
|
||||
{ "BSRangeNode", &construct<BSRangeNode, RC_NiNode> },
|
||||
|
@ -117,6 +118,7 @@ namespace Nif
|
|||
{ "NiVisController", &construct<NiVisController, RC_NiVisController> },
|
||||
|
||||
// Gamebryo
|
||||
{ "NiBoneLODController", &construct<NiBoneLODController, RC_NiBoneLODController> },
|
||||
{ "NiControllerManager", &construct<NiControllerManager, RC_NiControllerManager> },
|
||||
{ "NiLightDimmerController", &construct<NiFloatInterpController, RC_NiLightDimmerController> },
|
||||
{ "NiTransformController", &construct<NiKeyframeController, RC_NiKeyframeController> },
|
||||
|
@ -136,6 +138,8 @@ namespace Nif
|
|||
{ "BSFrustumFOVController", &construct<NiFloatInterpController, RC_BSFrustumFOVController> },
|
||||
{ "BSKeyframeController", &construct<BSKeyframeController, RC_BSKeyframeController> },
|
||||
{ "BSLagBoneController", &construct<BSLagBoneController, RC_BSLagBoneController> },
|
||||
{ "BSProceduralLightningController",
|
||||
&construct<BSProceduralLightningController, RC_BSProceduralLightningController> },
|
||||
{ "BSMaterialEmittanceMultController",
|
||||
&construct<NiFloatInterpController, RC_BSMaterialEmittanceMultController> },
|
||||
{ "BSNiAlphaPropertyTestRefController",
|
||||
|
@ -153,6 +157,7 @@ namespace Nif
|
|||
{ "BSLightingShaderPropertyFloatController",
|
||||
&construct<BSEffectShaderPropertyFloatController, RC_BSLightingShaderPropertyFloatController> },
|
||||
{ "bhkBlendController", &construct<bhkBlendController, RC_bhkBlendController> },
|
||||
{ "NiBSBoneLODController", &construct<NiBoneLODController, RC_NiBoneLODController> },
|
||||
|
||||
// Interpolators, Gamebryo
|
||||
{ "NiBlendBoolInterpolator", &construct<NiBlendBoolInterpolator, RC_NiBlendBoolInterpolator> },
|
||||
|
@ -164,6 +169,7 @@ namespace Nif
|
|||
{ "NiBoolTimelineInterpolator", &construct<NiBoolInterpolator, RC_NiBoolTimelineInterpolator> },
|
||||
{ "NiColorInterpolator", &construct<NiColorInterpolator, RC_NiColorInterpolator> },
|
||||
{ "NiFloatInterpolator", &construct<NiFloatInterpolator, RC_NiFloatInterpolator> },
|
||||
{ "NiLookAtInterpolator", &construct<NiLookAtInterpolator, RC_NiLookAtInterpolator> },
|
||||
{ "NiPathInterpolator", &construct<NiPathInterpolator, RC_NiPathInterpolator> },
|
||||
{ "NiPoint3Interpolator", &construct<NiPoint3Interpolator, RC_NiPoint3Interpolator> },
|
||||
{ "NiTransformInterpolator", &construct<NiTransformInterpolator, RC_NiTransformInterpolator> },
|
||||
|
@ -281,6 +287,7 @@ namespace Nif
|
|||
{ "NiParticleSystem", &construct<NiParticleSystem, RC_NiParticleSystem> },
|
||||
{ "NiMeshParticleSystem", &construct<NiParticleSystem, RC_NiParticleSystem> },
|
||||
{ "NiPSysData", &construct<NiPSysData, RC_NiPSysData> },
|
||||
{ "NiMeshPSysData", &construct<NiMeshPSysData, RC_NiMeshPSysData> },
|
||||
|
||||
// Geometry, Bethesda
|
||||
{ "BSStripParticleSystem", &construct<NiParticleSystem, RC_BSStripParticleSystem> },
|
||||
|
@ -303,8 +310,11 @@ namespace Nif
|
|||
{ "NiPSysPositionModifier", &construct<NiPSysModifier, RC_NiPSysPositionModifier> },
|
||||
{ "NiPSysRotationModifier", &construct<NiPSysRotationModifier, RC_NiPSysRotationModifier> },
|
||||
{ "NiPSysSpawnModifier", &construct<NiPSysSpawnModifier, RC_NiPSysSpawnModifier> },
|
||||
{ "NiPSysMeshUpdateModifier", &construct<NiPSysMeshUpdateModifier, RC_NiPSysMeshUpdateModifier> },
|
||||
|
||||
// Modifiers, Bethesda
|
||||
{ "BSParentVelocityModifier", &construct<BSParentVelocityModifier, RC_BSParentVelocityModifier> },
|
||||
{ "BSPSysHavokUpdateModifier", &construct<BSPSysHavokUpdateModifier, RC_BSPSysHavokUpdateModifier> },
|
||||
{ "BSPSysInheritVelocityModifier",
|
||||
&construct<BSPSysInheritVelocityModifier, RC_BSPSysInheritVelocityModifier> },
|
||||
{ "BSPSysLODModifier", &construct<BSPSysLODModifier, RC_BSPSysLODModifier> },
|
||||
|
@ -350,6 +360,10 @@ namespace Nif
|
|||
{ "NiPSysInitialRotAngleVarCtlr", &construct<NiPSysModifierFloatCtlr, RC_NiPSysInitialRotAngleVarCtlr> },
|
||||
{ "NiPSysModifierActiveCtlr", &construct<NiPSysModifierBoolCtlr, RC_NiPSysModifierActiveCtlr> },
|
||||
|
||||
// Modifier controllers, Bethesda
|
||||
{ "BSPSysMultiTargetEmitterCtlr",
|
||||
&construct<BSPSysMultiTargetEmitterCtlr, RC_BSPSysMultiTargetEmitterCtlr> },
|
||||
|
||||
// Modifier controller data, Gamebryo
|
||||
{ "NiPSysEmitterCtlrData", &construct<NiPSysEmitterCtlrData, RC_NiPSysEmitterCtlrData> },
|
||||
|
||||
|
@ -383,10 +397,15 @@ namespace Nif
|
|||
|
||||
// Constraint records, Bethesda
|
||||
{ "bhkBallAndSocketConstraint", &construct<bhkBallAndSocketConstraint, RC_bhkBallAndSocketConstraint> },
|
||||
{ "bhkBallSocketConstraintChain",
|
||||
&construct<bhkBallSocketConstraintChain, RC_bhkBallSocketConstraintChain> },
|
||||
{ "bhkHingeConstraint", &construct<bhkHingeConstraint, RC_bhkHingeConstraint> },
|
||||
{ "bhkLimitedHingeConstraint", &construct<bhkLimitedHingeConstraint, RC_bhkLimitedHingeConstraint> },
|
||||
{ "bhkRagdollConstraint", &construct<bhkRagdollConstraint, RC_bhkRagdollConstraint> },
|
||||
{ "bhkStiffSpringConstraint", &construct<bhkStiffSpringConstraint, RC_bhkStiffSpringConstraint> },
|
||||
{ "bhkPrismaticConstraint", &construct<bhkPrismaticConstraint, RC_bhkPrismaticConstraint> },
|
||||
{ "bhkMalleableConstraint", &construct<bhkMalleableConstraint, RC_bhkMalleableConstraint> },
|
||||
{ "bhkBreakableConstraint", &construct<bhkBreakableConstraint, RC_bhkBreakableConstraint> },
|
||||
|
||||
// Physics body records, Bethesda
|
||||
{ "bhkRigidBody", &construct<bhkRigidBody, RC_bhkRigidBody> },
|
||||
|
@ -404,9 +423,11 @@ namespace Nif
|
|||
{ "bhkConvexVerticesShape", &construct<bhkConvexVerticesShape, RC_bhkConvexVerticesShape> },
|
||||
{ "bhkListShape", &construct<bhkListShape, RC_bhkListShape> },
|
||||
{ "bhkMoppBvTreeShape", &construct<bhkMoppBvTreeShape, RC_bhkMoppBvTreeShape> },
|
||||
{ "bhkMultiSphereShape", &construct<bhkMultiSphereShape, RC_bhkMultiSphereShape> },
|
||||
{ "bhkNiTriStripsShape", &construct<bhkNiTriStripsShape, RC_bhkNiTriStripsShape> },
|
||||
{ "bhkPackedNiTriStripsShape", &construct<bhkPackedNiTriStripsShape, RC_bhkPackedNiTriStripsShape> },
|
||||
{ "hkPackedNiTriStripsData", &construct<hkPackedNiTriStripsData, RC_hkPackedNiTriStripsData> },
|
||||
{ "bhkPlaneShape", &construct<bhkPlaneShape, RC_bhkPlaneShape> },
|
||||
{ "bhkSimpleShapePhantom", &construct<bhkSimpleShapePhantom, RC_bhkSimpleShapePhantom> },
|
||||
{ "bhkSphereShape", &construct<bhkSphereShape, RC_bhkSphereShape> },
|
||||
{ "bhkTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> },
|
||||
|
|
|
@ -150,6 +150,21 @@ namespace Nif
|
|||
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)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
NiPSysData::read(nif);
|
||||
|
@ -347,6 +382,20 @@ namespace Nif
|
|||
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)
|
||||
{
|
||||
NiPSysModifier::read(nif);
|
||||
|
@ -383,6 +432,27 @@ namespace Nif
|
|||
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)
|
||||
{
|
||||
NiPSysModifier::read(nif);
|
||||
|
@ -575,6 +645,21 @@ namespace 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)
|
||||
{
|
||||
mFloatKeyList = std::make_shared<FloatKeyMap>();
|
||||
|
|
|
@ -115,6 +115,15 @@ namespace Nif
|
|||
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
|
||||
{
|
||||
osg::BoundingSpheref mBoundingSphere;
|
||||
|
@ -138,6 +147,17 @@ namespace Nif
|
|||
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
|
||||
{
|
||||
uint16_t mMaxPointCount;
|
||||
|
@ -252,6 +272,14 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct NiPSysMeshUpdateModifier : NiPSysModifier
|
||||
{
|
||||
NiAVObjectList mMeshes;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
void post(Reader& nif) override;
|
||||
};
|
||||
|
||||
struct NiPSysRotationModifier : NiPSysModifier
|
||||
{
|
||||
float mRotationSpeed;
|
||||
|
@ -279,6 +307,21 @@ namespace Nif
|
|||
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
|
||||
{
|
||||
NiAVObjectPtr mInheritObject;
|
||||
|
@ -460,6 +503,15 @@ namespace Nif
|
|||
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
|
||||
{
|
||||
FloatKeyMapPtr mFloatKeyList;
|
||||
|
|
|
@ -345,6 +345,120 @@ namespace Nif
|
|||
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
|
||||
|
||||
void bhkCollisionObject::read(NIFStream* nif)
|
||||
|
@ -602,6 +716,29 @@ namespace Nif
|
|||
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)
|
||||
{
|
||||
readRecordList(nif, mSubshapes);
|
||||
|
@ -739,6 +876,27 @@ namespace 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)
|
||||
{
|
||||
bhkConstraint::read(nif);
|
||||
|
@ -746,4 +904,27 @@ namespace 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
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "record.hpp"
|
||||
#include "recordptr.hpp"
|
||||
|
||||
#include <osg/Plane>
|
||||
#include <osg/Quat>
|
||||
#include <osg/Vec3f>
|
||||
#include <osg/Vec4f>
|
||||
|
@ -363,6 +364,73 @@ namespace 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
|
||||
|
||||
// Abstract Bethesda Havok object
|
||||
|
@ -609,9 +677,36 @@ namespace Nif
|
|||
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
|
||||
using bhkSphereShape = bhkConvexShape;
|
||||
|
||||
// Multiple spheres
|
||||
struct bhkMultiSphereShape : bhkSphereRepShape
|
||||
{
|
||||
bhkWorldObjCInfoProperty mShapeProperty;
|
||||
std::vector<osg::BoundingSpheref> mSpheres;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
// A list of shapes
|
||||
struct bhkListShape : public bhkShapeCollection
|
||||
{
|
||||
|
@ -706,6 +801,19 @@ namespace Nif
|
|||
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
|
||||
{
|
||||
bhkStiffSpringConstraintCInfo mConstraint;
|
||||
|
@ -713,5 +821,28 @@ namespace Nif
|
|||
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
|
||||
#endif
|
||||
|
|
|
@ -37,9 +37,11 @@ namespace Nif
|
|||
RC_MISSING = 0,
|
||||
RC_AvoidNode,
|
||||
RC_bhkBallAndSocketConstraint,
|
||||
RC_bhkBallSocketConstraintChain,
|
||||
RC_bhkBlendCollisionObject,
|
||||
RC_bhkBlendController,
|
||||
RC_bhkBoxShape,
|
||||
RC_bhkBreakableConstraint,
|
||||
RC_bhkCapsuleShape,
|
||||
RC_bhkCylinderShape,
|
||||
RC_bhkCollisionObject,
|
||||
|
@ -52,10 +54,14 @@ namespace Nif
|
|||
RC_bhkHingeConstraint,
|
||||
RC_bhkLimitedHingeConstraint,
|
||||
RC_bhkListShape,
|
||||
RC_bhkMalleableConstraint,
|
||||
RC_bhkMoppBvTreeShape,
|
||||
RC_bhkMultiSphereShape,
|
||||
RC_bhkNiTriStripsShape,
|
||||
RC_bhkPackedNiTriStripsShape,
|
||||
RC_bhkPlaneShape,
|
||||
RC_bhkPhysicsSystem,
|
||||
RC_bhkPrismaticConstraint,
|
||||
RC_bhkRagdollConstraint,
|
||||
RC_bhkRagdollSystem,
|
||||
RC_bhkRigidBody,
|
||||
|
@ -94,9 +100,13 @@ namespace Nif
|
|||
RC_BSMultiBoundSphere,
|
||||
RC_BSNiAlphaPropertyTestRefController,
|
||||
RC_BSPackedAdditionalGeometryData,
|
||||
RC_BSParentVelocityModifier,
|
||||
RC_BSProceduralLightningController,
|
||||
RC_BSPSysArrayEmitter,
|
||||
RC_BSPSysHavokUpdateModifier,
|
||||
RC_BSPSysInheritVelocityModifier,
|
||||
RC_BSPSysLODModifier,
|
||||
RC_BSPSysMultiTargetEmitterCtlr,
|
||||
RC_BSPSysRecycleBoundModifier,
|
||||
RC_BSPSysScaleModifier,
|
||||
RC_BSPSysSimpleColorModifier,
|
||||
|
@ -129,6 +139,7 @@ namespace Nif
|
|||
RC_NiBlendFloatInterpolator,
|
||||
RC_NiBlendPoint3Interpolator,
|
||||
RC_NiBlendTransformInterpolator,
|
||||
RC_NiBoneLODController,
|
||||
RC_NiBoolData,
|
||||
RC_NiBooleanExtraData,
|
||||
RC_NiBoolInterpolator,
|
||||
|
@ -172,8 +183,10 @@ namespace Nif
|
|||
RC_NiLinesData,
|
||||
RC_NiLODNode,
|
||||
RC_NiLookAtController,
|
||||
RC_NiLookAtInterpolator,
|
||||
RC_NiMaterialColorController,
|
||||
RC_NiMaterialProperty,
|
||||
RC_NiMeshPSysData,
|
||||
RC_NiMorphData,
|
||||
RC_NiMultiTargetTransformController,
|
||||
RC_NiNode,
|
||||
|
@ -223,6 +236,7 @@ namespace Nif
|
|||
RC_NiPSysInitialRotAngleCtlr,
|
||||
RC_NiPSysInitialRotAngleVarCtlr,
|
||||
RC_NiPSysMeshEmitter,
|
||||
RC_NiPSysMeshUpdateModifier,
|
||||
RC_NiPSysModifierActiveCtlr,
|
||||
RC_NiPSysPlanarCollider,
|
||||
RC_NiPSysPositionModifier,
|
||||
|
|
|
@ -129,6 +129,7 @@ namespace Nif
|
|||
struct NiSourceTexture;
|
||||
struct NiPalette;
|
||||
struct NiParticleModifier;
|
||||
struct BSMasterParticleSystem;
|
||||
struct NiParticleSystem;
|
||||
struct NiPSysCollider;
|
||||
struct NiPSysColliderManager;
|
||||
|
@ -138,6 +139,7 @@ namespace Nif
|
|||
struct NiBoolData;
|
||||
struct NiSkinPartition;
|
||||
struct BSShaderTextureSet;
|
||||
struct NiTriBasedGeom;
|
||||
struct NiGeometryData;
|
||||
struct BSShaderProperty;
|
||||
struct NiAlphaProperty;
|
||||
|
@ -148,6 +150,7 @@ namespace Nif
|
|||
struct bhkSerializable;
|
||||
struct bhkEntity;
|
||||
struct bhkConvexShape;
|
||||
struct bhkRigidBody;
|
||||
struct hkPackedNiTriStripsData;
|
||||
struct NiAccumulator;
|
||||
struct NiInterpolator;
|
||||
|
@ -177,14 +180,17 @@ namespace Nif
|
|||
using NiSourceTexturePtr = RecordPtrT<NiSourceTexture>;
|
||||
using NiPalettePtr = RecordPtrT<NiPalette>;
|
||||
using NiParticleModifierPtr = RecordPtrT<NiParticleModifier>;
|
||||
using BSMasterParticleSystemPtr = RecordPtrT<BSMasterParticleSystem>;
|
||||
using NiParticleSystemPtr = RecordPtrT<NiParticleSystem>;
|
||||
using NiPSysColliderPtr = RecordPtrT<NiPSysCollider>;
|
||||
using NiPSysColliderManagerPtr = RecordPtrT<NiPSysColliderManager>;
|
||||
using NiPSysEmitterCtlrDataPtr = RecordPtrT<NiPSysEmitterCtlrData>;
|
||||
using NiPSysModifierPtr = RecordPtrT<NiPSysModifier>;
|
||||
using NiPSysSpawnModifierPtr = RecordPtrT<NiPSysSpawnModifier>;
|
||||
using NiBoolDataPtr = RecordPtrT<NiBoolData>;
|
||||
using NiSkinPartitionPtr = RecordPtrT<NiSkinPartition>;
|
||||
using BSShaderTextureSetPtr = RecordPtrT<BSShaderTextureSet>;
|
||||
using NiTriBasedGeomPtr = RecordPtrT<NiTriBasedGeom>;
|
||||
using NiGeometryDataPtr = RecordPtrT<NiGeometryData>;
|
||||
using BSShaderPropertyPtr = RecordPtrT<BSShaderProperty>;
|
||||
using NiAlphaPropertyPtr = RecordPtrT<NiAlphaProperty>;
|
||||
|
@ -194,6 +200,7 @@ namespace Nif
|
|||
using bhkShapePtr = RecordPtrT<bhkShape>;
|
||||
using bhkEntityPtr = RecordPtrT<bhkEntity>;
|
||||
using bhkConvexShapePtr = RecordPtrT<bhkConvexShape>;
|
||||
using bhkRigidBodyPtr = RecordPtrT<bhkRigidBody>;
|
||||
using hkPackedNiTriStripsDataPtr = RecordPtrT<hkPackedNiTriStripsData>;
|
||||
using NiAccumulatorPtr = RecordPtrT<NiAccumulator>;
|
||||
using NiInterpolatorPtr = RecordPtrT<NiInterpolator>;
|
||||
|
@ -214,8 +221,10 @@ namespace Nif
|
|||
using bhkShapeList = RecordListT<bhkShape>;
|
||||
using bhkSerializableList = RecordListT<bhkSerializable>;
|
||||
using bhkEntityList = RecordListT<bhkEntity>;
|
||||
using bhkRigidBodyList = RecordListT<bhkEntity>;
|
||||
using NiControllerSequenceList = RecordListT<NiControllerSequence>;
|
||||
using NiPSysModifierList = RecordListT<NiPSysModifier>;
|
||||
using NiTriBasedGeomList = RecordListT<NiTriBasedGeom>;
|
||||
|
||||
} // Namespace
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue