1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 07:45:39 +00:00

Read bhkMeshShape

This commit is contained in:
Alexei Kotov 2023-09-25 14:00:44 +03:00
parent a722518b4b
commit e22654baa7
4 changed files with 32 additions and 0 deletions

View file

@ -423,6 +423,7 @@ namespace Nif
{ "bhkConvexVerticesShape", &construct<bhkConvexVerticesShape, RC_bhkConvexVerticesShape> },
{ "bhkListShape", &construct<bhkListShape, RC_bhkListShape> },
{ "bhkMoppBvTreeShape", &construct<bhkMoppBvTreeShape, RC_bhkMoppBvTreeShape> },
{ "bhkMeshShape", &construct<bhkMeshShape, RC_bhkMeshShape> },
{ "bhkMultiSphereShape", &construct<bhkMultiSphereShape, RC_bhkMultiSphereShape> },
{ "bhkNiTriStripsShape", &construct<bhkNiTriStripsShape, RC_bhkNiTriStripsShape> },
{ "bhkPackedNiTriStripsShape", &construct<bhkPackedNiTriStripsShape, RC_bhkPackedNiTriStripsShape> },

View file

@ -731,6 +731,24 @@ namespace Nif
nif->read(mCenter);
}
void bhkMeshShape::read(NIFStream* nif)
{
nif->skip(8); // Unknown
nif->read(mRadius);
nif->skip(8); // Unknown
nif->read(mScale);
mShapeProperties.resize(nif->get<uint32_t>());
for (bhkWorldObjCInfoProperty& property : mShapeProperties)
property.read(nif);
nif->skip(12); // Unknown
readRecordList(nif, mDataList);
}
void bhkMeshShape::post(Reader& nif)
{
postRecordList(nif, mDataList);
}
void bhkMultiSphereShape::read(NIFStream* nif)
{
bhkSphereRepShape::read(nif);

View file

@ -695,6 +695,18 @@ namespace Nif
void read(NIFStream* nif) override;
};
/// A shape based on triangle strips
struct bhkMeshShape : bhkShape
{
float mRadius;
osg::Vec4f mScale;
std::vector<bhkWorldObjCInfoProperty> mShapeProperties;
NiTriStripsDataList mDataList;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
// A sphere
using bhkSphereShape = bhkConvexShape;

View file

@ -55,6 +55,7 @@ namespace Nif
RC_bhkLimitedHingeConstraint,
RC_bhkListShape,
RC_bhkMalleableConstraint,
RC_bhkMeshShape,
RC_bhkMoppBvTreeShape,
RC_bhkMultiSphereShape,
RC_bhkNiTriStripsShape,