mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-16 16:20:53 +00:00
Read BSMeshLODTriShape and BSDynamicTriShape
Slightly clean up BSVertexData loading Fix skin tint alpha loading in BSLightingShaderProperty
This commit is contained in:
parent
a39182f7de
commit
30b842dd1e
@ -249,7 +249,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
|
||||
|
||||
|
@ -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
|
||||
|
@ -349,7 +349,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:
|
||||
|
@ -60,6 +60,7 @@ namespace Nif
|
||||
RC_BSBoneLODExtraData,
|
||||
RC_BSClothExtraData,
|
||||
RC_BSDecalPlacementVectorExtraData,
|
||||
RC_BSDynamicTriShape,
|
||||
RC_BSDismemberSkinInstance,
|
||||
RC_BSDistantObjectExtraData,
|
||||
RC_BSDistantObjectLargeRefExtraData,
|
||||
@ -74,6 +75,7 @@ namespace Nif
|
||||
RC_BSLightingShaderPropertyFloatController,
|
||||
RC_BSLODTriShape,
|
||||
RC_BSMaterialEmittanceMultController,
|
||||
RC_BSMeshLODTriShape,
|
||||
RC_BSMultiBound,
|
||||
RC_BSMultiBoundOBB,
|
||||
RC_BSMultiBoundSphere,
|
||||
|
Loading…
x
Reference in New Issue
Block a user