1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-28 16:41:34 +00:00

Merge branch 'convex' into 'master'

Read bhkConvexTransformShape and properly read 10.0.1.0 geometry

See merge request OpenMW/openmw!2696
This commit is contained in:
psi29a 2023-02-08 11:18:25 +00:00
commit b696359e01
5 changed files with 29 additions and 1 deletions

View file

@ -161,6 +161,7 @@ namespace Nif
{ "bhkPackedNiTriStripsShape", &construct<bhkPackedNiTriStripsShape, RC_bhkPackedNiTriStripsShape> },
{ "hkPackedNiTriStripsData", &construct<hkPackedNiTriStripsData, RC_hkPackedNiTriStripsData> },
{ "bhkConvexVerticesShape", &construct<bhkConvexVerticesShape, RC_bhkConvexVerticesShape> },
{ "bhkConvexTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> },
{ "bhkBoxShape", &construct<bhkBoxShape, RC_bhkBoxShape> },
{ "bhkCapsuleShape", &construct<bhkCapsuleShape, RC_bhkCapsuleShape> },
{ "bhkSphereShape", &construct<bhkSphereShape, RC_bhkSphereShape> },

View file

@ -144,7 +144,7 @@ namespace Nif
void NiGeometry::MaterialData::read(NIFStream* nif)
{
if (nif->getVersion() <= NIFStream::generateVersion(10, 0, 1, 0))
if (nif->getVersion() < NIFStream::generateVersion(10, 0, 1, 0))
return;
unsigned int num = 0;
if (nif->getVersion() <= NIFStream::generateVersion(20, 1, 0, 3))

View file

@ -281,6 +281,22 @@ namespace Nif
nif->getVector4s(mNormals, numNormals);
}
void bhkConvexTransformShape::read(NIFStream* nif)
{
mShape.read(nif);
mHavokMaterial.read(nif);
mRadius = nif->getFloat();
nif->skip(8); // Unused
std::vector<float> mat;
nif->getFloats(mat, 16);
mTransform.set(mat.data());
}
void bhkConvexTransformShape::post(Reader& nif)
{
mShape.post(nif);
}
void bhkBoxShape::read(NIFStream* nif)
{
bhkConvexShape::read(nif);

View file

@ -314,6 +314,16 @@ namespace Nif
void read(NIFStream* nif) override;
};
struct bhkConvexTransformShape : public bhkShape
{
bhkShapePtr mShape;
HavokMaterial mHavokMaterial;
float mRadius;
osg::Matrixf mTransform;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
// A box
struct bhkBoxShape : public bhkConvexShape
{

View file

@ -137,6 +137,7 @@ namespace Nif
RC_bhkPackedNiTriStripsShape,
RC_hkPackedNiTriStripsData,
RC_bhkConvexVerticesShape,
RC_bhkConvexTransformShape,
RC_bhkBoxShape,
RC_bhkCapsuleShape,
RC_bhkSphereShape,