1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-22 12:39:59 +00:00

Read bhkPlaneShape and bhkMultiSphereShape

This commit is contained in:
Alexei Kotov 2023-09-23 15:42:10 +03:00
parent 7c11d9acbc
commit 6b28f07537
4 changed files with 55 additions and 0 deletions

View File

@ -421,9 +421,11 @@ namespace Nif
{ "bhkConvexVerticesShape", &construct<bhkConvexVerticesShape, RC_bhkConvexVerticesShape> },
{ "bhkListShape", &construct<bhkListShape, RC_bhkListShape> },
{ "bhkMoppBvTreeShape", &construct<bhkMoppBvTreeShape, RC_bhkMoppBvTreeShape> },
{ "bhkMultiSphereShape", &construct<bhkMultiSphereShape, RC_bhkMultiSphereShape> },
{ "bhkNiTriStripsShape", &construct<bhkNiTriStripsShape, RC_bhkNiTriStripsShape> },
{ "bhkPackedNiTriStripsShape", &construct<bhkPackedNiTriStripsShape, RC_bhkPackedNiTriStripsShape> },
{ "hkPackedNiTriStripsData", &construct<hkPackedNiTriStripsData, RC_hkPackedNiTriStripsData> },
{ "bhkPlaneShape", &construct<bhkPlaneShape, RC_bhkPlaneShape> },
{ "bhkSimpleShapePhantom", &construct<bhkSimpleShapePhantom, RC_bhkSimpleShapePhantom> },
{ "bhkSphereShape", &construct<bhkSphereShape, RC_bhkSphereShape> },
{ "bhkTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> },

View File

@ -716,6 +716,29 @@ namespace Nif
nif->skip(12); // Unused
}
void bhkHeightfieldShape::read(NIFStream* nif)
{
mHavokMaterial.read(nif);
}
void bhkPlaneShape::read(NIFStream* nif)
{
bhkHeightfieldShape::read(nif);
nif->skip(12); // Unused
mPlane = osg::Plane(nif->get<osg::Vec4f>());
nif->read(mExtents);
nif->read(mCenter);
}
void bhkMultiSphereShape::read(NIFStream* nif)
{
bhkSphereRepShape::read(nif);
mShapeProperty.read(nif);
nif->readVector(mSpheres, nif->get<uint32_t>());
}
void bhkListShape::read(NIFStream* nif)
{
readRecordList(nif, mSubshapes);

View File

@ -6,6 +6,7 @@
#include "recordptr.hpp"
#include <osg/Quat>
#include <osg/Plane>
#include <osg/Vec3f>
#include <osg/Vec4f>
@ -676,9 +677,36 @@ namespace Nif
void read(NIFStream* nif) override;
};
// Abstract shape that can collide with an array of spheres
struct bhkHeightfieldShape : bhkShape
{
HavokMaterial mHavokMaterial;
void read(NIFStream* nif) override;
};
// A plane bounded by an AABB
struct bhkPlaneShape : bhkHeightfieldShape
{
osg::Plane mPlane;
osg::Vec4f mExtents;
osg::Vec4f mCenter;
void read(NIFStream* nif) override;
};
// A sphere
using bhkSphereShape = bhkConvexShape;
// Multiple spheres
struct bhkMultiSphereShape : bhkSphereRepShape
{
bhkWorldObjCInfoProperty mShapeProperty;
std::vector<osg::BoundingSpheref> mSpheres;
void read(NIFStream* nif) override;
};
// A list of shapes
struct bhkListShape : public bhkShapeCollection
{

View File

@ -56,8 +56,10 @@ namespace Nif
RC_bhkListShape,
RC_bhkMalleableConstraint,
RC_bhkMoppBvTreeShape,
RC_bhkMultiSphereShape,
RC_bhkNiTriStripsShape,
RC_bhkPackedNiTriStripsShape,
RC_bhkPlaneShape,
RC_bhkPhysicsSystem,
RC_bhkPrismaticConstraint,
RC_bhkRagdollConstraint,