mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 20:45:35 +00:00
Merge branch 'nifrecordstogodofnifrecords' into 'master'
Read more NIF records See merge request OpenMW/openmw!3439
This commit is contained in:
commit
ecc58c6011
15 changed files with 536 additions and 25 deletions
|
@ -486,6 +486,29 @@ namespace Nif
|
|||
nif->read(mControlledColor);
|
||||
}
|
||||
|
||||
void BSKeyframeController::read(NIFStream* nif)
|
||||
{
|
||||
NiKeyframeController::read(nif);
|
||||
|
||||
mData2.read(nif);
|
||||
}
|
||||
|
||||
void BSKeyframeController::post(Reader& nif)
|
||||
{
|
||||
NiKeyframeController::post(nif);
|
||||
|
||||
mData2.post(nif);
|
||||
}
|
||||
|
||||
void BSLagBoneController::read(NIFStream* nif)
|
||||
{
|
||||
NiTimeController::read(nif);
|
||||
|
||||
nif->read(mLinearVelocity);
|
||||
nif->read(mLinearRotation);
|
||||
nif->read(mMaximumDistance);
|
||||
}
|
||||
|
||||
void NiControllerManager::read(NIFStream* nif)
|
||||
{
|
||||
NiTimeController::read(nif);
|
||||
|
|
|
@ -319,6 +319,23 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct BSKeyframeController : NiKeyframeController
|
||||
{
|
||||
NiKeyframeDataPtr mData2;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
void post(Reader& nif) override;
|
||||
};
|
||||
|
||||
struct BSLagBoneController : NiTimeController
|
||||
{
|
||||
float mLinearVelocity;
|
||||
float mLinearRotation;
|
||||
float mMaximumDistance;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct NiControllerManager : public NiTimeController
|
||||
{
|
||||
bool mCumulative;
|
||||
|
|
|
@ -532,6 +532,44 @@ namespace Nif
|
|||
mKeyList->read(nif);
|
||||
}
|
||||
|
||||
void NiAdditionalGeometryData::read(NIFStream* nif)
|
||||
{
|
||||
nif->read(mNumVertices);
|
||||
mBlockInfos.resize(nif->get<uint32_t>());
|
||||
for (DataStream& info : mBlockInfos)
|
||||
info.read(nif);
|
||||
mBlocks.resize(nif->get<uint32_t>());
|
||||
for (DataBlock& block : mBlocks)
|
||||
block.read(nif, recType == RC_BSPackedAdditionalGeometryData);
|
||||
}
|
||||
|
||||
void NiAdditionalGeometryData::DataStream::read(NIFStream* nif)
|
||||
{
|
||||
nif->read(mType);
|
||||
nif->read(mUnitSize);
|
||||
nif->read(mTotalSize);
|
||||
nif->read(mStride);
|
||||
nif->read(mBlockIndex);
|
||||
nif->read(mBlockOffset);
|
||||
nif->read(mFlags);
|
||||
}
|
||||
|
||||
void NiAdditionalGeometryData::DataBlock::read(NIFStream* nif, bool bsPacked)
|
||||
{
|
||||
nif->read(mValid);
|
||||
if (!mValid)
|
||||
return;
|
||||
nif->read(mBlockSize);
|
||||
nif->readVector(mBlockOffsets, nif->get<uint32_t>());
|
||||
nif->readVector(mDataSizes, nif->get<uint32_t>());
|
||||
nif->readVector(mData, mDataSizes.size() * mBlockSize);
|
||||
if (bsPacked)
|
||||
{
|
||||
nif->read(mShaderIndex);
|
||||
nif->read(mTotalSize);
|
||||
}
|
||||
}
|
||||
|
||||
void BSMultiBound::read(NIFStream* nif)
|
||||
{
|
||||
mData.read(nif);
|
||||
|
@ -542,6 +580,12 @@ namespace Nif
|
|||
mData.post(nif);
|
||||
}
|
||||
|
||||
void BSMultiBoundAABB::read(NIFStream* nif)
|
||||
{
|
||||
nif->read(mPosition);
|
||||
nif->read(mExtents);
|
||||
}
|
||||
|
||||
void BSMultiBoundOBB::read(NIFStream* nif)
|
||||
{
|
||||
nif->read(mCenter);
|
||||
|
|
|
@ -362,6 +362,41 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct NiAdditionalGeometryData : public Record
|
||||
{
|
||||
struct DataStream
|
||||
{
|
||||
uint32_t mType;
|
||||
uint32_t mUnitSize;
|
||||
uint32_t mTotalSize;
|
||||
uint32_t mStride;
|
||||
uint32_t mBlockIndex;
|
||||
uint32_t mBlockOffset;
|
||||
uint8_t mFlags;
|
||||
|
||||
void read(NIFStream* nif);
|
||||
};
|
||||
|
||||
struct DataBlock
|
||||
{
|
||||
bool mValid;
|
||||
uint32_t mBlockSize;
|
||||
std::vector<uint32_t> mBlockOffsets;
|
||||
std::vector<uint32_t> mDataSizes;
|
||||
std::vector<char> mData;
|
||||
uint32_t mShaderIndex;
|
||||
uint32_t mTotalSize;
|
||||
|
||||
void read(NIFStream* nif, bool bsPacked);
|
||||
};
|
||||
|
||||
uint16_t mNumVertices;
|
||||
std::vector<DataStream> mBlockInfos;
|
||||
std::vector<DataBlock> mBlocks;
|
||||
|
||||
void read(NIFStream* nif);
|
||||
};
|
||||
|
||||
struct BSMultiBound : public Record
|
||||
{
|
||||
BSMultiBoundDataPtr mData;
|
||||
|
@ -375,6 +410,14 @@ namespace Nif
|
|||
{
|
||||
};
|
||||
|
||||
struct BSMultiBoundAABB : public BSMultiBoundData
|
||||
{
|
||||
osg::Vec3f mPosition;
|
||||
osg::Vec3f mExtents;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct BSMultiBoundOBB : public BSMultiBoundData
|
||||
{
|
||||
osg::Vec3f mCenter;
|
||||
|
|
|
@ -10,6 +10,13 @@ namespace Nif
|
|||
nif->readVector(mData, mRecordSize);
|
||||
}
|
||||
|
||||
void NiStringsExtraData::read(NIFStream* nif)
|
||||
{
|
||||
Extra::read(nif);
|
||||
|
||||
nif->getSizedStrings(mData, nif->get<uint32_t>());
|
||||
}
|
||||
|
||||
void NiTextKeyExtraData::read(NIFStream* nif)
|
||||
{
|
||||
Extra::read(nif);
|
||||
|
@ -94,4 +101,39 @@ namespace Nif
|
|||
nif->read(mControlsBaseSkeleton);
|
||||
}
|
||||
|
||||
void BSBoneLODExtraData::read(NIFStream* nif)
|
||||
{
|
||||
Extra::read(nif);
|
||||
|
||||
mData.resize(nif->get<uint32_t>());
|
||||
for (BoneLOD& lod : mData)
|
||||
lod.read(nif);
|
||||
}
|
||||
|
||||
void BSBoneLODExtraData::BoneLOD::read(NIFStream* nif)
|
||||
{
|
||||
nif->read(mDistance);
|
||||
nif->read(mBone);
|
||||
}
|
||||
|
||||
void BSDecalPlacementVectorExtraData::read(NIFStream* nif)
|
||||
{
|
||||
NiFloatExtraData::read(nif);
|
||||
|
||||
mBlocks.resize(nif->get<uint16_t>());
|
||||
for (Block& block : mBlocks)
|
||||
block.read(nif);
|
||||
}
|
||||
|
||||
void BSDecalPlacementVectorExtraData::Block::read(NIFStream* nif)
|
||||
{
|
||||
nif->readVector(mPoints, nif->get<uint16_t>());
|
||||
nif->readVector(mNormals, mPoints.size());
|
||||
}
|
||||
|
||||
void BSClothExtraData::read(NIFStream* nif)
|
||||
{
|
||||
nif->readVector(mData, nif->get<uint32_t>());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,10 +38,15 @@ namespace Nif
|
|||
using NiStringExtraData = TypedExtra<std::string>;
|
||||
using NiVectorExtraData = TypedExtra<osg::Vec4f>;
|
||||
|
||||
using BSDistantObjectExtraData = TypedExtra<uint32_t>;
|
||||
using BSDistantObjectLargeRefExtraData = TypedExtra<bool>;
|
||||
|
||||
using NiBinaryExtraData = TypedVectorExtra<uint8_t>;
|
||||
using NiFloatsExtraData = TypedVectorExtra<float>;
|
||||
using NiIntegersExtraData = TypedVectorExtra<uint32_t>;
|
||||
|
||||
using BSWArray = TypedVectorExtra<int32_t>;
|
||||
|
||||
// Distinct from NiBinaryExtraData, uses mRecordSize as its size
|
||||
struct NiExtraData : public Extra
|
||||
{
|
||||
|
@ -50,6 +55,14 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
// != TypedVectorExtra<std::string>, doesn't use the string table
|
||||
struct NiStringsExtraData : public Extra
|
||||
{
|
||||
std::vector<std::string> mData;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct NiVertWeightsExtraData : public Extra
|
||||
{
|
||||
void read(NIFStream* nif) override;
|
||||
|
@ -115,5 +128,47 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct BSBoneLODExtraData : public Extra
|
||||
{
|
||||
struct BoneLOD
|
||||
{
|
||||
uint32_t mDistance;
|
||||
std::string mBone;
|
||||
|
||||
void read(NIFStream* nif);
|
||||
};
|
||||
|
||||
std::vector<BoneLOD> mData;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct BSDecalPlacementVectorExtraData : public NiFloatExtraData
|
||||
{
|
||||
struct Block
|
||||
{
|
||||
std::vector<osg::Vec3f> mPoints;
|
||||
std::vector<osg::Vec3f> mNormals;
|
||||
|
||||
void read(NIFStream* nif);
|
||||
};
|
||||
|
||||
std::vector<Block> mBlocks;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct BSExtraData : NiExtraData
|
||||
{
|
||||
void read(NIFStream* nif) override {}
|
||||
};
|
||||
|
||||
struct BSClothExtraData : BSExtraData
|
||||
{
|
||||
std::vector<uint8_t> mData;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -116,6 +116,7 @@ namespace Nif
|
|||
|
||||
// Gamebryo
|
||||
{ "NiControllerManager", &construct<NiControllerManager, RC_NiControllerManager> },
|
||||
{ "NiLightDimmerController", &construct<NiFloatInterpController, RC_NiLightDimmerController> },
|
||||
{ "NiTransformController", &construct<NiKeyframeController, RC_NiKeyframeController> },
|
||||
{ "NiTextureTransformController",
|
||||
&construct<NiTextureTransformController, RC_NiTextureTransformController> },
|
||||
|
@ -123,8 +124,13 @@ namespace Nif
|
|||
&construct<NiMultiTargetTransformController, RC_NiMultiTargetTransformController> },
|
||||
|
||||
// Bethesda
|
||||
{ "BSFrustumFOVController", &construct<NiFloatInterpController, RC_BSFrustumFOVController> },
|
||||
{ "BSKeyframeController", &construct<BSKeyframeController, RC_BSKeyframeController> },
|
||||
{ "BSLagBoneController", &construct<BSLagBoneController, RC_BSLagBoneController> },
|
||||
{ "BSMaterialEmittanceMultController",
|
||||
&construct<NiFloatInterpController, RC_BSMaterialEmittanceMultController> },
|
||||
{ "BSNiAlphaPropertyTestRefController",
|
||||
&construct<NiFloatInterpController, RC_BSNiAlphaPropertyTestRefController> },
|
||||
{ "BSRefractionFirePeriodController",
|
||||
&construct<NiSingleInterpController, RC_BSRefractionFirePeriodController> },
|
||||
{ "BSRefractionStrengthController",
|
||||
|
@ -167,11 +173,14 @@ namespace Nif
|
|||
{ "NiVisData", &construct<NiVisData, RC_NiVisData> },
|
||||
|
||||
// Gamebryo
|
||||
{ "NiAdditionalGeometryData", &construct<NiAdditionalGeometryData, RC_NiAdditionalGeometryData> },
|
||||
{ "NiBoolData", &construct<NiBoolData, RC_NiBoolData> },
|
||||
{ "NiDefaultAVObjectPalette", &construct<NiDefaultAVObjectPalette, RC_NiDefaultAVObjectPalette> },
|
||||
{ "NiTransformData", &construct<NiKeyframeData, RC_NiKeyframeData> },
|
||||
|
||||
// Bethesda
|
||||
{ "BSPackedAdditionalGeometryData",
|
||||
&construct<NiAdditionalGeometryData, RC_BSPackedAdditionalGeometryData> },
|
||||
{ "BSShaderTextureSet", &construct<BSShaderTextureSet, RC_BSShaderTextureSet> },
|
||||
|
||||
// DYNAMIC EFFECTS
|
||||
|
@ -200,11 +209,13 @@ namespace Nif
|
|||
{ "NiIntegerExtraData", &construct<NiIntegerExtraData, RC_NiIntegerExtraData> },
|
||||
{ "NiIntegersExtraData", &construct<NiIntegersExtraData, RC_NiIntegersExtraData> },
|
||||
{ "NiVectorExtraData", &construct<NiVectorExtraData, RC_NiVectorExtraData> },
|
||||
{ "NiStringsExtraData", &construct<NiStringsExtraData, RC_NiStringsExtraData> },
|
||||
{ "NiStringPalette", &construct<NiStringPalette, RC_NiStringPalette> },
|
||||
|
||||
// Bethesda bounds
|
||||
{ "BSBound", &construct<BSBound, RC_BSBound> },
|
||||
{ "BSMultiBound", &construct<BSMultiBound, RC_BSMultiBound> },
|
||||
{ "BSMultiBoundAABB", &construct<BSMultiBoundAABB, RC_BSMultiBoundAABB> },
|
||||
{ "BSMultiBoundOBB", &construct<BSMultiBoundOBB, RC_BSMultiBoundOBB> },
|
||||
{ "BSMultiBoundSphere", &construct<BSMultiBoundSphere, RC_BSMultiBoundSphere> },
|
||||
|
||||
|
@ -214,7 +225,16 @@ namespace Nif
|
|||
{ "BSInvMarker", &construct<BSInvMarker, RC_BSInvMarker> },
|
||||
|
||||
// Other Bethesda records
|
||||
{ "BSExtraData", &construct<BSExtraData, RC_BSExtraData> },
|
||||
{ "BSBehaviorGraphExtraData", &construct<BSBehaviorGraphExtraData, RC_BSBehaviorGraphExtraData> },
|
||||
{ "BSBoneLODExtraData", &construct<BSBoneLODExtraData, RC_BSBoneLODExtraData> },
|
||||
{ "BSClothExtraData", &construct<BSClothExtraData, RC_BSClothExtraData> },
|
||||
{ "BSDecalPlacementVectorExtraData",
|
||||
&construct<BSDecalPlacementVectorExtraData, RC_BSDecalPlacementVectorExtraData> },
|
||||
{ "BSDistantObjectExtraData", &construct<BSDistantObjectExtraData, RC_BSDistantObjectExtraData> },
|
||||
{ "BSDistantObjectLargeRefExtraData",
|
||||
&construct<BSDistantObjectLargeRefExtraData, RC_BSDistantObjectLargeRefExtraData> },
|
||||
{ "BSWArray", &construct<BSWArray, RC_BSWArray> },
|
||||
{ "BSXFlags", &construct<NiIntegerExtraData, RC_BSXFlags> },
|
||||
|
||||
// GEOMETRY
|
||||
|
@ -239,7 +259,9 @@ namespace Nif
|
|||
// Bethesda
|
||||
{ "BSDismemberSkinInstance", &construct<BSDismemberSkinInstance, RC_BSDismemberSkinInstance> },
|
||||
{ "BSTriShape", &construct<BSTriShape, RC_BSTriShape> },
|
||||
{ "BSDynamicTriShape", &construct<BSDynamicTriShape, RC_BSDynamicTriShape> },
|
||||
{ "BSLODTriShape", &construct<BSLODTriShape, RC_BSLODTriShape> },
|
||||
{ "BSMeshLODTriShape", &construct<BSMeshLODTriShape, RC_BSMeshLODTriShape> },
|
||||
|
||||
// PARTICLES
|
||||
|
||||
|
@ -262,6 +284,8 @@ namespace Nif
|
|||
{ "bhkCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> },
|
||||
{ "bhkPCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> },
|
||||
{ "bhkSPCollisionObject", &construct<bhkCollisionObject, RC_bhkCollisionObject> },
|
||||
{ "bhkNPCollisionObject", &construct<bhkNPCollisionObject, RC_bhkCollisionObject> },
|
||||
{ "bhkBlendCollisionObject", &construct<bhkBlendCollisionObject, RC_bhkBlendCollisionObject> },
|
||||
|
||||
// Constraint records, Bethesda
|
||||
{ "bhkHingeConstraint", &construct<bhkHingeConstraint, RC_bhkHingeConstraint> },
|
||||
|
@ -275,8 +299,11 @@ namespace Nif
|
|||
// Physics geometry records, Bethesda
|
||||
{ "bhkBoxShape", &construct<bhkBoxShape, RC_bhkBoxShape> },
|
||||
{ "bhkCapsuleShape", &construct<bhkCapsuleShape, RC_bhkCapsuleShape> },
|
||||
{ "bhkCylinderShape", &construct<bhkCylinderShape, RC_bhkCylinderShape> },
|
||||
{ "bhkCompressedMeshShape", &construct<bhkCompressedMeshShape, RC_bhkCompressedMeshShape> },
|
||||
{ "bhkCompressedMeshShapeData", &construct<bhkCompressedMeshShapeData, RC_bhkCompressedMeshShapeData> },
|
||||
{ "bhkConvexListShape", &construct<bhkConvexListShape, RC_bhkConvexListShape> },
|
||||
{ "bhkConvexSweepShape", &construct<bhkConvexSweepShape, RC_bhkConvexSweepShape> },
|
||||
{ "bhkConvexTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> },
|
||||
{ "bhkConvexVerticesShape", &construct<bhkConvexVerticesShape, RC_bhkConvexVerticesShape> },
|
||||
{ "bhkListShape", &construct<bhkListShape, RC_bhkListShape> },
|
||||
|
@ -288,6 +315,10 @@ namespace Nif
|
|||
{ "bhkSphereShape", &construct<bhkSphereShape, RC_bhkSphereShape> },
|
||||
{ "bhkTransformShape", &construct<bhkConvexTransformShape, RC_bhkConvexTransformShape> },
|
||||
|
||||
// Physics system records, Bethesda
|
||||
{ "bhkPhysicsSystem", &construct<bhkPhysicsSystem, RC_bhkPhysicsSystem> },
|
||||
{ "bhkRagdollSystem", &construct<bhkRagdollSystem, RC_bhkRagdollSystem> },
|
||||
|
||||
// PROPERTIES
|
||||
|
||||
// 4.0.0.2
|
||||
|
@ -307,8 +338,17 @@ namespace Nif
|
|||
{ "BSShaderProperty", &construct<BSShaderProperty, RC_BSShaderProperty> },
|
||||
{ "BSShaderPPLightingProperty", &construct<BSShaderPPLightingProperty, RC_BSShaderPPLightingProperty> },
|
||||
{ "BSShaderNoLightingProperty", &construct<BSShaderNoLightingProperty, RC_BSShaderNoLightingProperty> },
|
||||
{ "BSDistantTreeShaderProperty", &construct<BSShaderProperty, RC_BSDistantTreeShaderProperty> },
|
||||
{ "BSLightingShaderProperty", &construct<BSLightingShaderProperty, RC_BSLightingShaderProperty> },
|
||||
{ "BSEffectShaderProperty", &construct<BSEffectShaderProperty, RC_BSEffectShaderProperty> },
|
||||
{ "DistantLODShaderProperty", &construct<BSShaderProperty, RC_DistantLODShaderProperty> },
|
||||
{ "HairShaderProperty", &construct<BSShaderProperty, RC_HairShaderProperty> },
|
||||
{ "Lighting30ShaderProperty", &construct<BSShaderPPLightingProperty, RC_BSShaderPPLightingProperty> },
|
||||
{ "SkyShaderProperty", &construct<SkyShaderProperty, RC_SkyShaderProperty> },
|
||||
{ "TallGrassShaderProperty", &construct<TallGrassShaderProperty, RC_TallGrassShaderProperty> },
|
||||
{ "TileShaderProperty", &construct<TileShaderProperty, RC_TileShaderProperty> },
|
||||
{ "VolumetricFogShaderProperty", &construct<BSShaderProperty, RC_VolumetricFogShaderProperty> },
|
||||
{ "WaterShaderProperty", &construct<BSShaderProperty, RC_WaterShaderProperty> },
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -414,6 +414,23 @@ namespace Nif
|
|||
mAlphaProperty.post(nif);
|
||||
}
|
||||
|
||||
void BSDynamicTriShape::read(NIFStream* nif)
|
||||
{
|
||||
BSTriShape::read(nif);
|
||||
|
||||
nif->read(mDynamicDataSize);
|
||||
// nifly style.
|
||||
// Consider complaining if mDynamicDataSize * 16 != mVertData.size()?
|
||||
nif->readVector(mDynamicData, mVertData.size());
|
||||
}
|
||||
|
||||
void BSMeshLODTriShape::read(NIFStream* nif)
|
||||
{
|
||||
BSTriShape::read(nif);
|
||||
|
||||
nif->readArray(mLOD);
|
||||
}
|
||||
|
||||
void BSVertexDesc::read(NIFStream* nif)
|
||||
{
|
||||
uint64_t data;
|
||||
|
@ -448,21 +465,9 @@ namespace Nif
|
|||
if (hasVertex)
|
||||
{
|
||||
if (fullPrecision)
|
||||
{
|
||||
nif->read(mVertex);
|
||||
if (hasTangent)
|
||||
nif->read(mBitangentX);
|
||||
else
|
||||
nif->skip(4); // Unused
|
||||
}
|
||||
else
|
||||
{
|
||||
nif->readArray(mHalfVertex);
|
||||
if (hasTangent)
|
||||
nif->read(mHalfBitangentX);
|
||||
else
|
||||
nif->skip(2); // Unused
|
||||
}
|
||||
}
|
||||
|
||||
if (hasUV)
|
||||
|
@ -471,12 +476,8 @@ namespace Nif
|
|||
if (hasNormal)
|
||||
{
|
||||
nif->readArray(mNormal);
|
||||
nif->read(mBitangentY);
|
||||
if (hasTangent)
|
||||
{
|
||||
nif->readArray(mTangent);
|
||||
nif->read(mBitangentZ);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasVertexColor)
|
||||
|
|
|
@ -338,15 +338,11 @@ namespace Nif
|
|||
|
||||
struct BSVertexData
|
||||
{
|
||||
osg::Vec3f mVertex;
|
||||
std::array<Misc::float16_t, 3> mHalfVertex;
|
||||
float mBitangentX;
|
||||
Misc::float16_t mHalfBitangentX;
|
||||
osg::Vec4f mVertex; // Bitangent X is stored in the fourth component
|
||||
std::array<Misc::float16_t, 4> mHalfVertex; // Ditto
|
||||
std::array<Misc::float16_t, 2> mUV;
|
||||
std::array<char, 3> mNormal;
|
||||
char mBitangentY;
|
||||
std::array<char, 3> mTangent;
|
||||
char mBitangentZ;
|
||||
std::array<char, 4> mNormal; // Bitangent Y is stored in the fourth component
|
||||
std::array<char, 4> mTangent; // Bitangent Z is stored in the fourth component
|
||||
std::array<char, 4> mVertColor;
|
||||
std::array<Misc::float16_t, 4> mBoneWeights;
|
||||
std::array<char, 4> mBoneIndices;
|
||||
|
@ -372,6 +368,21 @@ namespace Nif
|
|||
void post(Reader& nif) override;
|
||||
};
|
||||
|
||||
struct BSDynamicTriShape : BSTriShape
|
||||
{
|
||||
uint32_t mDynamicDataSize;
|
||||
std::vector<osg::Vec4f> mDynamicData;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct BSMeshLODTriShape : BSTriShape
|
||||
{
|
||||
std::array<uint32_t, 3> mLOD;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct BSValueNode : NiNode
|
||||
{
|
||||
enum Flags
|
||||
|
|
|
@ -342,6 +342,43 @@ namespace Nif
|
|||
mBody.read(nif);
|
||||
}
|
||||
|
||||
void bhkNPCollisionObject::read(NIFStream* nif)
|
||||
{
|
||||
NiCollisionObject::read(nif);
|
||||
|
||||
nif->read(mFlags);
|
||||
mData.read(nif);
|
||||
nif->read(mBodyID);
|
||||
}
|
||||
|
||||
void bhkNPCollisionObject::post(Reader& nif)
|
||||
{
|
||||
NiCollisionObject::post(nif);
|
||||
|
||||
mData.post(nif);
|
||||
}
|
||||
|
||||
void bhkBlendCollisionObject::read(NIFStream* nif)
|
||||
{
|
||||
bhkCollisionObject::read(nif);
|
||||
|
||||
nif->read(mHeirGain);
|
||||
nif->read(mVelGain);
|
||||
|
||||
if (nif->getBethVersion() <= 8)
|
||||
nif->skip(8); // Unknown
|
||||
}
|
||||
|
||||
void bhkPhysicsSystem::read(NIFStream* nif)
|
||||
{
|
||||
nif->readVector(mData, nif->get<uint32_t>());
|
||||
}
|
||||
|
||||
void bhkRagdollSystem::read(NIFStream* nif)
|
||||
{
|
||||
nif->readVector(mData, nif->get<uint32_t>());
|
||||
}
|
||||
|
||||
void bhkWorldObject::read(NIFStream* nif)
|
||||
{
|
||||
mShape.read(nif);
|
||||
|
@ -466,6 +503,35 @@ namespace Nif
|
|||
nif->read(mRadius);
|
||||
}
|
||||
|
||||
void bhkConvexListShape::read(NIFStream* nif)
|
||||
{
|
||||
readRecordList(nif, mSubShapes);
|
||||
mMaterial.read(nif);
|
||||
nif->read(mRadius);
|
||||
nif->skip(8); // Unknown
|
||||
mChildShapeProperty.read(nif);
|
||||
nif->read(mUseCachedAABB);
|
||||
nif->read(mClosestPointMinDistance);
|
||||
}
|
||||
|
||||
void bhkConvexListShape::post(Reader& nif)
|
||||
{
|
||||
postRecordList(nif, mSubShapes);
|
||||
}
|
||||
|
||||
void bhkConvexSweepShape::read(NIFStream* nif)
|
||||
{
|
||||
mShape.read(nif);
|
||||
mMaterial.read(nif);
|
||||
nif->read(mRadius);
|
||||
nif->skip(12); // Unknown
|
||||
}
|
||||
|
||||
void bhkConvexSweepShape::post(Reader& nif)
|
||||
{
|
||||
mShape.post(nif);
|
||||
}
|
||||
|
||||
void bhkConvexVerticesShape::read(NIFStream* nif)
|
||||
{
|
||||
bhkConvexShape::read(nif);
|
||||
|
@ -512,6 +578,17 @@ namespace Nif
|
|||
nif->read(mRadius2);
|
||||
}
|
||||
|
||||
void bhkCylinderShape::read(NIFStream* nif)
|
||||
{
|
||||
bhkConvexShape::read(nif);
|
||||
|
||||
nif->skip(8); // Unused
|
||||
nif->read(mVertexA);
|
||||
nif->read(mVertexB);
|
||||
nif->read(mCylinderRadius);
|
||||
nif->skip(12); // Unused
|
||||
}
|
||||
|
||||
void bhkListShape::read(NIFStream* nif)
|
||||
{
|
||||
readRecordList(nif, mSubshapes);
|
||||
|
|
|
@ -370,6 +370,11 @@ namespace Nif
|
|||
{
|
||||
};
|
||||
|
||||
// Abstract physics system
|
||||
struct bhkSystem : public Record
|
||||
{
|
||||
};
|
||||
|
||||
// Generic collision object
|
||||
struct NiCollisionObject : public Record
|
||||
{
|
||||
|
@ -394,6 +399,38 @@ namespace Nif
|
|||
}
|
||||
};
|
||||
|
||||
struct bhkNPCollisionObject : NiCollisionObject
|
||||
{
|
||||
uint16_t mFlags;
|
||||
bhkSystemPtr mData;
|
||||
uint32_t mBodyID;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
void post(Reader& nif) override;
|
||||
};
|
||||
|
||||
struct bhkBlendCollisionObject : bhkCollisionObject
|
||||
{
|
||||
float mHeirGain;
|
||||
float mVelGain;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct bhkPhysicsSystem : public bhkSystem
|
||||
{
|
||||
std::vector<uint8_t> mData;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct bhkRagdollSystem : public bhkSystem
|
||||
{
|
||||
std::vector<uint8_t> mData;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
// Abstract Havok shape info record
|
||||
struct bhkWorldObject : public bhkSerializable
|
||||
{
|
||||
|
@ -485,6 +522,30 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
// A list of convex shapes sharing the same properties
|
||||
struct bhkConvexListShape : public bhkShape
|
||||
{
|
||||
bhkShapeList mSubShapes;
|
||||
HavokMaterial mMaterial;
|
||||
float mRadius;
|
||||
bhkWorldObjCInfoProperty mChildShapeProperty;
|
||||
bool mUseCachedAABB;
|
||||
float mClosestPointMinDistance;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
void post(Reader& nif) override;
|
||||
};
|
||||
|
||||
struct bhkConvexSweepShape : bhkShape
|
||||
{
|
||||
bhkConvexShape mShape;
|
||||
HavokMaterial mMaterial;
|
||||
float mRadius;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
void post(Reader& nif) override;
|
||||
};
|
||||
|
||||
// A convex shape built from vertices
|
||||
struct bhkConvexVerticesShape : public bhkConvexShape
|
||||
{
|
||||
|
@ -524,6 +585,15 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
// A cylinder
|
||||
struct bhkCylinderShape : public bhkConvexShape
|
||||
{
|
||||
osg::Vec4f mVertexA, mVertexB;
|
||||
float mCylinderRadius;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
// A sphere
|
||||
using bhkSphereShape = bhkConvexShape;
|
||||
|
||||
|
|
|
@ -227,6 +227,28 @@ namespace Nif
|
|||
nif->read(mFalloffParams);
|
||||
}
|
||||
|
||||
void SkyShaderProperty::read(NIFStream* nif)
|
||||
{
|
||||
BSShaderLightingProperty::read(nif);
|
||||
|
||||
mFilename = nif->getSizedString();
|
||||
mSkyObjectType = static_cast<ObjectType>(nif->get<uint32_t>());
|
||||
}
|
||||
|
||||
void TallGrassShaderProperty::read(NIFStream* nif)
|
||||
{
|
||||
BSShaderProperty::read(nif);
|
||||
|
||||
mFilename = nif->getSizedString();
|
||||
}
|
||||
|
||||
void TileShaderProperty::read(NIFStream* nif)
|
||||
{
|
||||
BSShaderLightingProperty::read(nif);
|
||||
|
||||
mFilename = nif->getSizedString();
|
||||
}
|
||||
|
||||
void BSSPLuminanceParams::read(NIFStream* nif)
|
||||
{
|
||||
nif->read(mLumEmittance);
|
||||
|
@ -349,7 +371,7 @@ namespace Nif
|
|||
break;
|
||||
case BSLightingShaderType::ShaderType_SkinTint:
|
||||
nif->read(mSkinTintColor);
|
||||
if (nif->getBethVersion() > NIFFile::BethVersion::BETHVER_FO4)
|
||||
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_FO4)
|
||||
nif->read(mSkinTintAlpha);
|
||||
break;
|
||||
case BSLightingShaderType::ShaderType_HairTint:
|
||||
|
|
|
@ -171,6 +171,38 @@ namespace Nif
|
|||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct SkyShaderProperty : BSShaderLightingProperty
|
||||
{
|
||||
enum class ObjectType : uint32_t
|
||||
{
|
||||
SkyTexture = 0,
|
||||
SkySunglare = 1,
|
||||
Sky = 2,
|
||||
SkyClouds = 3,
|
||||
SkyStars = 5,
|
||||
SkyMoonStarsMask = 7,
|
||||
};
|
||||
|
||||
std::string mFilename;
|
||||
ObjectType mSkyObjectType;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct TallGrassShaderProperty : BSShaderProperty
|
||||
{
|
||||
std::string mFilename;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
struct TileShaderProperty : BSShaderLightingProperty
|
||||
{
|
||||
std::string mFilename;
|
||||
|
||||
void read(NIFStream* nif) override;
|
||||
};
|
||||
|
||||
enum class BSLightingShaderType : uint32_t
|
||||
{
|
||||
ShaderType_Default = 0,
|
||||
|
|
|
@ -36,12 +36,16 @@ namespace Nif
|
|||
{
|
||||
RC_MISSING = 0,
|
||||
RC_AvoidNode,
|
||||
RC_bhkBlendCollisionObject,
|
||||
RC_bhkBlendController,
|
||||
RC_bhkBoxShape,
|
||||
RC_bhkCapsuleShape,
|
||||
RC_bhkCylinderShape,
|
||||
RC_bhkCollisionObject,
|
||||
RC_bhkCompressedMeshShape,
|
||||
RC_bhkCompressedMeshShapeData,
|
||||
RC_bhkConvexListShape,
|
||||
RC_bhkConvexSweepShape,
|
||||
RC_bhkConvexTransformShape,
|
||||
RC_bhkConvexVerticesShape,
|
||||
RC_bhkHingeConstraint,
|
||||
|
@ -50,27 +54,44 @@ namespace Nif
|
|||
RC_bhkMoppBvTreeShape,
|
||||
RC_bhkNiTriStripsShape,
|
||||
RC_bhkPackedNiTriStripsShape,
|
||||
RC_bhkPhysicsSystem,
|
||||
RC_bhkRagdollConstraint,
|
||||
RC_bhkRagdollSystem,
|
||||
RC_bhkRigidBody,
|
||||
RC_bhkRigidBodyT,
|
||||
RC_bhkSimpleShapePhantom,
|
||||
RC_bhkSphereShape,
|
||||
RC_BSBehaviorGraphExtraData,
|
||||
RC_BSBound,
|
||||
RC_BSBoneLODExtraData,
|
||||
RC_BSClothExtraData,
|
||||
RC_BSDecalPlacementVectorExtraData,
|
||||
RC_BSDistantTreeShaderProperty,
|
||||
RC_BSDynamicTriShape,
|
||||
RC_BSDismemberSkinInstance,
|
||||
RC_BSDistantObjectExtraData,
|
||||
RC_BSDistantObjectLargeRefExtraData,
|
||||
RC_BSEffectShaderProperty,
|
||||
RC_BSEffectShaderPropertyColorController,
|
||||
RC_BSEffectShaderPropertyFloatController,
|
||||
RC_BSExtraData,
|
||||
RC_BSFrustumFOVController,
|
||||
RC_BSFurnitureMarker,
|
||||
RC_BSInvMarker,
|
||||
RC_BSKeyframeController,
|
||||
RC_BSLagBoneController,
|
||||
RC_BSLightingShaderProperty,
|
||||
RC_BSLightingShaderPropertyColorController,
|
||||
RC_BSLightingShaderPropertyFloatController,
|
||||
RC_BSLODTriShape,
|
||||
RC_BSMaterialEmittanceMultController,
|
||||
RC_BSMeshLODTriShape,
|
||||
RC_BSMultiBound,
|
||||
RC_BSMultiBoundAABB,
|
||||
RC_BSMultiBoundOBB,
|
||||
RC_BSMultiBoundSphere,
|
||||
RC_BSNiAlphaPropertyTestRefController,
|
||||
RC_BSPackedAdditionalGeometryData,
|
||||
RC_BSRefractionFirePeriodController,
|
||||
RC_BSRefractionStrengthController,
|
||||
RC_BSShaderNoLightingProperty,
|
||||
|
@ -78,8 +99,12 @@ namespace Nif
|
|||
RC_BSShaderProperty,
|
||||
RC_BSShaderTextureSet,
|
||||
RC_BSTriShape,
|
||||
RC_BSWArray,
|
||||
RC_BSXFlags,
|
||||
RC_DistantLODShaderProperty,
|
||||
RC_HairShaderProperty,
|
||||
RC_hkPackedNiTriStripsData,
|
||||
RC_NiAdditionalGeometryData,
|
||||
RC_NiAlphaAccumulator,
|
||||
RC_NiAlphaController,
|
||||
RC_NiAlphaProperty,
|
||||
|
@ -122,6 +147,7 @@ namespace Nif
|
|||
RC_NiKeyframeController,
|
||||
RC_NiKeyframeData,
|
||||
RC_NiLight,
|
||||
RC_NiLightDimmerController,
|
||||
RC_NiLines,
|
||||
RC_NiLinesData,
|
||||
RC_NiLODNode,
|
||||
|
@ -156,6 +182,7 @@ namespace Nif
|
|||
RC_NiSphericalCollider,
|
||||
RC_NiStencilProperty,
|
||||
RC_NiStringExtraData,
|
||||
RC_NiStringsExtraData,
|
||||
RC_NiStringPalette,
|
||||
RC_NiSwitchNode,
|
||||
RC_NiTextKeyExtraData,
|
||||
|
@ -177,6 +204,11 @@ namespace Nif
|
|||
RC_NiWireframeProperty,
|
||||
RC_NiZBufferProperty,
|
||||
RC_RootCollisionNode,
|
||||
RC_SkyShaderProperty,
|
||||
RC_TallGrassShaderProperty,
|
||||
RC_TileShaderProperty,
|
||||
RC_VolumetricFogShaderProperty,
|
||||
RC_WaterShaderProperty,
|
||||
};
|
||||
|
||||
/// Base class for all records
|
||||
|
|
|
@ -136,6 +136,7 @@ namespace Nif
|
|||
struct BSShaderProperty;
|
||||
struct NiAlphaProperty;
|
||||
struct NiCollisionObject;
|
||||
struct bhkSystem;
|
||||
struct bhkWorldObject;
|
||||
struct bhkShape;
|
||||
struct bhkSerializable;
|
||||
|
@ -176,6 +177,7 @@ namespace Nif
|
|||
using BSShaderPropertyPtr = RecordPtrT<BSShaderProperty>;
|
||||
using NiAlphaPropertyPtr = RecordPtrT<NiAlphaProperty>;
|
||||
using NiCollisionObjectPtr = RecordPtrT<NiCollisionObject>;
|
||||
using bhkSystemPtr = RecordPtrT<bhkSystem>;
|
||||
using bhkWorldObjectPtr = RecordPtrT<bhkWorldObject>;
|
||||
using bhkShapePtr = RecordPtrT<bhkShape>;
|
||||
using bhkEntityPtr = RecordPtrT<bhkEntity>;
|
||||
|
|
Loading…
Reference in a new issue