diff options
author | Brad Kittenbrink <brad@lindenlab.com> | 2022-04-27 14:48:25 -0700 |
---|---|---|
committer | Brad Kittenbrink <brad@lindenlab.com> | 2022-04-27 14:48:25 -0700 |
commit | c9fbd9e2e820ce4d5e62468f757ee0502fa93af1 (patch) | |
tree | 3614325566aa0e2ed73c29ac0ae3cf097ef91084 /indra/llprimitive/llprimitive.cpp | |
parent | 030d61ac58be38f9f8aafeb68b383d88d670080b (diff) |
SL-17116 work on implementing MaterialID in ExtraParams of ObjectUpdate and related messages
Diffstat (limited to 'indra/llprimitive/llprimitive.cpp')
-rw-r--r-- | indra/llprimitive/llprimitive.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 67c225d25d..c46e5fb3c5 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -39,6 +39,7 @@ #include "llsdutil_math.h" #include "llprimtexturelist.h" #include "llmaterialid.h" +#include "llsdutil.h" /** * exported constants @@ -1690,6 +1691,8 @@ BOOL LLNetworkData::isValid(U16 param_type, U32 size) return (size == 28); case PARAMS_EXTENDED_MESH: return (size == 4); + case PARAMS_RENDER_MATERIAL: + return (size == 16); } return FALSE; @@ -2181,3 +2184,69 @@ bool LLExtendedMeshParams::fromLLSD(LLSD& sd) return false; } + +//============================================================================ + +LLRenderMaterialParams::LLRenderMaterialParams() +{ + mType = PARAMS_RENDER_MATERIAL; +} + +BOOL LLRenderMaterialParams::pack(LLDataPacker &dp) const +{ + return dp.packUUID(mMaterial, "material"); + +// return TRUE; +} + +BOOL LLRenderMaterialParams::unpack(LLDataPacker &dp) +{ + return dp.unpackUUID(mMaterial, "material"); + +// return TRUE; +} + +bool LLRenderMaterialParams::operator==(const LLNetworkData& data) const +{ + if (data.mType != PARAMS_RENDER_MATERIAL) + { + return false; + } + + const LLRenderMaterialParams ¶m = static_cast<const LLRenderMaterialParams&>(data); + + return param.mMaterial == mMaterial; +} + +void LLRenderMaterialParams::copy(const LLNetworkData& data) +{ + llassert_always(data.mType == PARAMS_RENDER_MATERIAL); + const LLRenderMaterialParams ¶m = static_cast<const LLRenderMaterialParams&>(data); + mMaterial = param.mMaterial; +} + +LLSD LLRenderMaterialParams::asLLSD() const +{ + return llsd::map("material", mMaterial); +} + +bool LLRenderMaterialParams::fromLLSD(LLSD& sd) +{ + if (sd.has("material")) + { + setMaterial(sd["material"]); + return true; + } + + return false; +} + +void LLRenderMaterialParams::setMaterial(const LLUUID & id) +{ + mMaterial = id; +} + +LLUUID LLRenderMaterialParams::getMaterial() const +{ + return mMaterial; +} |