1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 18:15:35 +00:00

Parse bhkPoseArray

This commit is contained in:
Alexei Kotov 2024-09-18 23:03:39 +03:00
parent 695932d2db
commit 6e70893113
4 changed files with 41 additions and 0 deletions

View file

@ -484,6 +484,9 @@ namespace Nif
{ "bhkRagdollTemplate", &construct<bhkRagdollTemplate, RC_bhkRagdollTemplate> }, { "bhkRagdollTemplate", &construct<bhkRagdollTemplate, RC_bhkRagdollTemplate> },
{ "bhkRagdollTemplateData", &construct<bhkRagdollTemplateData, RC_bhkRagdollTemplateData> }, { "bhkRagdollTemplateData", &construct<bhkRagdollTemplateData, RC_bhkRagdollTemplateData> },
// Other records
{ "bhkPoseArray", &construct<bhkPoseArray, RC_bhkPoseArray> },
// PROPERTIES // PROPERTIES
// 4.0.0.2 // 4.0.0.2

View file

@ -1013,4 +1013,23 @@ namespace Nif
constraint.read(nif); constraint.read(nif);
} }
void bhkPoseArray::BoneTransform::read(NIFStream* nif)
{
nif->read(mTranslation);
nif->read(mRotation);
nif->read(mScale);
}
void bhkPoseArray::read(NIFStream* nif)
{
nif->readVector(mBones, nif->get<uint32_t>());
mPoses.resize(nif->get<uint32_t>());
for (std::vector<BoneTransform>& pose : mPoses)
{
pose.resize(nif->get<uint32_t>());
for (BoneTransform& transform : pose)
transform.read(nif);
}
}
} // Namespace } // Namespace

View file

@ -930,5 +930,23 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct bhkPoseArray : Record
{
struct BoneTransform
{
osg::Vec3f mTranslation;
// FIXME: this and some other quaternions are meant to be read in direct order
osg::Quat mRotation;
osg::Vec3f mScale;
void read(NIFStream* nif);
};
std::vector<std::string> mBones;
std::vector<std::vector<BoneTransform>> mPoses;
void read(NIFStream* nif) override;
};
} // Namespace } // Namespace
#endif #endif

View file

@ -65,6 +65,7 @@ namespace Nif
RC_bhkPackedNiTriStripsShape, RC_bhkPackedNiTriStripsShape,
RC_bhkPlaneShape, RC_bhkPlaneShape,
RC_bhkPhysicsSystem, RC_bhkPhysicsSystem,
RC_bhkPoseArray,
RC_bhkPrismaticConstraint, RC_bhkPrismaticConstraint,
RC_bhkRagdollConstraint, RC_bhkRagdollConstraint,
RC_bhkRagdollSystem, RC_bhkRagdollSystem,