summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llgltfmaterial.cpp
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2022-12-12 14:12:03 -0800
committerCosmic Linden <cosmic@lindenlab.com>2023-01-09 14:13:09 -0800
commit4fa77b6f728b6be3d2e7fc74dda97b835476f797 (patch)
treea9e8b5504061c1fc83c289549c572af1483d2f59 /indra/llprimitive/llgltfmaterial.cpp
parenta710bf9067bd4c4217b9febc0ad277a1636ec882 (diff)
SL-18820: Update LLGLTFMaterial: Add setBaseMaterial() and equality comparison
Diffstat (limited to 'indra/llprimitive/llgltfmaterial.cpp')
-rw-r--r--indra/llprimitive/llgltfmaterial.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp
index c98fd7d1ee..5442af33d0 100644
--- a/indra/llprimitive/llgltfmaterial.cpp
+++ b/indra/llprimitive/llgltfmaterial.cpp
@@ -98,6 +98,29 @@ LLGLTFMaterial& LLGLTFMaterial::operator=(const LLGLTFMaterial& rhs)
return *this;
}
+bool LLGLTFMaterial::operator==(const LLGLTFMaterial& rhs) const
+{
+ return mBaseColorId == rhs.mBaseColorId &&
+ mNormalId == rhs.mNormalId &&
+ mMetallicRoughnessId == rhs.mMetallicRoughnessId &&
+ mEmissiveId == rhs.mEmissiveId &&
+
+ mBaseColor == rhs.mBaseColor &&
+ mEmissiveColor == rhs.mEmissiveColor &&
+
+ mMetallicFactor == rhs.mMetallicFactor &&
+ mRoughnessFactor == rhs.mRoughnessFactor &&
+ mAlphaCutoff == rhs.mAlphaCutoff &&
+
+ mDoubleSided == rhs.mDoubleSided &&
+ mAlphaMode == rhs.mAlphaMode &&
+
+ mTextureTransform == rhs.mTextureTransform &&
+
+ mOverrideDoubleSided == rhs.mOverrideDoubleSided &&
+ mOverrideAlphaMode == rhs.mOverrideAlphaMode;
+}
+
bool LLGLTFMaterial::fromJSON(const std::string& json, std::string& warn_msg, std::string& error_msg)
{
LL_PROFILE_ZONE_SCOPED;
@@ -365,6 +388,16 @@ void LLGLTFMaterial::writeToTexture(tinygltf::Model& model, T& texture_info, Tex
texture_info.extensions[GLTF_FILE_EXTENSION_TRANSFORM] = tinygltf::Value(transform_map);
}
+bool LLGLTFMaterial::setBaseMaterial()
+{
+ const LLGLTFMaterial old_override = *this;
+ *this = sDefault;
+ // Preserve the texture transforms
+ mTextureTransform = old_override.mTextureTransform;
+ return *this != old_override;
+}
+
+
// static
void LLGLTFMaterial::hackOverrideUUID(LLUUID& id)
{