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);
nif->read(mCutoff);
nif->read(mOuterSpotAngle);
if (nif->getVersion() >= NIFStream::generateVersion(20, 2, 0, 5))
nif->read(mInnerSpotAngle);
nif->read(mExponent);
}

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

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

@ -148,12 +148,6 @@ namespace Nif
}
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)
{
nif->read(mType);
@ -181,6 +175,13 @@ namespace Nif
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);
@ -324,7 +325,7 @@ namespace Nif
{
nif->read(mSubsurfaceRolloff);
nif->read(mRimlightPower);
if (mRimlightPower == std::numeric_limits<float>::max())
if (nif->getBethVersion() == 130 && mRimlightPower == std::numeric_limits<float>::max())
nif->read(mBacklightPower);
}
@ -335,27 +336,27 @@ namespace Nif
mWetness.read(nif);
}
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_STF)
mLuminance.read(nif);
if (nif->getBethVersion() == NIFFile::BethVersion::BETHVER_F76)
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_F76)
{
nif->read(mDoTranslucency);
if (mDoTranslucency)
mTranslucency.read(nif);
if (nif->get<uint8_t>() != 0)
mLuminance.read(nif);
if (nif->getBethVersion() == NIFFile::BethVersion::BETHVER_F76)
{
mTextureArrays.resize(nif->get<uint32_t>());
for (std::vector<std::string>& textureArray : mTextureArrays)
nif->getSizedStrings(textureArray, nif->get<uint32_t>());
nif->read(mDoTranslucency);
if (mDoTranslucency)
mTranslucency.read(nif);
if (nif->get<uint8_t>() != 0)
{
mTextureArrays.resize(nif->get<uint32_t>());
for (std::vector<std::string>& textureArray : mTextureArrays)
nif->getSizedStrings(textureArray, nif->get<uint32_t>());
}
}
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_STF)
{
nif->skip(4); // Unknown
nif->skip(4); // Unknown
nif->skip(2); // Unknown
}
}
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_STF)
{
nif->skip(4); // Unknown
nif->skip(4); // Unknown
nif->skip(2); // Unknown
}
switch (static_cast<BSLightingShaderType>(mType))
@ -439,7 +440,6 @@ namespace Nif
if (nif->getBethVersion() >= NIFFile::BethVersion::BETHVER_F76)
{
nif->read(mRefractionPower);
mReflectanceTexture = nif->getSizedString();
mLightingTexture = nif->getSizedString();
nif->read(mEmittanceColor);

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

Loading…
Cancel
Save