diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llface.cpp | 16 | ||||
-rwxr-xr-x | indra/newview/llvovolume.cpp | 19 |
2 files changed, 18 insertions, 17 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 2182b619be..dc74f4a6ef 100755 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1303,15 +1303,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } if (shiny_in_alpha) - { - - GLfloat alpha[4] = { - 0.00f, - 0.25f, - 0.5f, - 0.75f - }; + + static const GLfloat alpha[4] = + { + 0.00f, + 0.25f, + 0.5f, + 0.75f + }; llassert(tep->getShiny() <= 3); color.mV[3] = U8 (alpha[tep->getShiny()] * 255); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 35893a0354..f2199b5189 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2040,18 +2040,19 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { - S32 res = 0; - - if (pMaterialParams && getTEImage(te) && 3 == getTEImage(te)->getComponents() && pMaterialParams->getDiffuseAlphaMode()) - { - LLViewerObject::setTEMaterialID(te, LLMaterialID::null); - res = LLViewerObject::setTEMaterialParams(te, NULL); - } - else + if(pMaterialParams) { - res = LLViewerObject::setTEMaterialParams(te, 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() + ); } + S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); + LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this), te) ? " selected" : " not selected" ) << LL_ENDL; |