summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2013-05-06 15:44:44 -0500
committerDave Parks <davep@lindenlab.com>2013-05-06 15:44:44 -0500
commit18e3985120d53acdf07d43dce79312b78629e57a (patch)
treec4cf4cc69decbb3beeb910f8038d2d321e7f2d18 /indra/newview
parentdf6bb7ace2f2ca26f5fabf8305e190e7d0066cf1 (diff)
NORSPEC-162 Fix for objects with materials set ignoring "tranparency %" value.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lldrawpoolalpha.cpp2
-rw-r--r--indra/newview/llspatialpartition.cpp1
-rw-r--r--indra/newview/llspatialpartition.h2
-rw-r--r--indra/newview/llvovolume.cpp25
-rw-r--r--indra/newview/pipeline.cpp7
5 files changed, 30 insertions, 7 deletions
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 1912ae0c16..d5de5d30b0 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -481,7 +481,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
if (!params.mFullbright && deferred_render && mat)
{
- U32 mask = mat->getShaderMask();
+ U32 mask = params.mShaderMask;
llassert(mask < LLMaterial::SHADER_COUNT);
target_shader = &(gDeferredMaterialProgram[mask]);
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 6bb9d5f201..252f129133 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -4634,6 +4634,7 @@ LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset,
mDistance(0.f),
mDrawMode(LLRender::TRIANGLES),
mMaterial(NULL),
+ mShaderMask(0),
mSpecColor(1.0f, 1.0f, 1.0f, 0.5f),
mEnvIntensity(0.0f),
mAlphaMaskCutoff(0.5f),
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 7c0be549df..bf32440848 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -119,8 +119,8 @@ public:
LL_ALIGN_16(LLFace* mFace); //associated face
F32 mDistance;
U32 mDrawMode;
-
LLMaterialPtr mMaterial; // If this is null, the following parameters are unused.
+ U32 mShaderMask;
LLPointer<LLViewerTexture> mSpecularMap;
const LLMatrix4* mSpecularMapMatrix;
LLPointer<LLViewerTexture> mNormalMap;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 9b940300f5..637d40c5b5 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4088,6 +4088,21 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
bool batchable = false;
+ U32 shader_mask = 0xFFFFFFFF; //no shader
+
+ if (mat)
+ {
+ if (type == LLRenderPass::PASS_ALPHA)
+ {
+ shader_mask = mat->getShaderMask(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND);
+ }
+ else
+ {
+ shader_mask = mat->getShaderMask();
+ }
+ }
+
+
if (index < 255 && idx >= 0)
{
if (mat || draw_vec[idx]->mMaterial)
@@ -4124,7 +4139,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_vec[idx]->mBump == bump &&
draw_vec[idx]->mTextureMatrix == tex_mat &&
draw_vec[idx]->mModelMatrix == model_mat &&
- draw_vec[idx]->mMaterial == mat)
+ draw_vec[idx]->mMaterial == mat &&
+ draw_vec[idx]->mShaderMask == shader_mask)
{
draw_vec[idx]->mCount += facep->getIndicesCount();
draw_vec[idx]->mEnd += facep->getGeomCount();
@@ -4152,10 +4168,11 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
draw_vec.push_back(draw_info);
draw_info->mTextureMatrix = tex_mat;
draw_info->mModelMatrix = model_mat;
- if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred)
+ if (mat)
{
// We have a material. Update our draw info accordingly.
draw_info->mMaterial = mat;
+ draw_info->mShaderMask = shader_mask;
LLVector4 specColor;
specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f);
specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f);
@@ -5280,6 +5297,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
{
registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
}
+ else if (te->getColor().mV[3] < 0.999f)
+ {
+ registerFace(group, facep, LLRenderPass::PASS_ALPHA);
+ }
else
{
U32 pass[] =
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 4cce654f47..fd4e9dfc05 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1660,7 +1660,8 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
return 0;
}
- bool alpha = te->getColor().mV[3] < 0.999f;
+ bool color_alpha = te->getColor().mV[3] < 0.999f;
+ bool alpha = color_alpha;
if (imagep)
{
alpha = alpha || (imagep->getComponents() == 4 && imagep->getType() != LLViewerTexture::MEDIA_TEXTURE) || (imagep->getComponents() == 2);
@@ -1675,10 +1676,10 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
break;
case 0: //alpha mode set to none, never go to alpha pool
case 3: //alpha mode set to emissive, never go to alpha pool
- alpha = false;
+ alpha = color_alpha;
break;
default: //alpha mode set to "mask", go to alpha pool if fullbright
- alpha = false; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool.
+ alpha = color_alpha; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool.
break;
}
}