summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rwxr-xr-xindra/newview/llvovolume.cpp40
1 files changed, 27 insertions, 13 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 66ee386874..b49543c158 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1742,6 +1742,8 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable)
}
}
}
+
+ genBBoxes(FALSE);
}
// it has its own drawable (it's moved) or it has changed UVs or it has changed xforms from global<->local
else
@@ -2040,19 +2042,32 @@ 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
+ LLMaterialPtr pMaterial = const_cast<LLMaterialPtr&>(pMaterialParams);
+
+ if(pMaterialParams)
{
- res = LLViewerObject::setTEMaterialParams(te, pMaterialParams);
+ LLViewerTexture* image = getTEImage(te);
+ LLGLenum image_format = image ? image->getPrimaryFormat() : GL_RGB;
+ LLMaterialPtr current_material = getTEMaterialParams(te);
+
+ 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);
+ }
}
- LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res
+ S32 res = LLViewerObject::setTEMaterialParams(te, pMaterial);
+
+ 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);
@@ -4960,7 +4975,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
facep->clearVertexBuffer();
}
}
-
+
if (is_rigged)
{
if (!drawablep->isState(LLDrawable::RIGGED))
@@ -4976,7 +4991,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
drawablep->clearState(LLDrawable::RIGGED);
}
-
}
}
@@ -5451,8 +5465,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac
flexi = flexi || facep->getViewerObject()->getVolume()->isUnique();
}
- }
}
+ }
if (flexi && buffer_usage && buffer_usage != GL_STREAM_DRAW_ARB)