mirror of https://github.com/OpenMW/openmw.git
Load NiCollisionObject and bhkCollisionObject
parent
9500afaa5a
commit
5571099147
@ -0,0 +1,32 @@
|
||||
#include "physics.hpp"
|
||||
#include "node.hpp"
|
||||
|
||||
namespace Nif
|
||||
{
|
||||
void bhkCollisionObject::read(NIFStream *nif)
|
||||
{
|
||||
NiCollisionObject::read(nif);
|
||||
flags = nif->getUShort();
|
||||
body.read(nif);
|
||||
}
|
||||
|
||||
void bhkWorldObject::read(NIFStream *nif)
|
||||
{
|
||||
shape.read(nif);
|
||||
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB_OLD)
|
||||
nif->skip(4); // Unknown
|
||||
flags = nif->getUInt();
|
||||
nif->skip(4); // Unused
|
||||
worldObjectInfo.phaseType = nif->getChar();
|
||||
nif->skip(3); // Unused
|
||||
worldObjectInfo.data = nif->getUInt();
|
||||
worldObjectInfo.size = nif->getUInt();
|
||||
worldObjectInfo.capacityAndFlags = nif->getUInt();
|
||||
}
|
||||
|
||||
void bhkWorldObject::post(NIFFile *nif)
|
||||
{
|
||||
shape.post(nif);
|
||||
}
|
||||
|
||||
} // Namespace
|
@ -0,0 +1,62 @@
|
||||
#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 target;
|
||||
|
||||
void read(NIFStream *nif) override
|
||||
{
|
||||
target.read(nif);
|
||||
}
|
||||
void post(NIFFile *nif) override
|
||||
{
|
||||
target.post(nif);
|
||||
}
|
||||
};
|
||||
|
||||
// Bethesda Havok-specific collision object
|
||||
struct bhkCollisionObject : public NiCollisionObject
|
||||
{
|
||||
unsigned short flags;
|
||||
CollisionBodyPtr body;
|
||||
|
||||
void read(NIFStream *nif) override;
|
||||
void post(NIFFile *nif) override
|
||||
{
|
||||
NiCollisionObject::post(nif);
|
||||
body.post(nif);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Abstract Havok shape info record
|
||||
struct bhkWorldObject : public Record
|
||||
{
|
||||
bhkShapePtr shape;
|
||||
unsigned int flags; // Havok layer type, collision filter flags and group
|
||||
struct WorldObjectInfo
|
||||
{
|
||||
unsigned char phaseType;
|
||||
unsigned int data;
|
||||
unsigned int size;
|
||||
unsigned int capacityAndFlags;
|
||||
};
|
||||
WorldObjectInfo worldObjectInfo;
|
||||
void read(NIFStream *nif) override;
|
||||
void post(NIFFile *nif) override;
|
||||
};
|
||||
|
||||
struct bhkShape : public Record {};
|
||||
|
||||
} // Namespace
|
||||
#endif
|
Loading…
Reference in New Issue