1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-29 00:32:49 +00:00
OpenMW/components/nif/physics.hpp

90 lines
1.9 KiB
C++
Raw Normal View History

#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
NodePtr mTarget;
void read(NIFStream *nif) override
{
mTarget.read(nif);
}
void post(NIFFile *nif) override
{
mTarget.post(nif);
}
};
// Bethesda Havok-specific collision object
struct bhkCollisionObject : public NiCollisionObject
{
unsigned short mFlags;
CollisionBodyPtr mBody;
void read(NIFStream *nif) override;
void post(NIFFile *nif) override
{
NiCollisionObject::post(nif);
mBody.post(nif);
}
};
// Abstract Havok shape info record
struct bhkWorldObject : public Record
{
bhkShapePtr mShape;
unsigned int mFlags; // Havok layer type, collision filter flags and group
struct WorldObjectInfo
{
unsigned char mPhaseType;
unsigned int mData;
unsigned int mSize;
unsigned int mCapacityAndFlags;
};
WorldObjectInfo mWorldObjectInfo;
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
{
Response_Invalid = 0,
Response_SimpleContact = 1,
Response_Reporting = 2,
Response_None = 3
2021-11-10 20:16:05 +03:00
};
struct bhkEntity : public bhkWorldObject
{
hkResponseType mResponseType;
unsigned short mProcessContactDelay;
2021-11-10 20:16:05 +03:00
void read(NIFStream *nif) override;
};
struct HavokMaterial
{
unsigned int mMaterial;
2021-11-10 20:16:05 +03:00
void read(NIFStream *nif);
};
struct hkSubPartData
{
HavokMaterial mHavokMaterial;
unsigned int mNumVertices;
unsigned int mHavokFilter;
2021-11-10 20:16:05 +03:00
void read(NIFStream *nif);
};
} // Namespace
#endif