Skip to content
Snippets Groups Projects
Unverified Commit 0edb7cad authored by David Parks's avatar David Parks Committed by GitHub
Browse files

SL-20340 Fix for off-by-epsilon hack falling off when serializing overrides as LLSD. (#513)

parent 8d538ef7
No related branches found
No related tags found
No related merge requests found
......@@ -691,24 +691,44 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data)
if (bc.isDefined())
{
mBaseColor.setValue(bc);
if (mBaseColor == getDefaultBaseColor())
{
// HACK -- nudge by epsilon if we receive a default value (indicates override to default)
mBaseColor.mV[3] -= FLT_EPSILON;
}
}
const LLSD& ec = data["ec"];
if (ec.isDefined())
{
mEmissiveColor.setValue(ec);
if (mEmissiveColor == getDefaultEmissiveColor())
{
// HACK -- nudge by epsilon if we receive a default value (indicates override to default)
mEmissiveColor.mV[0] += FLT_EPSILON;
}
}
const LLSD& mf = data["mf"];
if (mf.isReal())
{
mMetallicFactor = mf.asReal();
if (mMetallicFactor == getDefaultMetallicFactor())
{
// HACK -- nudge by epsilon if we receive a default value (indicates override to default)
mMetallicFactor -= FLT_EPSILON;
}
}
const LLSD& rf = data["rf"];
if (rf.isReal())
{
mRoughnessFactor = rf.asReal();
if (mRoughnessFactor == getDefaultRoughnessFactor())
{
// HACK -- nudge by epsilon if we receive a default value (indicates override to default)
mRoughnessFactor -= FLT_EPSILON;
}
}
const LLSD& am = data["am"];
......@@ -722,6 +742,11 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data)
if (ac.isReal())
{
mAlphaCutoff = ac.asReal();
if (mAlphaCutoff == getDefaultAlphaCutoff())
{
// HACK -- nudge by epsilon if we receive a default value (indicates override to default)
mAlphaCutoff -= FLT_EPSILON;
}
}
const LLSD& ds = data["ds"];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment