2021-11-10 19:31:28 +03:00
|
|
|
#ifndef OPENMW_COMPONENTS_NIF_PHYSICS_HPP
|
|
|
|
#define OPENMW_COMPONENTS_NIF_PHYSICS_HPP
|
|
|
|
|
|
|
|
#include "base.hpp"
|
|
|
|
|
|
|
|
// This header contains certain record definitions
|
|
|
|
// specific to Bethesda implementation of Havok physics
|
|
|
|
namespace Nif
|
|
|
|
{
|
|
|
|
|
|
|
|
// Generic collision object
|
|
|
|
struct NiCollisionObject : public Record
|
|
|
|
{
|
|
|
|
// The node that references this object
|
2021-11-10 22:50:01 +03:00
|
|
|
NodePtr mTarget;
|
2021-11-10 19:31:28 +03:00
|
|
|
|
|
|
|
void read(NIFStream *nif) override
|
|
|
|
{
|
2021-11-10 22:50:01 +03:00
|
|
|
mTarget.read(nif);
|
2021-11-10 19:31:28 +03:00
|
|
|
}
|
|
|
|
void post(NIFFile *nif) override
|
|
|
|
{
|
2021-11-10 22:50:01 +03:00
|
|
|
mTarget.post(nif);
|
2021-11-10 19:31:28 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Bethesda Havok-specific collision object
|
|
|
|
struct bhkCollisionObject : public NiCollisionObject
|
|
|
|
{
|
2021-11-10 22:50:01 +03:00
|
|
|
unsigned short mFlags;
|
|
|
|
CollisionBodyPtr mBody;
|
2021-11-10 19:31:28 +03:00
|
|
|
|
|
|
|
void read(NIFStream *nif) override;
|
|
|
|
void post(NIFFile *nif) override
|
|
|
|
{
|
|
|
|
NiCollisionObject::post(nif);
|
2021-11-10 22:50:01 +03:00
|
|
|
mBody.post(nif);
|
2021-11-10 19:31:28 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Abstract Havok shape info record
|
|
|
|
struct bhkWorldObject : public Record
|
|
|
|
{
|
2021-11-10 22:50:01 +03:00
|
|
|
bhkShapePtr mShape;
|
|
|
|
unsigned int mFlags; // Havok layer type, collision filter flags and group
|
2021-11-10 19:31:28 +03:00
|
|
|
struct WorldObjectInfo
|
|
|
|
{
|
2021-11-10 22:50:01 +03:00
|
|
|
unsigned char mPhaseType;
|
|
|
|
unsigned int mData;
|
|
|
|
unsigned int mSize;
|
|
|
|
unsigned int mCapacityAndFlags;
|
2021-11-10 19:31:28 +03:00
|
|
|
};
|
2021-11-10 22:50:01 +03:00
|
|
|
WorldObjectInfo mWorldObjectInfo;
|
2021-11-10 19:31:28 +03:00
|
|
|
void read(NIFStream *nif) override;
|
|
|
|
void post(NIFFile *nif) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct bhkShape : public Record {};
|
|
|
|
|
2021-11-10 20:16:05 +03:00
|
|
|
enum class hkResponseType : uint8_t
|
|
|
|
{
|
2021-11-10 22:50:01 +03:00
|
|
|
Response_Invalid = 0,
|
|
|
|
Response_SimpleContact = 1,
|
|
|
|
Response_Reporting = 2,
|
|
|
|
Response_None = 3
|
2021-11-10 20:16:05 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct bhkEntity : public bhkWorldObject
|
|
|
|
{
|
2021-11-10 22:50:01 +03:00
|
|
|
hkResponseType mResponseType;
|
|
|
|
unsigned short mProcessContactDelay;
|
2021-11-10 20:16:05 +03:00
|
|
|
void read(NIFStream *nif) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct HavokMaterial
|
|
|
|
{
|
2021-11-10 22:50:01 +03:00
|
|
|
unsigned int mMaterial;
|
2021-11-10 20:16:05 +03:00
|
|
|
void read(NIFStream *nif);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct hkSubPartData
|
|
|
|
{
|
2021-11-10 22:50:01 +03:00
|
|
|
HavokMaterial mHavokMaterial;
|
|
|
|
unsigned int mNumVertices;
|
|
|
|
unsigned int mHavokFilter;
|
2021-11-10 20:16:05 +03:00
|
|
|
void read(NIFStream *nif);
|
|
|
|
};
|
|
|
|
|
2021-11-10 19:31:28 +03:00
|
|
|
} // Namespace
|
|
|
|
#endif
|