2021-11-10 19:31:28 +03:00
|
|
|
#include "physics.hpp"
|
|
|
|
#include "node.hpp"
|
|
|
|
|
|
|
|
namespace Nif
|
|
|
|
{
|
2021-11-13 19:14:28 +03:00
|
|
|
|
|
|
|
/// Non-record data types
|
|
|
|
|
|
|
|
void bhkWorldObjCInfoProperty::read(NIFStream *nif)
|
2021-11-10 19:31:28 +03:00
|
|
|
{
|
2021-11-13 19:14:28 +03:00
|
|
|
mData = nif->getUInt();
|
|
|
|
mSize = nif->getUInt();
|
|
|
|
mCapacityAndFlags = nif->getUInt();
|
2021-11-10 19:31:28 +03:00
|
|
|
}
|
|
|
|
|
2021-11-13 19:14:28 +03:00
|
|
|
void bhkWorldObjectCInfo::read(NIFStream *nif)
|
2021-11-10 19:31:28 +03:00
|
|
|
{
|
|
|
|
nif->skip(4); // Unused
|
2021-11-13 19:14:28 +03:00
|
|
|
mPhaseType = static_cast<BroadPhaseType>(nif->getChar());
|
2021-11-10 19:31:28 +03:00
|
|
|
nif->skip(3); // Unused
|
2021-11-13 19:14:28 +03:00
|
|
|
mProperty.read(nif);
|
2021-11-10 19:31:28 +03:00
|
|
|
}
|
|
|
|
|
2021-11-13 19:14:28 +03:00
|
|
|
void HavokMaterial::read(NIFStream *nif)
|
2021-11-10 19:31:28 +03:00
|
|
|
{
|
2021-11-13 19:14:28 +03:00
|
|
|
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB_OLD)
|
|
|
|
nif->skip(4); // Unknown
|
|
|
|
mMaterial = nif->getUInt();
|
2021-11-10 19:31:28 +03:00
|
|
|
}
|
|
|
|
|
2021-11-13 19:14:28 +03:00
|
|
|
void HavokFilter::read(NIFStream *nif)
|
|
|
|
{
|
|
|
|
mLayer = nif->getChar();
|
|
|
|
mFlags = nif->getChar();
|
|
|
|
mGroup = nif->getUShort();
|
|
|
|
}
|
|
|
|
|
|
|
|
void hkSubPartData::read(NIFStream *nif)
|
|
|
|
{
|
|
|
|
mHavokFilter.read(nif);
|
|
|
|
mNumVertices = nif->getUInt();
|
|
|
|
mHavokMaterial.read(nif);
|
|
|
|
}
|
|
|
|
|
2021-11-13 19:23:37 +03:00
|
|
|
void hkpMoppCode::read(NIFStream *nif)
|
|
|
|
{
|
|
|
|
unsigned int size = nif->getUInt();
|
|
|
|
if (nif->getVersion() >= NIFStream::generateVersion(10,1,0,0))
|
|
|
|
mOffset = nif->getVector4();
|
|
|
|
if (nif->getBethVersion() > NIFFile::BethVersion::BETHVER_FO3)
|
|
|
|
nif->getChar(); // MOPP data build type
|
|
|
|
if (size)
|
|
|
|
nif->getChars(mData, size);
|
|
|
|
}
|
|
|
|
|
2021-11-13 19:14:28 +03:00
|
|
|
void bhkEntityCInfo::read(NIFStream *nif)
|
2021-11-10 20:16:05 +03:00
|
|
|
{
|
2021-11-10 22:50:01 +03:00
|
|
|
mResponseType = static_cast<hkResponseType>(nif->getChar());
|
2021-11-10 20:16:05 +03:00
|
|
|
nif->skip(1); // Unused
|
2021-11-10 22:50:01 +03:00
|
|
|
mProcessContactDelay = nif->getUShort();
|
2021-11-10 20:16:05 +03:00
|
|
|
}
|
|
|
|
|
2021-11-13 19:14:28 +03:00
|
|
|
/// Record types
|
|
|
|
|
|
|
|
void bhkCollisionObject::read(NIFStream *nif)
|
|
|
|
{
|
|
|
|
NiCollisionObject::read(nif);
|
|
|
|
mFlags = nif->getUShort();
|
|
|
|
mBody.read(nif);
|
|
|
|
}
|
|
|
|
|
|
|
|
void bhkWorldObject::read(NIFStream *nif)
|
2021-11-10 20:16:05 +03:00
|
|
|
{
|
2021-11-13 19:14:28 +03:00
|
|
|
mShape.read(nif);
|
2021-11-10 20:16:05 +03:00
|
|
|
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB_OLD)
|
|
|
|
nif->skip(4); // Unknown
|
2021-11-13 19:14:28 +03:00
|
|
|
mHavokFilter.read(nif);
|
|
|
|
mWorldObjectInfo.read(nif);
|
2021-11-10 20:16:05 +03:00
|
|
|
}
|
|
|
|
|
2021-11-13 19:14:28 +03:00
|
|
|
void bhkWorldObject::post(NIFFile *nif)
|
2021-11-10 20:16:05 +03:00
|
|
|
{
|
2021-11-13 19:14:28 +03:00
|
|
|
mShape.post(nif);
|
|
|
|
}
|
|
|
|
|
|
|
|
void bhkEntity::read(NIFStream *nif)
|
|
|
|
{
|
|
|
|
bhkWorldObject::read(nif);
|
|
|
|
mInfo.read(nif);
|
2021-11-10 20:16:05 +03:00
|
|
|
}
|
|
|
|
|
2021-11-13 19:23:37 +03:00
|
|
|
void bhkBvTreeShape::read(NIFStream *nif)
|
|
|
|
{
|
|
|
|
mShape.read(nif);
|
|
|
|
}
|
|
|
|
|
|
|
|
void bhkBvTreeShape::post(NIFFile *nif)
|
|
|
|
{
|
|
|
|
mShape.post(nif);
|
|
|
|
}
|
|
|
|
|
|
|
|
void bhkMoppBvTreeShape::read(NIFStream *nif)
|
|
|
|
{
|
|
|
|
bhkBvTreeShape::read(nif);
|
|
|
|
nif->skip(12); // Unused
|
|
|
|
mScale = nif->getFloat();
|
|
|
|
mMopp.read(nif);
|
|
|
|
}
|
|
|
|
|
2021-11-10 19:31:28 +03:00
|
|
|
} // Namespace
|