diff options
author | ruslantproductengine <ruslantproductengine@lindenlab.com> | 2014-11-21 00:37:15 +0200 |
---|---|---|
committer | ruslantproductengine <ruslantproductengine@lindenlab.com> | 2014-11-21 00:37:15 +0200 |
commit | 16d0b87b3ce7b88069b08981791f470cf6703c64 (patch) | |
tree | 68432edaf6df9b947ca811e6726518aac2225d2a /indra/newview/llvovolume.cpp | |
parent | f0db860b8a08e076814f4a3586cdef7ead8acb9c (diff) |
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.
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rwxr-xr-x | indra/newview/llvovolume.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
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<LLMaterialPtr&>(pMaterialParams); + if(pMaterialParams) { LLViewerTexture* image = getTEImage(te); LLGLenum image_format = image ? image->getPrimaryFormat() : GL_RGB; LLMaterialPtr current_material = getTEMaterialParams(te); - const_cast<LLMaterialPtr&>(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<LLVOVolume*>(this), te) ? " selected" : " not selected" ) << LL_ENDL; setChanged(ALL_CHANGED); |