1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 03:32:36 +00:00
OpenMW/components/nif/physics.cpp

110 lines
2.6 KiB
C++
Raw Normal View History

#include "physics.hpp"
#include "node.hpp"
namespace Nif
{
/// Non-record data types
void bhkWorldObjCInfoProperty::read(NIFStream *nif)
{
mData = nif->getUInt();
mSize = nif->getUInt();
mCapacityAndFlags = nif->getUInt();
}
void bhkWorldObjectCInfo::read(NIFStream *nif)
{
nif->skip(4); // Unused
mPhaseType = static_cast<BroadPhaseType>(nif->getChar());
nif->skip(3); // Unused
mProperty.read(nif);
}
void HavokMaterial::read(NIFStream *nif)
{
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB_OLD)
nif->skip(4); // Unknown
mMaterial = nif->getUInt();
}
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);
}
void bhkEntityCInfo::read(NIFStream *nif)
2021-11-10 20:16:05 +03:00
{
mResponseType = static_cast<hkResponseType>(nif->getChar());
2021-11-10 20:16:05 +03:00
nif->skip(1); // Unused
mProcessContactDelay = nif->getUShort();
2021-11-10 20:16:05 +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
{
mShape.read(nif);
2021-11-10 20:16:05 +03:00
if (nif->getVersion() <= NIFFile::NIFVersion::VER_OB_OLD)
nif->skip(4); // Unknown
mHavokFilter.read(nif);
mWorldObjectInfo.read(nif);
2021-11-10 20:16:05 +03:00
}
void bhkWorldObject::post(NIFFile *nif)
2021-11-10 20:16:05 +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);
}
} // Namespace