Read bhkLimitedHingeConstraint

revert-6246b479
Alexei Kotov 1 year ago
parent 23f95cf762
commit 6c4957fe4a

@ -183,6 +183,7 @@ namespace Nif
{ "bhkRigidBodyT", &construct<bhkRigidBody, RC_bhkRigidBodyT> },
{ "bhkRagdollConstraint", &construct<bhkRagdollConstraint, RC_bhkRagdollConstraint> },
{ "bhkHingeConstraint", &construct<bhkHingeConstraint, RC_bhkHingeConstraint> },
{ "bhkLimitedHingeConstraint", &construct<bhkLimitedHingeConstraint, RC_bhkLimitedHingeConstraint> },
{ "BSLightingShaderProperty", &construct<BSLightingShaderProperty, RC_BSLightingShaderProperty> },
{ "BSEffectShaderProperty", &construct<BSEffectShaderProperty, RC_BSEffectShaderProperty> },
{ "NiSortAdjustNode", &construct<NiSortAdjustNode, RC_NiSortAdjustNode> },

@ -306,6 +306,37 @@ namespace Nif
nif->read(mDataB.mPivot);
}
}
void bhkLimitedHingeConstraintCInfo::read(NIFStream* nif)
{
if (nif->getBethVersion() <= 16)
{
nif->read(mDataA.mPivot);
nif->read(mDataA.mAxis);
nif->read(mDataA.mPerpAxis1);
nif->read(mDataA.mPerpAxis2);
nif->read(mDataB.mPivot);
nif->read(mDataB.mAxis);
nif->read(mDataB.mPerpAxis2);
}
else
{
nif->read(mDataA.mAxis);
nif->read(mDataA.mPerpAxis1);
nif->read(mDataA.mPerpAxis2);
nif->read(mDataA.mPivot);
nif->read(mDataB.mAxis);
nif->read(mDataB.mPerpAxis1);
nif->read(mDataB.mPerpAxis2);
nif->read(mDataB.mPivot);
}
nif->read(mMinAngle);
nif->read(mMaxAngle);
nif->read(mMaxFriction);
if (nif->getVersion() >= NIFFile::NIFVersion::VER_BGS && nif->getBethVersion() > 16)
mMotor.read(nif);
}
/// Record types
void bhkCollisionObject::read(NIFStream* nif)
@ -590,4 +621,10 @@ namespace Nif
mConstraint.read(nif);
}
void bhkLimitedHingeConstraint::read(NIFStream* nif)
{
bhkConstraint::read(nif);
mConstraint.read(nif);
}
} // Namespace

@ -306,6 +306,23 @@ namespace Nif
void read(NIFStream* nif);
};
struct bhkLimitedHingeConstraintCInfo
{
struct HingeData
{
osg::Vec4f mPivot;
osg::Vec4f mAxis;
osg::Vec4f mPerpAxis1;
osg::Vec4f mPerpAxis2;
};
HingeData mDataA;
HingeData mDataB;
float mMinAngle, mMaxAngle;
float mMaxFriction;
bhkConstraintMotorCInfo mMotor;
void read(NIFStream* nif);
};
/// Record types
// Abstract Bethesda Havok object
@ -548,5 +565,11 @@ namespace Nif
void read(NIFStream* nif) override;
};
struct bhkLimitedHingeConstraint : public bhkConstraint
{
bhkLimitedHingeConstraintCInfo mConstraint;
void read(NIFStream* nif) override;
};
} // Namespace
#endif

@ -148,6 +148,7 @@ namespace Nif
RC_bhkRigidBodyT,
RC_bhkRagdollConstraint,
RC_bhkHingeConstraint,
RC_bhkLimitedHingeConstraint,
RC_BSLightingShaderProperty,
RC_BSEffectShaderProperty,
RC_NiClusterAccumulator,

Loading…
Cancel
Save