diff options
author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-08-29 03:40:10 -0700 |
---|---|---|
committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-08-29 03:40:10 -0700 |
commit | c5bfe869154cd4708c9bca63f08cb4c958198638 (patch) | |
tree | 6f79db9976863b2c1ea0f20bbb4049ee0cc98c1c /indra/llprimitive | |
parent | fbecd348f897ee91a5639e7e9fe4f0578d72b8e2 (diff) | |
parent | 89f2165b4170d9fddc10a55292c28750093a22a0 (diff) |
Merge branch 'DRTVWR-559' into DRTVWR-583
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/llmaterial.cpp | 11 | ||||
-rw-r--r-- | indra/llprimitive/llmaterial.h | 2 | ||||
-rw-r--r-- | indra/llprimitive/llmaterialid.h | 26 |
3 files changed, 26 insertions, 13 deletions
diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp index f6cb3c8b70..0d146de949 100644 --- a/indra/llprimitive/llmaterial.cpp +++ b/indra/llprimitive/llmaterial.cpp @@ -332,17 +332,6 @@ void LLMaterial::setAlphaMaskCutoff(U8 cutoff) mAlphaMaskCutoff = cutoff; } -LLUUID LLMaterial::getMaterialID() const -{ - // TODO - not null - return LLUUID::null; -} - -void LLMaterial::setMaterialID(const LLUUID &material_id) -{ - // TODO - set -} - LLSD LLMaterial::asLLSD() const { LLSD material_data; diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index b46d85c2d1..81f41ddc51 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -115,8 +115,6 @@ public: void setDiffuseAlphaMode(U8 alpha_mode); U8 getAlphaMaskCutoff() const; void setAlphaMaskCutoff(U8 cutoff); - LLUUID getMaterialID() const; - void setMaterialID(LLUUID const & material_id); bool isNull() const; static const LLMaterial null; diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h index e6165dfc91..5eb463b0fd 100644 --- a/indra/llprimitive/llmaterialid.h +++ b/indra/llprimitive/llmaterialid.h @@ -67,6 +67,14 @@ public: static const LLMaterialID null; + // Returns a 64 bits digest of the material Id, by XORing its two 64 bits + // long words. HB + inline U64 getDigest64() const + { + U64* tmp = (U64*)mID; + return tmp[0] ^ tmp[1]; + } + private: void parseFromBinary(const LLSD::Binary& pMaterialID); void copyFromOtherMaterialID(const LLMaterialID& pOtherMaterialID); @@ -75,5 +83,23 @@ private: U8 mID[MATERIAL_ID_SIZE]; } ; +// std::hash implementation for LLMaterialID +namespace std +{ + template<> struct hash<LLMaterialID> + { + inline size_t operator()(const LLMaterialID& id) const noexcept + { + return (size_t)id.getDigest64(); + } + }; +} + +// For use with boost containers. +inline size_t hash_value(const LLMaterialID& id) noexcept +{ + return (size_t)id.getDigest64(); +} + #endif // LL_LLMATERIALID_H |