mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-28 02:36:49 +00:00
Load bhkConvexVerticesShape, bhkBoxShape, bhkListShape
This commit is contained in:
parent
83aa96e38f
commit
c01fff280a
4 changed files with 93 additions and 1 deletions
|
@ -147,6 +147,9 @@ static std::map<std::string,RecordFactoryEntry> makeFactory()
|
||||||
factory["bhkNiTriStripsShape"] = {&construct <bhkNiTriStripsShape> , RC_bhkNiTriStripsShape };
|
factory["bhkNiTriStripsShape"] = {&construct <bhkNiTriStripsShape> , RC_bhkNiTriStripsShape };
|
||||||
factory["bhkPackedNiTriStripsShape"] = {&construct <bhkPackedNiTriStripsShape> , RC_bhkPackedNiTriStripsShape };
|
factory["bhkPackedNiTriStripsShape"] = {&construct <bhkPackedNiTriStripsShape> , RC_bhkPackedNiTriStripsShape };
|
||||||
factory["hkPackedNiTriStripsData"] = {&construct <hkPackedNiTriStripsData> , RC_hkPackedNiTriStripsData };
|
factory["hkPackedNiTriStripsData"] = {&construct <hkPackedNiTriStripsData> , RC_hkPackedNiTriStripsData };
|
||||||
|
factory["bhkConvexVerticesShape"] = {&construct <bhkConvexVerticesShape> , RC_bhkConvexVerticesShape };
|
||||||
|
factory["bhkBoxShape"] = {&construct <bhkBoxShape> , RC_bhkBoxShape };
|
||||||
|
factory["bhkListShape"] = {&construct <bhkListShape> , RC_bhkListShape };
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,4 +179,48 @@ namespace Nif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bhkSphereRepShape::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
mHavokMaterial.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bhkConvexShape::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
bhkSphereRepShape::read(nif);
|
||||||
|
mRadius = nif->getFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
void bhkConvexVerticesShape::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
bhkConvexShape::read(nif);
|
||||||
|
mVerticesProperty.read(nif);
|
||||||
|
mNormalsProperty.read(nif);
|
||||||
|
unsigned int numVertices = nif->getUInt();
|
||||||
|
if (numVertices)
|
||||||
|
nif->getVector4s(mVertices, numVertices);
|
||||||
|
unsigned int numNormals = nif->getUInt();
|
||||||
|
if (numNormals)
|
||||||
|
nif->getVector4s(mNormals, numNormals);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bhkBoxShape::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
bhkConvexShape::read(nif);
|
||||||
|
nif->skip(8); // Unused
|
||||||
|
mExtents = nif->getVector3();
|
||||||
|
nif->skip(4); // Unused
|
||||||
|
}
|
||||||
|
|
||||||
|
void bhkListShape::read(NIFStream *nif)
|
||||||
|
{
|
||||||
|
mSubshapes.read(nif);
|
||||||
|
mHavokMaterial.read(nif);
|
||||||
|
mChildShapeProperty.read(nif);
|
||||||
|
mChildFilterProperty.read(nif);
|
||||||
|
unsigned int numFilters = nif->getUInt();
|
||||||
|
mHavokFilters.resize(numFilters);
|
||||||
|
for (HavokFilter& filter : mHavokFilters)
|
||||||
|
filter.read(nif);
|
||||||
|
}
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
|
@ -198,5 +198,47 @@ struct hkPackedNiTriStripsData : public bhkShapeCollection
|
||||||
void read(NIFStream *nif) override;
|
void read(NIFStream *nif) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Abstract
|
||||||
|
struct bhkSphereRepShape : public bhkShape
|
||||||
|
{
|
||||||
|
HavokMaterial mHavokMaterial;
|
||||||
|
void read(NIFStream *nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Abstract
|
||||||
|
struct bhkConvexShape : public bhkSphereRepShape
|
||||||
|
{
|
||||||
|
float mRadius;
|
||||||
|
void read(NIFStream} *nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
// A convex shape built from vertices
|
||||||
|
struct bhkConvexVerticesShape : public bhkConvexShape
|
||||||
|
{
|
||||||
|
bhkWorldObjCInfoProperty mVerticesProperty;
|
||||||
|
bhkWorldObjCInfoProperty mNormalsProperty;
|
||||||
|
std::vector<osg::Vec4f> mVertices;
|
||||||
|
std::vector<osg::Vec4f> mNormals;
|
||||||
|
void read(NIFStream *nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
// A box
|
||||||
|
struct bhkBoxShape : public bhkConvexShape
|
||||||
|
{
|
||||||
|
osg::Vec3f mExtents;
|
||||||
|
void read(NIFStream *nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
// A list of shapes
|
||||||
|
struct bhkListShape : public bhkShapeCollection
|
||||||
|
{
|
||||||
|
bhkShapeList mSubshapes;
|
||||||
|
HavokMaterial mHavokMaterial;
|
||||||
|
bhkWorldObjCInfoProperty mChildShapeProperty;
|
||||||
|
bhkWorldObjCInfoProperty mChildFilterProperty;
|
||||||
|
std::vector<HavokFilter> mHavokFilters;
|
||||||
|
void read(NIFStream *nif) override;
|
||||||
|
};
|
||||||
|
|
||||||
} // Namespace
|
} // Namespace
|
||||||
#endif
|
#endif
|
|
@ -134,7 +134,10 @@ enum RecordType
|
||||||
RC_bhkMoppBvTreeShape,
|
RC_bhkMoppBvTreeShape,
|
||||||
RC_bhkNiTriStripsShape,
|
RC_bhkNiTriStripsShape,
|
||||||
RC_bhkPackedNiTriStripsShape,
|
RC_bhkPackedNiTriStripsShape,
|
||||||
RC_hkPackedNiTriStripsData
|
RC_hkPackedNiTriStripsData,
|
||||||
|
RC_bhkConvexVerticesShape,
|
||||||
|
RC_bhkBoxShape,
|
||||||
|
RC_bhkListShape
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Base class for all records
|
/// Base class for all records
|
||||||
|
|
Loading…
Reference in a new issue