1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-28 20:09:42 +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 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 /// Record types
void bhkCollisionObject::read(NIFStream* nif) void bhkCollisionObject::read(NIFStream* nif)
@ -448,4 +463,15 @@ namespace Nif
nif->readArray(mat); nif->readArray(mat);
mTransform.set(mat.data()); mTransform.set(mat.data());
} }
void bhkConstraint::read(NIFStream* nif)
{
mInfo.read(nif);
}
void bhkConstraint::post(Reader& nif)
{
mInfo.post(nif);
}
} // Namespace } // Namespace

View file

@ -210,6 +210,21 @@ namespace Nif
void read(NIFStream* 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 /// Record types
// Abstract Bethesda Havok object // Abstract Bethesda Havok object
@ -431,5 +446,14 @@ namespace Nif
osg::Matrixf mTransform; osg::Matrixf mTransform;
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
// Abstract constraint
struct bhkConstraint : public bhkSerializable
{
bhkConstraintCInfo mInfo;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
} // Namespace } // Namespace
#endif #endif

View file

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