summaryrefslogtreecommitdiff
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
parentdf6bb7ace2f2ca26f5fabf8305e190e7d0066cf1 (diff)
NORSPEC-162 Fix for objects with materials set ignoring "tranparency %" value.
-rw-r--r--indra/llprimitive/llmaterial.cpp11
-rw-r--r--indra/llprimitive/llmaterial.h5
-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
7 files changed, 42 insertions, 11 deletions
diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp
index bd98aa040a..ce443dea1d 100644
--- a/indra/llprimitive/llmaterial.cpp
+++ b/indra/llprimitive/llmaterial.cpp
@@ -186,12 +186,19 @@ bool LLMaterial::operator != (const LLMaterial& rhs) const
}
-U32 LLMaterial::getShaderMask()
+U32 LLMaterial::getShaderMask(U32 alpha_mode)
{ //NEVER incorporate this value into the message system -- this function will vary depending on viewer implementation
U32 ret = 0;
//two least significant bits are "diffuse alpha mode"
- ret = getDiffuseAlphaMode();
+ if (alpha_mode != DIFFUSE_ALPHA_MODE_DEFAULT)
+ {
+ ret = alpha_mode;
+ }
+ else
+ {
+ ret = getDiffuseAlphaMode();
+ }
llassert(ret < SHADER_COUNT);
diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h
index b294288c64..b265732adc 100644
--- a/indra/llprimitive/llmaterial.h
+++ b/indra/llprimitive/llmaterial.h
@@ -44,7 +44,8 @@ public:
DIFFUSE_ALPHA_MODE_NONE = 0,
DIFFUSE_ALPHA_MODE_BLEND = 1,
DIFFUSE_ALPHA_MODE_MASK = 2,
- DIFFUSE_ALPHA_MODE_EMISSIVE = 3
+ DIFFUSE_ALPHA_MODE_EMISSIVE = 3,
+ DIFFUSE_ALPHA_MODE_DEFAULT = 4,
} eDiffuseAlphaMode;
typedef enum
@@ -100,7 +101,7 @@ public:
bool operator == (const LLMaterial& rhs) const;
bool operator != (const LLMaterial& rhs) const;
- U32 getShaderMask();
+ U32 getShaderMask(U32 alpha_mode = DIFFUSE_ALPHA_MODE_DEFAULT);
protected:
LLUUID mNormalID;
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;
}
}