diff options
author | Sabrina Shanman <cosmic@lindenlab.com> | 2022-09-20 23:09:30 +0000 |
---|---|---|
committer | Sabrina Shanman <cosmic@lindenlab.com> | 2022-09-20 23:09:30 +0000 |
commit | 58c478f08a9a3f073b7ba8d55874e92d0fe4f373 (patch) | |
tree | 7c975309a1cb70a74e16b8fc1a736e8452555a46 | |
parent | a66a65e047fb662e35eaaa68de6da9e2786db8ed (diff) | |
parent | 3e807dbc29371218e48691a5c1cfd2384bd74030 (diff) |
Merged in SL-18001 (pull request #1137)
SL-18001: Update GLTF material when receiving LLRenderMaterialParams on updated object
Approved-by: Brad Kittenbrink
-rw-r--r-- | indra/newview/llviewerobject.cpp | 31 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e5a2385a2a..022c191a65 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -6236,6 +6236,14 @@ void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, BOOL LL_WARNS() << "Failed to send object extra parameters: " << param_type << LL_ENDL; } } + else + { + if (param_type == LLNetworkData::PARAMS_RENDER_MATERIAL) + { + const LLRenderMaterialParams* params = in_use ? (LLRenderMaterialParams*)getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL) : nullptr; + setRenderMaterialIDs(params, local_origin); + } + } } void LLViewerObject::setDrawableState(U32 state, BOOL recursive) @@ -7103,6 +7111,29 @@ void LLViewerObject::setRenderMaterialID(U8 te, const LLUUID& id) } } +void LLViewerObject::setRenderMaterialIDs(const LLRenderMaterialParams* material_params, bool local_origin) +{ + if (!local_origin) + { + const S32 num_tes = llmin((S32)getNumTEs(), (S32)getNumFaces()); // avatars have TEs but no faces + for (S32 te = 0; te < num_tes; ++te) + { + const LLUUID& id = material_params ? material_params->getMaterial(te) : LLUUID::null; + if (id.notNull()) + { + getTE(te)->setGLTFMaterial(gGLTFMaterialList.getMaterial(id)); + setHasRenderMaterialParams(true); + } + else + { + getTE(te)->setGLTFMaterial(nullptr); + } + } + faceMappingChanged(); + gPipeline.markTextured(mDrawable); + } +} + class ObjectPhysicsProperties : public LLHTTPNode { public: diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 109c96dc9c..680cfb9639 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -185,6 +185,7 @@ public: const LLUUID& getRenderMaterialID(U8 te) const; void setRenderMaterialID(U8 te, const LLUUID& id); + void setRenderMaterialIDs(const LLRenderMaterialParams* material_params, bool local_origin); virtual BOOL isHUDAttachment() const { return FALSE; } virtual BOOL isTempAttachment() const; |