1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-10 15:45:37 +00:00

Read bhkNPCollisionObject, bhkPhysicsSystem and bhkRagdollSystem

This commit is contained in:
Alexei Kotov 2023-09-20 08:11:57 +03:00
parent b5f1d0a91b
commit 1aabc9aee5
5 changed files with 64 additions and 0 deletions

View File

@ -283,6 +283,7 @@ namespace Nif
{ "bhkCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> }, { "bhkCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> },
{ "bhkPCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> }, { "bhkPCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> },
{ "bhkSPCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> }, { "bhkSPCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> },
{ "bhkNPCollisionObject", &construct<bhkNPCollisionObject, RC_bhkCollisionObject> },
{ "bhkBlendCollisionObject", &construct<bhkBlendCollisionObject, RC_bhkBlendCollisionObject> }, { "bhkBlendCollisionObject", &construct<bhkBlendCollisionObject, RC_bhkBlendCollisionObject> },
// Constraint records, Bethesda // Constraint records, Bethesda
@ -313,6 +314,10 @@ namespace Nif
{ "bhkSphereShape", &construct<bhkSphereShape, RC_bhkSphereShape> }, { "bhkSphereShape", &construct<bhkSphereShape, RC_bhkSphereShape> },
{ "bhkTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> }, { "bhkTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> },
// Physics system records, Bethesda
{ "bhkPhysicsSystem", &construct<bhkPhysicsSystem, RC_bhkPhysicsSystem> },
{ "bhkRagdollSystem", &construct<bhkRagdollSystem, RC_bhkRagdollSystem> },
// PROPERTIES // PROPERTIES
// 4.0.0.2 // 4.0.0.2

View File

@ -342,6 +342,22 @@ namespace Nif
mBody.read(nif); mBody.read(nif);
} }
void bhkNPCollisionObject::read(NIFStream* nif)
{
NiCollisionObject::read(nif);
nif->read(mFlags);
mData.read(nif);
nif->read(mBodyID);
}
void bhkNPCollisionObject::post(Reader& nif)
{
NiCollisionObject::post(nif);
mData.post(nif);
}
void bhkBlendCollisionObject::read(NIFStream* nif) void bhkBlendCollisionObject::read(NIFStream* nif)
{ {
bhkCollisionObject::read(nif); bhkCollisionObject::read(nif);
@ -353,6 +369,16 @@ namespace Nif
nif->skip(8); // Unknown nif->skip(8); // Unknown
} }
void bhkPhysicsSystem::read(NIFStream* nif)
{
nif->readVector(mData, nif->get<uint32_t>());
}
void bhkRagdollSystem::read(NIFStream* nif)
{
nif->readVector(mData, nif->get<uint32_t>());
}
void bhkWorldObject::read(NIFStream* nif) void bhkWorldObject::read(NIFStream* nif)
{ {
mShape.read(nif); mShape.read(nif);

View File

@ -370,6 +370,11 @@ namespace Nif
{ {
}; };
// Abstract physics system
struct bhkSystem : public Record
{
};
// Generic collision object // Generic collision object
struct NiCollisionObject : public Record struct NiCollisionObject : public Record
{ {
@ -394,6 +399,16 @@ namespace Nif
} }
}; };
struct bhkNPCollisionObject : NiCollisionObject
{
uint16_t mFlags;
bhkSystemPtr mData;
uint32_t mBodyID;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
struct bhkBlendCollisionObject : bhkCollisionObject struct bhkBlendCollisionObject : bhkCollisionObject
{ {
float mHeirGain; float mHeirGain;
@ -402,6 +417,20 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct bhkPhysicsSystem : public bhkSystem
{
std::vector<uint8_t> mData;
void read(NIFStream* nif) override;
};
struct bhkRagdollSystem : public bhkSystem
{
std::vector<uint8_t> mData;
void read(NIFStream* nif) override;
};
// Abstract Havok shape info record // Abstract Havok shape info record
struct bhkWorldObject : public bhkSerializable struct bhkWorldObject : public bhkSerializable
{ {

View File

@ -54,7 +54,9 @@ namespace Nif
RC_bhkMoppBvTreeShape, RC_bhkMoppBvTreeShape,
RC_bhkNiTriStripsShape, RC_bhkNiTriStripsShape,
RC_bhkPackedNiTriStripsShape, RC_bhkPackedNiTriStripsShape,
RC_bhkPhysicsSystem,
RC_bhkRagdollConstraint, RC_bhkRagdollConstraint,
RC_bhkRagdollSystem,
RC_bhkRigidBody, RC_bhkRigidBody,
RC_bhkRigidBodyT, RC_bhkRigidBodyT,
RC_bhkSimpleShapePhantom, RC_bhkSimpleShapePhantom,

View File

@ -136,6 +136,7 @@ namespace Nif
struct BSShaderProperty; struct BSShaderProperty;
struct NiAlphaProperty; struct NiAlphaProperty;
struct NiCollisionObject; struct NiCollisionObject;
struct bhkSystem;
struct bhkWorldObject; struct bhkWorldObject;
struct bhkShape; struct bhkShape;
struct bhkSerializable; struct bhkSerializable;
@ -176,6 +177,7 @@ namespace Nif
using BSShaderPropertyPtr = RecordPtrT<BSShaderProperty>; using BSShaderPropertyPtr = RecordPtrT<BSShaderProperty>;
using NiAlphaPropertyPtr = RecordPtrT<NiAlphaProperty>; using NiAlphaPropertyPtr = RecordPtrT<NiAlphaProperty>;
using NiCollisionObjectPtr = RecordPtrT<NiCollisionObject>; using NiCollisionObjectPtr = RecordPtrT<NiCollisionObject>;
using bhkSystemPtr = RecordPtrT<bhkSystem>;
using bhkWorldObjectPtr = RecordPtrT<bhkWorldObject>; using bhkWorldObjectPtr = RecordPtrT<bhkWorldObject>;
using bhkShapePtr = RecordPtrT<bhkShape>; using bhkShapePtr = RecordPtrT<bhkShape>;
using bhkEntityPtr = RecordPtrT<bhkEntity>; using bhkEntityPtr = RecordPtrT<bhkEntity>;