From 26163e2154647e99567b1ce01b89ed208eb11bb8 Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Wed, 25 Oct 2023 16:27:38 -0700 Subject: Fix DRTVWR-559 std::array usage in llrender and llprimitive after merge --- indra/llprimitive/llgltfmaterial.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index a078a530a4..822a0aab22 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -34,6 +34,7 @@ #include "lluuid.h" #include "hbxxh.h" +#include #include #include -- cgit v1.2.3 From dc63dfc0dd6554f5f45b1d80bd4cb9258eefee95 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 25 Oct 2023 23:38:12 +0300 Subject: SL-20523 Local textures not updating on PBR Materials #1 Update editor in which texture changed to local --- indra/llprimitive/llgltfmaterial.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index 822a0aab22..548e2c52f4 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -222,6 +222,10 @@ public: virtual void addTextureEntry(LLTextureEntry* te) {}; virtual void removeTextureEntry(LLTextureEntry* te) {}; + // For local textures so that editor will know to track changes + void setHasLocalTextures(bool val) { mHasLocalTextures = val; } + bool hasLocalTextures() { return mHasLocalTextures; } + protected: static LLVector2 vec2FromJson(const std::map& object, const char* key, const LLVector2& default_value); static F32 floatFromJson(const std::map& object, const char* key, const F32 default_value); @@ -238,4 +242,6 @@ protected: void writeToTexture(tinygltf::Model& model, T& texture_info, TextureInfo texture_info_id, bool force_write = false) const; template static void writeToTexture(tinygltf::Model& model, T& texture_info, const LLUUID& texture_id, const TextureTransform& transform, bool force_write = false); + + bool mHasLocalTextures; }; -- cgit v1.2.3 From 596a63051ebabfec51e48be02bbec33ab962d915 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 27 Oct 2023 23:41:13 +0300 Subject: SL-20523 Local textures not updating on PBR Materials #2 --- indra/llprimitive/llgltfmaterial.cpp | 46 ++++++++++++++++++++++++++++++++++++ indra/llprimitive/llgltfmaterial.h | 12 ++++++---- 2 files changed, 54 insertions(+), 4 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index f42c11ee21..6afd83904f 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -89,6 +89,11 @@ LLGLTFMaterial& LLGLTFMaterial::operator=(const LLGLTFMaterial& rhs) mOverrideDoubleSided = rhs.mOverrideDoubleSided; mOverrideAlphaMode = rhs.mOverrideAlphaMode; + mLocalTextureIds = rhs.mLocalTextureIds; + mLocalTextureTrackingIds = rhs.mLocalTextureTrackingIds; + + updateTextureTracking(); + return *this; } @@ -765,3 +770,44 @@ LLUUID LLGLTFMaterial::getHash() const return hash; } +void LLGLTFMaterial::addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id) +{ + mLocalTextureTrackingIds.insert(tracking_id); + mLocalTextureIds.insert(tex_id); +} + +void LLGLTFMaterial::removeLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id) +{ + mLocalTextureTrackingIds.erase(tracking_id); + mLocalTextureIds.erase(tex_id); +} + +bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& old_id, const LLUUID& new_id) +{ + bool res = false; + + for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + { + if (mTextureId[i] == old_id) + { + mTextureId[i] = new_id; + res = true; + } + } + + mLocalTextureIds.erase(old_id); + if (res) + { + mLocalTextureIds.insert(new_id); + } + + return res; +} + +void LLGLTFMaterial::updateTextureTracking() +{ + if (mLocalTextureTrackingIds.size() > 0) + { + LL_WARNS() << "copied a material with local textures, but tracking not implemented" << LL_ENDL; + } +} diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index 548e2c52f4..d45ada1561 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -223,8 +223,14 @@ public: virtual void removeTextureEntry(LLTextureEntry* te) {}; // For local textures so that editor will know to track changes - void setHasLocalTextures(bool val) { mHasLocalTextures = val; } - bool hasLocalTextures() { return mHasLocalTextures; } + void addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID &tex_id); + void removeLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id); + bool hasLocalTextures() { return !mLocalTextureIds.empty(); } + virtual bool replaceLocalTexture(const LLUUID &old_id, const LLUUID& new_id); + virtual void updateTextureTracking(); + + uuid_set_t mLocalTextureIds; + uuid_set_t mLocalTextureTrackingIds; protected: static LLVector2 vec2FromJson(const std::map& object, const char* key, const LLVector2& default_value); @@ -242,6 +248,4 @@ protected: void writeToTexture(tinygltf::Model& model, T& texture_info, TextureInfo texture_info_id, bool force_write = false) const; template static void writeToTexture(tinygltf::Model& model, T& texture_info, const LLUUID& texture_id, const TextureTransform& transform, bool force_write = false); - - bool mHasLocalTextures; }; -- cgit v1.2.3 From 3a5b678eba5d86acccb1a1f233f862d292258fac Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 30 Oct 2023 23:56:33 +0200 Subject: SL-20523 Local textures not updating on PBR Materials #3 --- indra/llprimitive/llgltfmaterial.cpp | 9 +++++++++ indra/llprimitive/llgltfmaterial.h | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index 6afd83904f..e590b14656 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -770,6 +770,15 @@ LLUUID LLGLTFMaterial::getHash() const return hash; } +void LLGLTFMaterial::addTextureEntry(LLTextureEntry* te) +{ + mTextureEntires.insert(te); +} +void LLGLTFMaterial::removeTextureEntry(LLTextureEntry* te) +{ + mTextureEntires.erase(te); +} + void LLGLTFMaterial::addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id) { mLocalTextureTrackingIds.insert(tracking_id); diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index d45ada1561..2a9ef3ffe0 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -219,8 +219,8 @@ public: // For local materials, they have to keep track of where // they are assigned to for full updates - virtual void addTextureEntry(LLTextureEntry* te) {}; - virtual void removeTextureEntry(LLTextureEntry* te) {}; + virtual void addTextureEntry(LLTextureEntry* te); + virtual void removeTextureEntry(LLTextureEntry* te); // For local textures so that editor will know to track changes void addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID &tex_id); @@ -231,6 +231,7 @@ public: uuid_set_t mLocalTextureIds; uuid_set_t mLocalTextureTrackingIds; + std::set mTextureEntires; protected: static LLVector2 vec2FromJson(const std::map& object, const char* key, const LLVector2& default_value); -- cgit v1.2.3 From 52c60ab3fdb8617471eccd9df52cc126e0243e76 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 2 Nov 2023 00:33:39 +0200 Subject: SL-20523 Local textures not updating on PBR Materials #4 --- indra/llprimitive/llgltfmaterial.cpp | 27 +++++++++++++-------------- indra/llprimitive/llgltfmaterial.h | 12 ++++++------ 2 files changed, 19 insertions(+), 20 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index e590b14656..3945be3254 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -89,8 +89,7 @@ LLGLTFMaterial& LLGLTFMaterial::operator=(const LLGLTFMaterial& rhs) mOverrideDoubleSided = rhs.mOverrideDoubleSided; mOverrideAlphaMode = rhs.mOverrideAlphaMode; - mLocalTextureIds = rhs.mLocalTextureIds; - mLocalTextureTrackingIds = rhs.mLocalTextureTrackingIds; + mTrackingIdToLocalTexture = rhs.mTrackingIdToLocalTexture; updateTextureTracking(); @@ -606,6 +605,8 @@ void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat) mTextureTransform[i].mRotation = override_mat.mTextureTransform[i].mRotation; } } + + mTrackingIdToLocalTexture.insert(override_mat.mTrackingIdToLocalTexture.begin(), override_mat.mTrackingIdToLocalTexture.begin()); } void LLGLTFMaterial::getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& data) @@ -781,17 +782,15 @@ void LLGLTFMaterial::removeTextureEntry(LLTextureEntry* te) void LLGLTFMaterial::addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id) { - mLocalTextureTrackingIds.insert(tracking_id); - mLocalTextureIds.insert(tex_id); + mTrackingIdToLocalTexture[tracking_id] = tex_id; } -void LLGLTFMaterial::removeLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id) +void LLGLTFMaterial::removeLocalTextureTracking(const LLUUID& tracking_id) { - mLocalTextureTrackingIds.erase(tracking_id); - mLocalTextureIds.erase(tex_id); + mTrackingIdToLocalTexture.erase(tracking_id); } -bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& old_id, const LLUUID& new_id) +bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& tracking_id, const LLUUID& old_id, const LLUUID& new_id) { bool res = false; @@ -804,10 +803,13 @@ bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& old_id, const LLUUID& new } } - mLocalTextureIds.erase(old_id); if (res) { - mLocalTextureIds.insert(new_id); + mTrackingIdToLocalTexture[tracking_id] = new_id; + } + else + { + mTrackingIdToLocalTexture.erase(tracking_id); } return res; @@ -815,8 +817,5 @@ bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& old_id, const LLUUID& new void LLGLTFMaterial::updateTextureTracking() { - if (mLocalTextureTrackingIds.size() > 0) - { - LL_WARNS() << "copied a material with local textures, but tracking not implemented" << LL_ENDL; - } + // setTEGLTFMaterialOverride is responsible for tracking } diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index 2a9ef3ffe0..7b38663307 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -196,7 +196,7 @@ public: // write to given tinygltf::Model void writeToModel(tinygltf::Model& model, S32 mat_index) const; - void applyOverride(const LLGLTFMaterial& override_mat); + virtual void applyOverride(const LLGLTFMaterial& override_mat); // apply the given LLSD override data void applyOverrideLLSD(const LLSD& data); @@ -224,13 +224,13 @@ public: // For local textures so that editor will know to track changes void addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID &tex_id); - void removeLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id); - bool hasLocalTextures() { return !mLocalTextureIds.empty(); } - virtual bool replaceLocalTexture(const LLUUID &old_id, const LLUUID& new_id); + void removeLocalTextureTracking(const LLUUID& tracking_id); + bool hasLocalTextures() { return !mTrackingIdToLocalTexture.empty(); } + virtual bool replaceLocalTexture(const LLUUID& tracking_id, const LLUUID &old_id, const LLUUID& new_id); virtual void updateTextureTracking(); - uuid_set_t mLocalTextureIds; - uuid_set_t mLocalTextureTrackingIds; + typedef std::map local_tex_map_t; + local_tex_map_t mTrackingIdToLocalTexture; std::set mTextureEntires; protected: -- cgit v1.2.3 From 0d8893822d8975194313e940914afc8945754a21 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 2 Nov 2023 23:49:55 +0200 Subject: SL-20523 Local textures not updating on PBR Materials #5 --- indra/llprimitive/llgltfmaterial.cpp | 12 +++--------- indra/llprimitive/llgltfmaterial.h | 6 +++--- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index 3945be3254..390110b0ec 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -607,6 +607,8 @@ void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat) } mTrackingIdToLocalTexture.insert(override_mat.mTrackingIdToLocalTexture.begin(), override_mat.mTrackingIdToLocalTexture.begin()); + + updateTextureTracking(); } void LLGLTFMaterial::getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& data) @@ -771,15 +773,6 @@ LLUUID LLGLTFMaterial::getHash() const return hash; } -void LLGLTFMaterial::addTextureEntry(LLTextureEntry* te) -{ - mTextureEntires.insert(te); -} -void LLGLTFMaterial::removeTextureEntry(LLTextureEntry* te) -{ - mTextureEntires.erase(te); -} - void LLGLTFMaterial::addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id) { mTrackingIdToLocalTexture[tracking_id] = tex_id; @@ -818,4 +811,5 @@ bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& tracking_id, const LLUUID void LLGLTFMaterial::updateTextureTracking() { // setTEGLTFMaterialOverride is responsible for tracking + // for material overrides editor will set it } diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index 7b38663307..02f62fb08c 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -219,8 +219,8 @@ public: // For local materials, they have to keep track of where // they are assigned to for full updates - virtual void addTextureEntry(LLTextureEntry* te); - virtual void removeTextureEntry(LLTextureEntry* te); + virtual void addTextureEntry(LLTextureEntry* te) {}; + virtual void removeTextureEntry(LLTextureEntry* te) {}; // For local textures so that editor will know to track changes void addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID &tex_id); @@ -229,9 +229,9 @@ public: virtual bool replaceLocalTexture(const LLUUID& tracking_id, const LLUUID &old_id, const LLUUID& new_id); virtual void updateTextureTracking(); + // These fields are local to viewer and are a part of local bitmap support typedef std::map local_tex_map_t; local_tex_map_t mTrackingIdToLocalTexture; - std::set mTextureEntires; protected: static LLVector2 vec2FromJson(const std::map& object, const char* key, const LLVector2& default_value); -- cgit v1.2.3 From cc089d88ad5ab9088a5036e1d6f301d87cb3b127 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 3 Nov 2023 21:07:46 +0200 Subject: SL-20523 Ensure override gets updated before render material --- indra/llprimitive/llgltfmaterial.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index 390110b0ec..d2c911a189 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -794,6 +794,10 @@ bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& tracking_id, const LLUUID mTextureId[i] = new_id; res = true; } + else if (mTextureId[i] == new_id) + { + res = true; + } } if (res) -- cgit v1.2.3 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 + indra/llprimitive/llprimitive.cpp | 36 ------------------------------------ indra/llprimitive/llprimitive.h | 5 +---- 3 files changed, 2 insertions(+), 40 deletions(-) (limited to 'indra/llprimitive') 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"]; diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 350d84ae6c..904747af2d 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -2376,42 +2376,6 @@ void LLRenderMaterialParams::copy(const LLNetworkData& data) mEntries = param.mEntries; } -LLSD LLRenderMaterialParams::asLLSD() const -{ - LLSD ret; - - for (int i = 0; i < mEntries.size(); ++i) - { - ret[i]["te_idx"] = mEntries[i].te_idx; - ret[i]["id"] = mEntries[i].id; - } - - return ret; -} - -bool LLRenderMaterialParams::fromLLSD(LLSD& sd) -{ - if (sd.isArray()) - { - mEntries.resize(sd.size()); - for (int i = 0; i < sd.size(); ++i) - { - if (sd[i].has("te_idx") && sd.has("id")) - { - mEntries[i].te_idx = sd[i]["te_idx"].asInteger(); - mEntries[i].id = sd[i]["id"].asUUID(); - } - else - { - return false; - } - } - - return true; - } - - return false; -} void LLRenderMaterialParams::setMaterial(U8 te, const LLUUID& id) { diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index d2adfa4a3d..0b7dbd703a 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -382,10 +382,7 @@ public: BOOL unpack(LLDataPacker& dp) override; bool operator==(const LLNetworkData& data) const override; void copy(const LLNetworkData& data) override; - LLSD asLLSD() const; - operator LLSD() const { return asLLSD(); } - bool fromLLSD(LLSD& sd); - + void setMaterial(U8 te_idx, const LLUUID& id); const LLUUID& getMaterial(U8 te_idx) const; -- cgit v1.2.3 From 843866d193a0fb5ea882408c8862335ab9c5539b Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 13 Nov 2023 13:12:48 -0600 Subject: Drtvwr 596 11/8/2023 (#501) * SL-20570 Fix for lossy (and square) normal maps when importing GLTF materials. * SL-20582 Fix for overriding to alpha mode blend not working. Incidental decruft of dead code (thanks, Rye!) --- indra/llprimitive/llgltfmaterial.cpp | 1 + indra/llprimitive/llprimitive.cpp | 36 ------------------------------------ indra/llprimitive/llprimitive.h | 5 +---- 3 files changed, 2 insertions(+), 40 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index d2c911a189..ae165f7fa4 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -723,6 +723,7 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data) if (am.isInteger()) { mAlphaMode = (AlphaMode) am.asInteger(); + mOverrideAlphaMode = true; } const LLSD& ac = data["ac"]; diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 350d84ae6c..904747af2d 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -2376,42 +2376,6 @@ void LLRenderMaterialParams::copy(const LLNetworkData& data) mEntries = param.mEntries; } -LLSD LLRenderMaterialParams::asLLSD() const -{ - LLSD ret; - - for (int i = 0; i < mEntries.size(); ++i) - { - ret[i]["te_idx"] = mEntries[i].te_idx; - ret[i]["id"] = mEntries[i].id; - } - - return ret; -} - -bool LLRenderMaterialParams::fromLLSD(LLSD& sd) -{ - if (sd.isArray()) - { - mEntries.resize(sd.size()); - for (int i = 0; i < sd.size(); ++i) - { - if (sd[i].has("te_idx") && sd.has("id")) - { - mEntries[i].te_idx = sd[i]["te_idx"].asInteger(); - mEntries[i].id = sd[i]["id"].asUUID(); - } - else - { - return false; - } - } - - return true; - } - - return false; -} void LLRenderMaterialParams::setMaterial(U8 te, const LLUUID& id) { diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index d2adfa4a3d..0b7dbd703a 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -382,10 +382,7 @@ public: BOOL unpack(LLDataPacker& dp) override; bool operator==(const LLNetworkData& data) const override; void copy(const LLNetworkData& data) override; - LLSD asLLSD() const; - operator LLSD() const { return asLLSD(); } - bool fromLLSD(LLSD& sd); - + void setMaterial(U8 te_idx, const LLUUID& id); const LLUUID& getMaterial(U8 te_idx) const; -- 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') 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 From f35127faa03b438b5348c56c9e04b7b1a2c698ea Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Mon, 20 Nov 2023 10:18:27 -0500 Subject: Fix failure to save the normalized translation data during collada upload --- indra/llprimitive/lldaeloader.cpp | 3 ++- indra/llprimitive/llmodel.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 46e1cb4922..2e4b013b77 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -2584,7 +2584,8 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector& mo next->mLabel = model_name + (char)((int)'a' + next->mSubmodelID) + lod_suffix[mLod]; next->getVolumeFaces() = remainder; next->mNormalizedScale = ret->mNormalizedScale; - + next->mNormalizedTranslation = ret->mNormalizedTranslation; + if ( ret->mMaterialList.size() > LL_SCULPT_MESH_MAX_FACES) { next->mMaterialList.assign(ret->mMaterialList.begin() + LL_SCULPT_MESH_MAX_FACES, ret->mMaterialList.end()); diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index ee493968de..99a5697a84 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -52,7 +52,8 @@ const int MODEL_NAMES_LENGTH = sizeof(model_names) / sizeof(std::string); LLModel::LLModel(LLVolumeParams& params, F32 detail) : LLVolume(params, detail), - mNormalizedScale(1,1,1), + mNormalizedScale(1,1,1), + mNormalizedTranslation(0, 0, 0), mPelvisOffset( 0.0f ), mStatus(NO_ERRORS), mSubmodelID(0) -- cgit v1.2.3