Improve or fix FO76-related definitions

macos_ci_fix
Alexei Kotov 1 year ago
parent 72a5b50002
commit fdf9184cae

@ -45,7 +45,9 @@ namespace Nif
{ {
NiPointLight::read(nif); NiPointLight::read(nif);
nif->read(mCutoff); nif->read(mOuterSpotAngle);
if (nif->getVersion() >= NIFStream::generateVersion(20, 2, 0, 5))
nif->read(mInnerSpotAngle);
nif->read(mExponent); nif->read(mExponent);
} }

@ -58,7 +58,8 @@ namespace Nif
struct NiSpotLight : public NiPointLight struct NiSpotLight : public NiPointLight
{ {
float mCutoff; float mOuterSpotAngle;
float mInnerSpotAngle{ 0.f };
float mExponent; float mExponent;
void read(NIFStream* nif) override; void read(NIFStream* nif) override;
}; };

@ -231,7 +231,7 @@ namespace Nif
info.read(nif); info.read(nif);
} }
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_F76) if (nif->getBethVersion() > NIFFile::BethVersion::BETHVER_FO4)
nif->skip(12); // Unknown nif->skip(12); // Unknown
if (nif->getVersion() >= NIFStream::generateVersion(20, 0, 0, 2) && nif->get<bool>() && hasData) if (nif->getVersion() >= NIFStream::generateVersion(20, 0, 0, 2) && nif->get<bool>() && hasData)
@ -420,8 +420,8 @@ namespace Nif
{ {
nif->read(mRotationSpeedVariation); nif->read(mRotationSpeedVariation);
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_F76) if (nif->getBethVersion() > NIFFile::BethVersion::BETHVER_FO4)
nif->skip(5); // Unknown nif->skip(17); // Unknown
nif->read(mRotationAngle); nif->read(mRotationAngle);
nif->read(mRotationAngleVariation); nif->read(mRotationAngleVariation);

@ -148,12 +148,6 @@ namespace Nif
} }
else else
{ {
uint32_t numShaderFlags1 = 0, numShaderFlags2 = 0;
nif->read(numShaderFlags1);
if (nif->getBethVersion() >= 152)
nif->read(numShaderFlags2);
nif->readVector(mShaderFlags1Hashes, numShaderFlags1);
nif->readVector(mShaderFlags2Hashes, numShaderFlags2);
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_F76 && recType == RC_BSLightingShaderProperty) if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_F76 && recType == RC_BSLightingShaderProperty)
{ {
nif->read(mType); nif->read(mType);
@ -181,6 +175,13 @@ namespace Nif
break; break;
} }
} }
uint32_t numShaderFlags1 = 0, numShaderFlags2 = 0;
nif->read(numShaderFlags1);
if (nif->getBethVersion() >= 152)
nif->read(numShaderFlags2);
nif->readVector(mShaderFlags1Hashes, numShaderFlags1);
nif->readVector(mShaderFlags2Hashes, numShaderFlags2);
} }
nif->read(mUVOffset); nif->read(mUVOffset);
@ -324,7 +325,7 @@ namespace Nif
{ {
nif->read(mSubsurfaceRolloff); nif->read(mSubsurfaceRolloff);
nif->read(mRimlightPower); nif->read(mRimlightPower);
if (mRimlightPower == std::numeric_limits<float>::max()) if (nif->getBethVersion() == 130 && mRimlightPower == std::numeric_limits<float>::max())
nif->read(mBacklightPower); nif->read(mBacklightPower);
} }
@ -335,9 +336,9 @@ namespace Nif
mWetness.read(nif); mWetness.read(nif);
} }
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_STF) if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_F76)
{
mLuminance.read(nif); mLuminance.read(nif);
if (nif->getBethVersion() == NIFFile::BethVersion::BETHVER_F76) if (nif->getBethVersion() == NIFFile::BethVersion::BETHVER_F76)
{ {
nif->read(mDoTranslucency); nif->read(mDoTranslucency);
@ -350,13 +351,13 @@ namespace Nif
nif->getSizedStrings(textureArray, nif->get<uint32_t>()); nif->getSizedStrings(textureArray, nif->get<uint32_t>());
} }
} }
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_STF) if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_STF)
{ {
nif->skip(4); // Unknown nif->skip(4); // Unknown
nif->skip(4); // Unknown nif->skip(4); // Unknown
nif->skip(2); // Unknown nif->skip(2); // Unknown
} }
}
switch (static_cast<BSLightingShaderType>(mType)) switch (static_cast<BSLightingShaderType>(mType))
{ {
@ -439,7 +440,6 @@ namespace Nif
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_F76) if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_F76)
{ {
nif->read(mRefractionPower);
mReflectanceTexture = nif->getSizedString(); mReflectanceTexture = nif->getSizedString();
mLightingTexture = nif->getSizedString(); mLightingTexture = nif->getSizedString();
nif->read(mEmittanceColor); nif->read(mEmittanceColor);

@ -295,15 +295,15 @@ namespace Nif
{ {
BSShaderTextureSetPtr mTextureSet; BSShaderTextureSetPtr mTextureSet;
osg::Vec3f mEmissive; osg::Vec3f mEmissive;
float mEmissiveMult; float mEmissiveMult{ 1.f };
std::string mRootMaterial; std::string mRootMaterial;
uint32_t mClamp; uint32_t mClamp{ 3 };
float mAlpha; float mAlpha{ 1.f };
float mRefractionStrength; float mRefractionStrength;
float mGlossiness{ 80.f }; float mGlossiness{ 80.f };
float mSmoothness{ 1.f }; float mSmoothness{ 1.f };
osg::Vec3f mSpecular; osg::Vec3f mSpecular;
float mSpecStrength; float mSpecStrength{ 1.f };
std::array<float, 2> mLightingEffects; std::array<float, 2> mLightingEffects;
float mSubsurfaceRolloff; float mSubsurfaceRolloff;
float mRimlightPower; float mRimlightPower;

Loading…
Cancel
Save