Load bhkMoppBvTreeShape

android-ndk22
Alexei Dobrohotov 3 years ago
parent 59ce00f742
commit e7cc76bba2

@ -143,6 +143,7 @@ static std::map<std::string,RecordFactoryEntry> makeFactory()
factory["bhkCollisionObject"] = {&construct <bhkCollisionObject> , RC_bhkCollisionObject };
factory["BSDismemberSkinInstance"] = {&construct <BSDismemberSkinInstance> , RC_BSDismemberSkinInstance };
factory["NiControllerManager"] = {&construct <NiControllerManager> , RC_NiControllerManager };
factory["bhkMoppBvTreeShape"] = {&construct <bhkMoppBvTreeShape> , RC_bhkMoppBvTreeShape };
return factory;
}

@ -42,6 +42,17 @@ namespace Nif
mHavokMaterial.read(nif);
}
void hkpMoppCode::read(NIFStream *nif)
{
unsigned int size = nif->getUInt();
if (nif->getVersion() >= NIFStream::generateVersion(10,1,0,0))
mOffset = nif->getVector4();
if (nif->getBethVersion() > NIFFile::BethVersion::BETHVER_FO3)
nif->getChar(); // MOPP data build type
if (size)
nif->getChars(mData, size);
}
void bhkEntityCInfo::read(NIFStream *nif)
{
mResponseType = static_cast<hkResponseType>(nif->getChar());
@ -78,4 +89,22 @@ namespace Nif
mInfo.read(nif);
}
void bhkBvTreeShape::read(NIFStream *nif)
{
mShape.read(nif);
}
void bhkBvTreeShape::post(NIFFile *nif)
{
mShape.post(nif);
}
void bhkMoppBvTreeShape::read(NIFStream *nif)
{
bhkBvTreeShape::read(nif);
nif->skip(12); // Unused
mScale = nif->getFloat();
mMopp.read(nif);
}
} // Namespace

@ -70,6 +70,13 @@ struct bhkEntityCInfo
void read(NIFStream *nif);
}
struct hkpMoppCode
{
osg::Vec4f mOffset;
std::vector<char> mData;
void read(NIFStream *nif);
};
/// Record types
// Abstract Bethesda Havok object
@ -131,5 +138,22 @@ struct bhkEntity : public bhkWorldObject
void read(NIFStream *nif) override;
};
// Bethesda extension of hkpBvTreeShape
// hkpBvTreeShape adds a bounding volume tree to an hkpShapeCollection
struct bhkBvTreeShape : public bhkShape
{
bhkShapePtr mShape;
void read(NIFStream *nif) override;
void post(NIFFile *nif) override;
};
// bhkBvTreeShape with Havok MOPP code
struct bhkMoppBvTreeShape : public bhkBvTreeShape
{
float mScale;
hkpMoppCode mMopp;
void read(NIFStream *nif) override;
};
} // Namespace
#endif

@ -130,7 +130,8 @@ enum RecordType
RC_NiCollisionObject,
RC_bhkCollisionObject,
RC_BSDismemberSkinInstance,
RC_NiControllerManager
RC_NiControllerManager,
RC_bhkMoppBvTreeShape
};
/// Base class for all records

Loading…
Cancel
Save