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

Read NiBSplineData/NiBSplineBasisData

This commit is contained in:
Alexei Kotov 2024-05-12 23:44:23 +03:00
parent f595015ffc
commit 5c6fca14c1
7 changed files with 60 additions and 0 deletions

View file

@ -793,4 +793,18 @@ namespace Nif
mInterpolator.post(nif); mInterpolator.post(nif);
} }
void NiBSplineInterpolator::read(NIFStream* nif)
{
nif->read(mStartTime);
nif->read(mStopTime);
mSplineData.read(nif);
mBasisData.read(nif);
}
void NiBSplineInterpolator::post(Reader& nif)
{
mSplineData.post(nif);
mBasisData.post(nif);
}
} }

View file

@ -548,5 +548,17 @@ namespace Nif
using NiBlendPoint3Interpolator = TypedNiBlendInterpolator<osg::Vec3f>; using NiBlendPoint3Interpolator = TypedNiBlendInterpolator<osg::Vec3f>;
using NiBlendTransformInterpolator = TypedNiBlendInterpolator<NiQuatTransform>; using NiBlendTransformInterpolator = TypedNiBlendInterpolator<NiQuatTransform>;
// Abstract
struct NiBSplineInterpolator : public NiInterpolator
{
float mStartTime;
float mStopTime;
NiBSplineDataPtr mSplineData;
NiBSplineBasisDataPtr mBasisData;
void read(NIFStream* nif) override;
void post(Reader& nif) override;
};
} }
#endif #endif

View file

@ -537,6 +537,17 @@ namespace Nif
mKeyList->read(nif); mKeyList->read(nif);
} }
void NiBSplineData::read(NIFStream* nif)
{
nif->readVector(mFloatControlPoints, nif->get<uint32_t>());
nif->readVector(mCompactControlPoints, nif->get<uint32_t>());
}
void NiBSplineBasisData::read(NIFStream* nif)
{
nif->read(mNumControlPoints);
}
void NiAdditionalGeometryData::read(NIFStream* nif) void NiAdditionalGeometryData::read(NIFStream* nif)
{ {
nif->read(mNumVertices); nif->read(mNumVertices);

View file

@ -362,6 +362,21 @@ namespace Nif
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };
struct NiBSplineData : public Record
{
std::vector<float> mFloatControlPoints;
std::vector<int16_t> mCompactControlPoints;
void read(NIFStream* nif) override;
};
struct NiBSplineBasisData : public Record
{
uint32_t mNumControlPoints;
void read(NIFStream* nif) override;
};
struct NiAdditionalGeometryData : public Record struct NiAdditionalGeometryData : public Record
{ {
struct DataStream struct DataStream

View file

@ -195,6 +195,8 @@ namespace Nif
// Gamebryo // Gamebryo
{ "NiAdditionalGeometryData", &construct<NiAdditionalGeometryData, RC_NiAdditionalGeometryData> }, { "NiAdditionalGeometryData", &construct<NiAdditionalGeometryData, RC_NiAdditionalGeometryData> },
{ "NiBoolData", &construct<NiBoolData, RC_NiBoolData> }, { "NiBoolData", &construct<NiBoolData, RC_NiBoolData> },
{ "NiBSplineData", &construct<NiBSplineData, RC_NiBSplineData> },
{ "NiBSplineBasisData", &construct<NiBSplineBasisData, RC_NiBSplineBasisData> },
{ "NiDefaultAVObjectPalette", &construct<NiDefaultAVObjectPalette, RC_NiDefaultAVObjectPalette> }, { "NiDefaultAVObjectPalette", &construct<NiDefaultAVObjectPalette, RC_NiDefaultAVObjectPalette> },
{ "NiTransformData", &construct<NiKeyframeData, RC_NiKeyframeData> }, { "NiTransformData", &construct<NiKeyframeData, RC_NiKeyframeData> },

View file

@ -162,6 +162,8 @@ namespace Nif
RC_NiBSAnimationNode, RC_NiBSAnimationNode,
RC_NiBSPArrayController, RC_NiBSPArrayController,
RC_NiBSParticleNode, RC_NiBSParticleNode,
RC_NiBSplineData,
RC_NiBSplineBasisData,
RC_NiCamera, RC_NiCamera,
RC_NiClusterAccumulator, RC_NiClusterAccumulator,
RC_NiCollisionObject, RC_NiCollisionObject,

View file

@ -137,6 +137,8 @@ namespace Nif
struct NiPSysModifier; struct NiPSysModifier;
struct NiPSysSpawnModifier; struct NiPSysSpawnModifier;
struct NiBoolData; struct NiBoolData;
struct NiBSplineData;
struct NiBSplineBasisData;
struct NiSkinPartition; struct NiSkinPartition;
struct BSShaderTextureSet; struct BSShaderTextureSet;
struct NiTriBasedGeom; struct NiTriBasedGeom;
@ -189,6 +191,8 @@ namespace Nif
using NiPSysModifierPtr = RecordPtrT<NiPSysModifier>; using NiPSysModifierPtr = RecordPtrT<NiPSysModifier>;
using NiPSysSpawnModifierPtr = RecordPtrT<NiPSysSpawnModifier>; using NiPSysSpawnModifierPtr = RecordPtrT<NiPSysSpawnModifier>;
using NiBoolDataPtr = RecordPtrT<NiBoolData>; using NiBoolDataPtr = RecordPtrT<NiBoolData>;
using NiBSplineDataPtr = RecordPtrT<NiBSplineData>;
using NiBSplineBasisDataPtr = RecordPtrT<NiBSplineBasisData>;
using NiSkinPartitionPtr = RecordPtrT<NiSkinPartition>; using NiSkinPartitionPtr = RecordPtrT<NiSkinPartition>;
using BSShaderTextureSetPtr = RecordPtrT<BSShaderTextureSet>; using BSShaderTextureSetPtr = RecordPtrT<BSShaderTextureSet>;
using NiTriBasedGeomPtr = RecordPtrT<NiTriBasedGeom>; using NiTriBasedGeomPtr = RecordPtrT<NiTriBasedGeom>;