summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-11-14 13:33:11 -0600
committerGitHub <noreply@github.com>2023-11-14 13:33:11 -0600
commit0edb7cad6bdeaf02cbd89d1f2dd38c47d6078c03 (patch)
treead6c8ec4b2a29fe9d21bd2049be7b95a86c9f89e
parent8d538ef77b395e2f8ba6d4f89c2633dd57124c04 (diff)
SL-20340 Fix for off-by-epsilon hack falling off when serializing overrides as LLSD. (#513)
-rw-r--r--indra/llprimitive/llgltfmaterial.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp
index c1f2a04154..9945c230a2 100644
--- a/indra/llprimitive/llgltfmaterial.cpp
+++ b/indra/llprimitive/llgltfmaterial.cpp
@@ -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"];