From e7b71cd8a10898320cf3e0aebc05bfdec3d2ffa3 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Wed, 8 Nov 2023 11:50:46 -0600 Subject: SL-20582 Fix for overriding to alpha mode blend not working. Incidental decruft of dead code (thanks, Rye!) --- indra/llprimitive/llgltfmaterial.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llprimitive/llgltfmaterial.cpp') diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index f42c11ee21..c1f2a04154 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -715,6 +715,7 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data) if (am.isInteger()) { mAlphaMode = (AlphaMode) am.asInteger(); + mOverrideAlphaMode = true; } const LLSD& ac = data["ac"]; -- cgit v1.2.3 From 0edb7cad6bdeaf02cbd89d1f2dd38c47d6078c03 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 14 Nov 2023 13:33:11 -0600 Subject: SL-20340 Fix for off-by-epsilon hack falling off when serializing overrides as LLSD. (#513) --- indra/llprimitive/llgltfmaterial.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'indra/llprimitive/llgltfmaterial.cpp') 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"]; -- cgit v1.2.3