1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Add bhkConstraint

This commit is contained in:
Alexei Kotov 2023-07-15 05:21:51 +03:00
parent ce84fdf5f5
commit 723f5c58e1
3 changed files with 52 additions and 0 deletions

View File

@ -187,6 +187,21 @@ namespace Nif
nif->skip(12); // Unused
}
void bhkConstraintCInfo::read(NIFStream* nif)
{
nif->get<unsigned int>(); // Number of entities, unused
mEntities.resize(2); // Hardcoded
for (auto& entity : mEntities)
entity.read(nif);
mPriority = static_cast<ConstraintPriority>(nif->get<uint32_t>());
}
void bhkConstraintCInfo::post(Reader& nif)
{
postRecordList(nif, mEntities);
}
/// Record types
void bhkCollisionObject::read(NIFStream* nif)
@ -448,4 +463,15 @@ namespace Nif
nif->readArray(mat);
mTransform.set(mat.data());
}
void bhkConstraint::read(NIFStream* nif)
{
mInfo.read(nif);
}
void bhkConstraint::post(Reader& nif)
{
mInfo.post(nif);
}
} // Namespace

View File

@ -210,6 +210,21 @@ namespace Nif
void read(NIFStream* nif);
};
enum class ConstraintPriority : uint32_t
{
Priority_Invalid = 0,
Priority_PhysicsTime = 1,
Priority_TimeOfImpact = 3
};
struct bhkConstraintCInfo
{
bhkEntityList mEntities;
ConstraintPriority mPriority;
void read(NIFStream* nif);
void post(Reader& nif);
};
/// Record types
// Abstract Bethesda Havok object
@ -431,5 +446,14 @@ namespace Nif
osg::Matrixf mTransform;
void read(NIFStream* nif) override;
};
// Abstract constraint
struct bhkConstraint : public bhkSerializable
{
bhkConstraintCInfo mInfo;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
} // Namespace
#endif

View File

@ -137,6 +137,7 @@ namespace Nif
struct bhkWorldObject;
struct bhkShape;
struct bhkSerializable;
struct bhkEntity;
struct hkPackedNiTriStripsData;
struct NiAccumulator;
struct NiInterpolator;
@ -194,6 +195,7 @@ namespace Nif
using NiTriStripsDataList = RecordListT<NiTriStripsData>;
using bhkShapeList = RecordListT<bhkShape>;
using bhkSerializableList = RecordListT<bhkSerializable>;
using bhkEntityList = RecordListT<bhkEntity>;
using NiControllerSequenceList = RecordListT<NiControllerSequence>;
} // Namespace