From 16d0b87b3ce7b88069b08981791f470cf6703c64 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Fri, 21 Nov 2014 00:37:15 +0200 Subject: MAINT-4092 FIXED Prim faces with opaque diffuse maps, with material set to ALPHA MODE BLEND, do not render Pathset #3. Fix problem with not existing UUID's and if have a "conflict" when material can't have DIFFUSE_ALPHA_MODE_BLEND and DIFFUSE_ALPHA_MODE_NONE simultaneously. --- indra/newview/llviewertexturelist.cpp | 2 +- indra/newview/llvovolume.cpp | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index b98726900f..322a55383a 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -622,7 +622,7 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image) { return; } - llassert(new_image); + //llassert(new_image); LLUUID image_id = new_image->getID(); LLViewerFetchedTexture *image = findImage(image_id); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index f2199b5189..6839bed761 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2040,20 +2040,32 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { + LLMaterialPtr pMaterial = const_cast(pMaterialParams); + if(pMaterialParams) { LLViewerTexture* image = getTEImage(te); LLGLenum image_format = image ? image->getPrimaryFormat() : GL_RGB; LLMaterialPtr current_material = getTEMaterialParams(te); - const_cast(pMaterialParams)->setDiffuseAlphaMode( - current_material.isNull() ? (GL_RGB == image_format ? LLMaterial::DIFFUSE_ALPHA_MODE_NONE : LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) - : current_material->getDiffuseAlphaMode() - ); + + U8 new_diffuse_alpha_mode = pMaterialParams->getDiffuseAlphaMode(); + + if(new_diffuse_alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + { + new_diffuse_alpha_mode = (GL_RGB == image_format || 0 == image_format ? LLMaterial::DIFFUSE_ALPHA_MODE_NONE : new_diffuse_alpha_mode); + } + + if(pMaterialParams->getDiffuseAlphaMode() != new_diffuse_alpha_mode) { + //create new material + pMaterial = new LLMaterial(pMaterialParams->asLLSD()); + pMaterial->setDiffuseAlphaMode(new_diffuse_alpha_mode); + LLMaterialMgr::getInstance()->put(getID(),te,*pMaterial); + } } - S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); + S32 res = LLViewerObject::setTEMaterialParams(te, pMaterial); - LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res + LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterial) ? pMaterial->asLLSD() : LLSD("null")) << " res " << res << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) << LL_ENDL; setChanged(ALL_CHANGED); -- cgit v1.2.3