summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/llgltfmaterial.cpp26
-rw-r--r--indra/llprimitive/llgltfmaterial.h3
2 files changed, 29 insertions, 0 deletions
diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp
index 6d23cb8039..ee1931a27b 100644
--- a/indra/llprimitive/llgltfmaterial.cpp
+++ b/indra/llprimitive/llgltfmaterial.cpp
@@ -61,6 +61,29 @@ LLMatrix3 LLGLTFMaterial::TextureTransform::asMatrix()
return offset * rotation * scale;
}
+LLGLTFMaterial::LLGLTFMaterial(bool for_override)
+: LLGLTFMaterial()
+{
+ if (for_override)
+ {
+ setBaseColorId(mBaseColorId, for_override);
+ setNormalId(mNormalId, for_override);
+ setMetallicRoughnessId(mMetallicRoughnessId, for_override);
+ setEmissiveId(mEmissiveId, for_override);
+
+ setBaseColorFactor(mBaseColor, for_override);
+ setAlphaCutoff(mAlphaCutoff, for_override);
+ setEmissiveColorFactor(mEmissiveColor, for_override);
+ setMetallicFactor(mMetallicFactor, for_override);
+ setRoughnessFactor(mRoughnessFactor, for_override);
+ setAlphaMode(mAlphaMode, for_override);
+ setDoubleSided(mDoubleSided, for_override);
+
+ // *NOTE: Texture offsets only exist in overrides, so there is no need
+ // to hack in the override value here.
+ }
+}
+
LLGLTFMaterial::LLGLTFMaterial(const LLGLTFMaterial& rhs)
{
*this = rhs;
@@ -588,6 +611,9 @@ void LLGLTFMaterial::applyOverrideUUID(LLUUID& dst_id, const LLUUID& override_id
}
}
+// Make a static default material override for editing materials
+const LLGLTFMaterial LLGLTFMaterial::sOverrideDefault{true};
+
void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat)
{
LL_PROFILE_ZONE_SCOPED;
diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h
index 60116fd423..2476818b27 100644
--- a/indra/llprimitive/llgltfmaterial.h
+++ b/indra/llprimitive/llgltfmaterial.h
@@ -48,6 +48,8 @@ public:
// default material for reference
static const LLGLTFMaterial sDefault;
+ // default material override for reference
+ static const LLGLTFMaterial sOverrideDefault;
struct TextureTransform
{
@@ -66,6 +68,7 @@ public:
};
LLGLTFMaterial() {}
+ LLGLTFMaterial(bool for_override);
LLGLTFMaterial(const LLGLTFMaterial& rhs);
LLGLTFMaterial& operator=(const LLGLTFMaterial& rhs);