diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llpanelface.h | 15 | ||||
-rwxr-xr-x | indra/newview/llviewerobject.cpp | 24 | ||||
-rwxr-xr-x | indra/newview/llviewerobject.h | 2 |
3 files changed, 40 insertions, 1 deletions
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 834ad9e14c..06a45644d0 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -255,7 +255,20 @@ private: // Determine correct alpha mode for current diffuse texture // (i.e. does it have an alpha channel that makes alpha mode useful) // - U8 default_alpha_mode = (_panel->isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + // _panel->isAlpha() "lies" when one face has alpha and the rest do not (NORSPEC-329) + // need to get per-face answer to this question for sane alpha mode retention on updates. + // + U8 default_alpha_mode = object->isImageAlphaBlended(face) ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE; + + if (!current_material.isNull()) + { + default_alpha_mode = current_material->getDiffuseAlphaMode(); + } + + // Insure we don't inherit the default of blend by accident... + // this will be stomped by a legit request to change the alpha mode by the apply() below + // + new_material->setDiffuseAlphaMode(default_alpha_mode); // Do "It"! // diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index f29a00e4c4..0070240803 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4517,6 +4517,30 @@ LLViewerTexture *LLViewerObject::getTEImage(const U8 face) const } +bool LLViewerObject::isImageAlphaBlended(const U8 te) const +{ + LLViewerTexture* image = getTEImage(te); + LLGLenum format = image ? image->getPrimaryFormat() : GL_RGB; + switch (format) + { + case GL_RGBA: + case GL_ALPHA: + { + return true; + } + break; + + case GL_RGB: break; + default: + { + llwarns << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << llendl; + } + break; + } + + return false; +} + LLViewerTexture *LLViewerObject::getTENormalMap(const U8 face) const { // llassert(mTEImages); diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index ea0d55cda5..16f1f403d3 100755 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -339,6 +339,8 @@ public: LLViewerTexture *getTENormalMap(const U8 te) const; LLViewerTexture *getTESpecularMap(const U8 te) const; + bool isImageAlphaBlended(const U8 te) const; + void fitFaceTexture(const U8 face); void sendTEUpdate() const; // Sends packed representation of all texture entry information |