mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-29 03:19:44 +00:00
Read bhkCompressedMeshShape
This commit is contained in:
parent
fc6bc90c3d
commit
9618a465ce
@ -182,6 +182,8 @@ namespace Nif
|
|||||||
{ "NiBlendPoint3Interpolator", &construct<NiBlendPoint3Interpolator, RC_NiBlendPoint3Interpolator> },
|
{ "NiBlendPoint3Interpolator", &construct<NiBlendPoint3Interpolator, RC_NiBlendPoint3Interpolator> },
|
||||||
{ "NiBlendTransformInterpolator",
|
{ "NiBlendTransformInterpolator",
|
||||||
&construct<NiBlendTransformInterpolator, RC_NiBlendTransformInterpolator> },
|
&construct<NiBlendTransformInterpolator, RC_NiBlendTransformInterpolator> },
|
||||||
|
{ "bhkCompressedMeshShape", &construct<bhkCompressedMeshShape, RC_bhkCompressedMeshShape> },
|
||||||
|
{ "bhkCompressedMeshShapeData", &construct<bhkCompressedMeshShapeData, RC_bhkCompressedMeshShapeData> },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,46 @@ namespace Nif
|
|||||||
mNormal = nif->getVector3();
|
mNormal = nif->getVector3();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bhkMeshMaterial::read(NIFStream* nif)
|
||||||
|
{
|
||||||
|
mHavokMaterial.read(nif);
|
||||||
|
mHavokFilter.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bhkQsTransform::read(NIFStream* nif)
|
||||||
|
{
|
||||||
|
mTranslation = nif->getVector4();
|
||||||
|
mRotation = nif->getQuaternion();
|
||||||
|
}
|
||||||
|
|
||||||
|
void bhkCMSBigTri::read(NIFStream* nif)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
mTriangle[i] = nif->getUShort();
|
||||||
|
mMaterial = nif->getUInt();
|
||||||
|
mWeldingInfo = nif->getUShort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void bhkCMSChunk::read(NIFStream* nif)
|
||||||
|
{
|
||||||
|
mTranslation = nif->getVector4();
|
||||||
|
mMaterialIndex = nif->getUInt();
|
||||||
|
mReference = nif->getUShort();
|
||||||
|
mTransformIndex = nif->getUShort();
|
||||||
|
size_t numVertices = nif->getUInt();
|
||||||
|
if (numVertices)
|
||||||
|
nif->getUShorts(mVertices, numVertices);
|
||||||
|
size_t numIndices = nif->getUInt();
|
||||||
|
if (numIndices)
|
||||||
|
nif->getUShorts(mIndices, numIndices);
|
||||||
|
size_t numStrips = nif->getUInt();
|
||||||
|
if (numStrips)
|
||||||
|
nif->getUShorts(mStrips, numStrips);
|
||||||
|
size_t numInfos = nif->getUInt();
|
||||||
|
if (numInfos)
|
||||||
|
nif->getUShorts(mWeldingInfos, numInfos);
|
||||||
|
}
|
||||||
|
|
||||||
void bhkRigidBodyCInfo::read(NIFStream* nif)
|
void bhkRigidBodyCInfo::read(NIFStream* nif)
|
||||||
{
|
{
|
||||||
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
|
if (nif->getVersion() >= NIFStream::generateVersion(10, 1, 0, 0))
|
||||||
@ -327,6 +367,68 @@ namespace Nif
|
|||||||
filter.read(nif);
|
filter.read(nif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bhkCompressedMeshShape::read(NIFStream* nif)
|
||||||
|
{
|
||||||
|
mTarget.read(nif);
|
||||||
|
mUserData = nif->getUInt();
|
||||||
|
mRadius = nif->getFloat();
|
||||||
|
nif->getFloat(); // Unknown
|
||||||
|
mScale = nif->getVector4();
|
||||||
|
nif->getFloat(); // Radius
|
||||||
|
nif->getVector4(); // Scale
|
||||||
|
mData.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bhkCompressedMeshShape::post(Reader& nif)
|
||||||
|
{
|
||||||
|
mTarget.post(nif);
|
||||||
|
mData.post(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bhkCompressedMeshShapeData::read(NIFStream* nif)
|
||||||
|
{
|
||||||
|
mBitsPerIndex = nif->getUInt();
|
||||||
|
mBitsPerWIndex = nif->getUInt();
|
||||||
|
mMaskWIndex = nif->getUInt();
|
||||||
|
mMaskIndex = nif->getUInt();
|
||||||
|
mError = nif->getFloat();
|
||||||
|
mAabbMin = nif->getVector4();
|
||||||
|
mAabbMax = nif->getVector4();
|
||||||
|
mWeldingType = nif->getChar();
|
||||||
|
mMaterialType = nif->getChar();
|
||||||
|
nif->skip(nif->getUInt() * 4); // Unused
|
||||||
|
nif->skip(nif->getUInt() * 4); // Unused
|
||||||
|
nif->skip(nif->getUInt() * 4); // Unused
|
||||||
|
|
||||||
|
size_t numMaterials = nif->getUInt();
|
||||||
|
mMaterials.resize(numMaterials);
|
||||||
|
for (bhkMeshMaterial& material : mMaterials)
|
||||||
|
material.read(nif);
|
||||||
|
|
||||||
|
nif->getUInt(); // Unused
|
||||||
|
size_t numTransforms = nif->getUInt();
|
||||||
|
|
||||||
|
mChunkTransforms.resize(numTransforms);
|
||||||
|
for (bhkQsTransform& transform : mChunkTransforms)
|
||||||
|
transform.read(nif);
|
||||||
|
|
||||||
|
size_t numBigVertices = nif->getUInt();
|
||||||
|
if (numBigVertices)
|
||||||
|
nif->getVector4s(mBigVerts, numBigVertices);
|
||||||
|
|
||||||
|
size_t numBigTriangles = nif->getUInt();
|
||||||
|
mBigTris.resize(numBigTriangles);
|
||||||
|
for (bhkCMSBigTri& tri : mBigTris)
|
||||||
|
tri.read(nif);
|
||||||
|
|
||||||
|
size_t numChunks = nif->getUInt();
|
||||||
|
mChunks.resize(numChunks);
|
||||||
|
for (bhkCMSChunk& chunk : mChunks)
|
||||||
|
chunk.read(nif);
|
||||||
|
|
||||||
|
nif->getUInt(); // Unused
|
||||||
|
}
|
||||||
|
|
||||||
void bhkRigidBody::read(NIFStream* nif)
|
void bhkRigidBody::read(NIFStream* nif)
|
||||||
{
|
{
|
||||||
bhkEntity::read(nif);
|
bhkEntity::read(nif);
|
||||||
|
@ -96,6 +96,41 @@ namespace Nif
|
|||||||
void read(NIFStream* nif);
|
void read(NIFStream* nif);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct bhkMeshMaterial
|
||||||
|
{
|
||||||
|
HavokMaterial mHavokMaterial;
|
||||||
|
HavokFilter mHavokFilter;
|
||||||
|
void read(NIFStream* nif);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bhkQsTransform
|
||||||
|
{
|
||||||
|
osg::Vec4f mTranslation;
|
||||||
|
osg::Quat mRotation;
|
||||||
|
void read(NIFStream* nif);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bhkCMSBigTri
|
||||||
|
{
|
||||||
|
unsigned short mTriangle[3];
|
||||||
|
unsigned int mMaterial;
|
||||||
|
unsigned short mWeldingInfo;
|
||||||
|
void read(NIFStream* nif);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bhkCMSChunk
|
||||||
|
{
|
||||||
|
osg::Vec4f mTranslation;
|
||||||
|
unsigned int mMaterialIndex;
|
||||||
|
unsigned short mReference;
|
||||||
|
unsigned short mTransformIndex;
|
||||||
|
std::vector<unsigned short> mVertices;
|
||||||
|
std::vector<unsigned short> mIndices;
|
||||||
|
std::vector<unsigned short> mStrips;
|
||||||
|
std::vector<unsigned short> mWeldingInfos;
|
||||||
|
void read(NIFStream* nif);
|
||||||
|
};
|
||||||
|
|
||||||
enum class hkMotionType : uint8_t
|
enum class hkMotionType : uint8_t
|
||||||
{
|
{
|
||||||
Motion_Invalid = 0,
|
Motion_Invalid = 0,
|
||||||
@ -354,6 +389,34 @@ namespace Nif
|
|||||||
void read(NIFStream* nif) override;
|
void read(NIFStream* nif) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct bhkCompressedMeshShape : public bhkShape
|
||||||
|
{
|
||||||
|
NodePtr mTarget;
|
||||||
|
unsigned int mUserData;
|
||||||
|
float mRadius;
|
||||||
|
osg::Vec4f mScale;
|
||||||
|
bhkCompressedMeshShapeDataPtr mData;
|
||||||
|
void read(NIFStream* nif) override;
|
||||||
|
void post(Reader& nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct bhkCompressedMeshShapeData : public bhkRefObject
|
||||||
|
{
|
||||||
|
unsigned int mBitsPerIndex, mBitsPerWIndex;
|
||||||
|
unsigned int mMaskWIndex, mMaskIndex;
|
||||||
|
float mError;
|
||||||
|
osg::Vec4f mAabbMin, mAabbMax;
|
||||||
|
char mWeldingType;
|
||||||
|
char mMaterialType;
|
||||||
|
std::vector<bhkMeshMaterial> mMaterials;
|
||||||
|
std::vector<bhkQsTransform> mChunkTransforms;
|
||||||
|
std::vector<osg::Vec4f> mBigVerts;
|
||||||
|
std::vector<bhkCMSBigTri> mBigTris;
|
||||||
|
std::vector<bhkCMSChunk> mChunks;
|
||||||
|
|
||||||
|
void read(NIFStream* nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
struct bhkRigidBody : public bhkEntity
|
struct bhkRigidBody : public bhkEntity
|
||||||
{
|
{
|
||||||
bhkRigidBodyCInfo mInfo;
|
bhkRigidBodyCInfo mInfo;
|
||||||
|
@ -157,6 +157,8 @@ namespace Nif
|
|||||||
RC_NiBlendFloatInterpolator,
|
RC_NiBlendFloatInterpolator,
|
||||||
RC_NiBlendPoint3Interpolator,
|
RC_NiBlendPoint3Interpolator,
|
||||||
RC_NiBlendTransformInterpolator,
|
RC_NiBlendTransformInterpolator,
|
||||||
|
RC_bhkCompressedMeshShape,
|
||||||
|
RC_bhkCompressedMeshShapeData,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Base class for all records
|
/// Base class for all records
|
||||||
|
@ -145,6 +145,7 @@ namespace Nif
|
|||||||
struct NiBlendInterpolator;
|
struct NiBlendInterpolator;
|
||||||
struct NiDefaultAVObjectPalette;
|
struct NiDefaultAVObjectPalette;
|
||||||
struct NiControllerSequence;
|
struct NiControllerSequence;
|
||||||
|
struct bhkCompressedMeshShapeData;
|
||||||
|
|
||||||
using NodePtr = RecordPtrT<Node>;
|
using NodePtr = RecordPtrT<Node>;
|
||||||
using ExtraPtr = RecordPtrT<Extra>;
|
using ExtraPtr = RecordPtrT<Extra>;
|
||||||
@ -179,6 +180,7 @@ namespace Nif
|
|||||||
using NiControllerManagerPtr = RecordPtrT<NiControllerManager>;
|
using NiControllerManagerPtr = RecordPtrT<NiControllerManager>;
|
||||||
using NiBlendInterpolatorPtr = RecordPtrT<NiBlendInterpolator>;
|
using NiBlendInterpolatorPtr = RecordPtrT<NiBlendInterpolator>;
|
||||||
using NiDefaultAVObjectPalettePtr = RecordPtrT<NiDefaultAVObjectPalette>;
|
using NiDefaultAVObjectPalettePtr = RecordPtrT<NiDefaultAVObjectPalette>;
|
||||||
|
using bhkCompressedMeshShapeDataPtr = RecordPtrT<bhkCompressedMeshShapeData>;
|
||||||
|
|
||||||
using NodeList = RecordListT<Node>;
|
using NodeList = RecordListT<Node>;
|
||||||
using PropertyList = RecordListT<Property>;
|
using PropertyList = RecordListT<Property>;
|
||||||
|
Loading…
Reference in New Issue
Block a user