diff options
author | Dave Parks <davep@lindenlab.com> | 2022-10-19 17:23:54 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-10-19 17:23:54 -0500 |
commit | 8741c05cc10d3f39f272bb4739e7313309539d07 (patch) | |
tree | 871d2340a7e22cce1504948a79a703811a084d5a /indra/newview/llviewerobject.cpp | |
parent | de4c018499ddaebbe466fb5a8938554a2d4a3b19 (diff) |
SL-18105 Hook up TE override material to render pipe by way of render material.
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r-- | indra/newview/llviewerobject.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index ccc1259c25..4923771a31 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4920,7 +4920,7 @@ void LLViewerObject::updateTEMaterialTextures(U8 te) mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_ALM, LLViewerTexture::LOD_TEXTURE); } - LLFetchedGLTFMaterial* mat = (LLFetchedGLTFMaterial*) getTE(te)->getGLTFMaterial(); + LLFetchedGLTFMaterial* mat = (LLFetchedGLTFMaterial*) getTE(te)->getGLTFRenderMaterial(); LLUUID mat_id = getRenderMaterialID(te); if (mat == nullptr && mat_id.notNull()) { @@ -5319,6 +5319,36 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri return retval; } +S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_mat) +{ + S32 retval = TEM_CHANGE_NONE; + + LLTextureEntry* tep = getTE(te); + if (!tep) + { + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; + return retval; + } + + LLFetchedGLTFMaterial* src_mat = (LLFetchedGLTFMaterial*) tep->getGLTFMaterial(); + + tep->setGLTFMaterialOverride(override_mat); + + if (override_mat && src_mat) + { + LLFetchedGLTFMaterial* render_mat = new LLFetchedGLTFMaterial(*src_mat); + render_mat->applyOverride(*override_mat); + tep->setGLTFRenderMaterial(render_mat); + retval = TEM_CHANGE_TEXTURE; + } + else if (tep->setGLTFRenderMaterial(nullptr)) + { + retval = TEM_CHANGE_TEXTURE; + } + + return retval; +} + void LLViewerObject::refreshMaterials() { setChanged(TEXTURE); |