1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:29:55 +00:00

Read BSPackedCombinedSharedGeomDataExtra

This commit is contained in:
Alexei Kotov 2023-10-20 17:39:58 +03:00
parent 23eb6289b3
commit 8ce9f7b9cf
4 changed files with 96 additions and 0 deletions

View file

@ -162,4 +162,50 @@ namespace Nif
nif->getSizedStrings(mPointNames, nif->get<uint32_t>()); nif->getSizedStrings(mPointNames, nif->get<uint32_t>());
} }
void BSPackedGeomDataCombined::read(NIFStream* nif)
{
nif->read(mGrayscaleToPaletteScale);
nif->read(mTransform);
nif->read(mBoundingSphere);
}
void BSPackedGeomObject::read(NIFStream* nif)
{
nif->read(mFileHash);
nif->read(mDataOffset);
}
void BSPackedSharedGeomData::read(NIFStream* nif)
{
nif->read(mNumVertices);
nif->read(mLODLevels);
nif->read(mLOD0TriCount);
nif->read(mLOD0TriOffset);
nif->read(mLOD1TriCount);
nif->read(mLOD1TriOffset);
nif->read(mLOD2TriCount);
nif->read(mLOD2TriOffset);
mCombined.resize(nif->get<uint32_t>());
for (BSPackedGeomDataCombined& data : mCombined)
data.read(nif);
mVertexDesc.read(nif);
}
void BSPackedCombinedSharedGeomDataExtra::read(NIFStream* nif)
{
NiExtraData::read(nif);
mVertexDesc.read(nif);
nif->read(mNumVertices);
nif->read(mNumTriangles);
nif->read(mFlags1);
nif->read(mFlags2);
mObjects.resize(nif->get<uint32_t>());
for (BSPackedGeomObject& object : mObjects)
object.read(nif);
mObjectData.resize(mObjects.size());
for (BSPackedSharedGeomData& objectData : mObjectData)
objectData.read(nif);
}
} }

View file

@ -2,6 +2,7 @@
#define OPENMW_COMPONENTS_NIF_EXTRA_HPP #define OPENMW_COMPONENTS_NIF_EXTRA_HPP
#include "base.hpp" #include "base.hpp"
#include "node.hpp"
namespace Nif namespace Nif
{ {
@ -199,5 +200,51 @@ namespace Nif
}; };
}; };
struct BSPackedGeomDataCombined
{
float mGrayscaleToPaletteScale;
NiTransform mTransform;
osg::BoundingSpheref mBoundingSphere;
void read(NIFStream* nif);
};
struct BSPackedGeomObject
{
uint32_t mFileHash;
uint32_t mDataOffset;
void read(NIFStream* nif);
};
struct BSPackedSharedGeomData
{
uint32_t mNumVertices;
uint32_t mLODLevels;
uint32_t mLOD0TriCount;
uint32_t mLOD0TriOffset;
uint32_t mLOD1TriCount;
uint32_t mLOD1TriOffset;
uint32_t mLOD2TriCount;
uint32_t mLOD2TriOffset;
std::vector<BSPackedGeomDataCombined> mCombined;
BSVertexDesc mVertexDesc;
void read(NIFStream* nif);
};
struct BSPackedCombinedSharedGeomDataExtra : NiExtraData
{
BSVertexDesc mVertexDesc;
uint32_t mNumVertices;
uint32_t mNumTriangles;
uint32_t mFlags1;
uint32_t mFlags2;
std::vector<BSPackedGeomObject> mObjects;
std::vector<BSPackedSharedGeomData> mObjectData;
void read(NIFStream* nif) override;
};
} }
#endif #endif

View file

@ -256,6 +256,8 @@ namespace Nif
{ "BSDistantObjectLargeRefExtraData", { "BSDistantObjectLargeRefExtraData",
&construct<BSDistantObjectLargeRefExtraData, RC_BSDistantObjectLargeRefExtraData> }, &construct<BSDistantObjectLargeRefExtraData, RC_BSDistantObjectLargeRefExtraData> },
{ "BSEyeCenterExtraData", &construct<BSEyeCenterExtraData, RC_BSEyeCenterExtraData> }, { "BSEyeCenterExtraData", &construct<BSEyeCenterExtraData, RC_BSEyeCenterExtraData> },
{ "BSPackedCombinedSharedGeomDataExtra",
&construct<BSPackedCombinedSharedGeomDataExtra, RC_BSPackedCombinedSharedGeomDataExtra> },
{ "BSPositionData", &construct<BSPositionData, RC_BSPositionData> }, { "BSPositionData", &construct<BSPositionData, RC_BSPositionData> },
{ "BSWArray", &construct<BSWArray, RC_BSWArray> }, { "BSWArray", &construct<BSWArray, RC_BSWArray> },
{ "BSXFlags", &construct<NiIntegerExtraData, RC_BSXFlags> }, { "BSXFlags", &construct<NiIntegerExtraData, RC_BSXFlags> },

View file

@ -108,6 +108,7 @@ namespace Nif
RC_BSMultiBoundSphere, RC_BSMultiBoundSphere,
RC_BSNiAlphaPropertyTestRefController, RC_BSNiAlphaPropertyTestRefController,
RC_BSPackedAdditionalGeometryData, RC_BSPackedAdditionalGeometryData,
RC_BSPackedCombinedSharedGeomDataExtra,
RC_BSParentVelocityModifier, RC_BSParentVelocityModifier,
RC_BSPositionData, RC_BSPositionData,
RC_BSProceduralLightningController, RC_BSProceduralLightningController,