summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolalpha.cpp
diff options
context:
space:
mode:
authorDebi King (Dessie) <dessie@lindenlab.com>2011-12-06 11:30:27 -0500
committerDebi King (Dessie) <dessie@lindenlab.com>2011-12-06 11:30:27 -0500
commit97a92deb18d09e030c0800107204d9776a3c6229 (patch)
tree16133351b0822937c5da1e7009e80e3157119d59 /indra/newview/lldrawpoolalpha.cpp
parentae2a1ea9f10dc9bf3cc5ef59f1428ea1e5fa6495 (diff)
parent95850eddfd26e85dcfa1dd6f71233b6e0bf08253 (diff)
reconciled .hgtags
Diffstat (limited to 'indra/newview/lldrawpoolalpha.cpp')
-rw-r--r--indra/newview/lldrawpoolalpha.cpp54
1 files changed, 33 insertions, 21 deletions
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 9719140a37..ddb7d3ceeb 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -54,7 +54,7 @@ static BOOL deferred_render = FALSE;
LLDrawPoolAlpha::LLDrawPoolAlpha(U32 type) :
LLRenderPass(type), current_shader(NULL), target_shader(NULL),
- simple_shader(NULL), fullbright_shader(NULL),
+ simple_shader(NULL), fullbright_shader(NULL), emissive_shader(NULL),
mColorSFactor(LLRender::BF_UNDEF), mColorDFactor(LLRender::BF_UNDEF),
mAlphaSFactor(LLRender::BF_UNDEF), mAlphaDFactor(LLRender::BF_UNDEF)
{
@@ -90,7 +90,7 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass)
{
LLFastTimer t(FTM_RENDER_GRASS);
gDeferredDiffuseAlphaMaskProgram.bind();
- gDeferredDiffuseAlphaMaskProgram.setAlphaRange(0.33f, 1.f);
+ gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f);
//render alpha masked objects
LLRenderPass::pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
@@ -136,7 +136,7 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
simple_shader = NULL;
fullbright_shader = NULL;
gObjectFullbrightAlphaMaskProgram.bind();
- gObjectFullbrightAlphaMaskProgram.setAlphaRange(0.33f, 1.f);
+ gObjectFullbrightAlphaMaskProgram.setMinimumAlpha(0.33f);
}
deferred_render = TRUE;
@@ -175,11 +175,13 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
{
simple_shader = &gObjectSimpleWaterAlphaMaskProgram;
fullbright_shader = &gObjectFullbrightWaterAlphaMaskProgram;
+ emissive_shader = &gObjectEmissiveWaterProgram;
}
else
{
simple_shader = &gObjectSimpleAlphaMaskProgram;
fullbright_shader = &gObjectFullbrightAlphaMaskProgram;
+ emissive_shader = &gObjectEmissiveProgram;
}
if (mVertexShaderLevel > 0)
@@ -230,14 +232,14 @@ void LLDrawPoolAlpha::render(S32 pass)
if (!LLPipeline::sRenderDeferred || !deferred_render)
{
simple_shader->bind();
- simple_shader->setAlphaRange(0.33f, 1.f);
+ simple_shader->setMinimumAlpha(0.33f);
pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
}
if (fullbright_shader)
{
fullbright_shader->bind();
- fullbright_shader->setAlphaRange(0.33f, 1.f);
+ fullbright_shader->setMinimumAlpha(0.33f);
}
pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
//LLGLSLShader::bindNoShader();
@@ -273,16 +275,16 @@ void LLDrawPoolAlpha::render(S32 pass)
if (LLPipeline::sImpostorRender)
{
fullbright_shader->bind();
- fullbright_shader->setAlphaRange(0.5f, 1.f);
+ fullbright_shader->setMinimumAlpha(0.5f);
simple_shader->bind();
- simple_shader->setAlphaRange(0.5f, 1.f);
+ simple_shader->setMinimumAlpha(0.5f);
}
else
{
fullbright_shader->bind();
- fullbright_shader->setAlphaRange(0.f, 1.f);
+ fullbright_shader->setMinimumAlpha(0.f);
simple_shader->bind();
- simple_shader->setAlphaRange(0.f, 1.f);
+ simple_shader->setMinimumAlpha(0.f);
}
}
else
@@ -319,20 +321,26 @@ void LLDrawPoolAlpha::render(S32 pass)
BOOL shaders = gPipeline.canUseVertexShaders();
if(shaders)
{
- gObjectFullbrightNonIndexedProgram.bind();
+ gHighlightProgram.bind();
}
else
{
gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));
}
- glColor4f(1,0,0,1);
+
+ gGL.diffuseColor4f(1,0,0,1);
+
LLViewerFetchedTexture::sSmokeImagep->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sSmokeImagep, TRUE) ;
renderAlphaHighlight(LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD0);
+
+ pushBatches(LLRenderPass::PASS_ALPHA_MASK, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, FALSE);
+ pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, FALSE);
+
if(shaders)
{
- gObjectFullbrightNonIndexedProgram.unbind();
+ gHighlightProgram.unbind();
}
}
}
@@ -472,8 +480,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
{
tex_setup = true;
gGL.getTexUnit(0)->activate();
- glMatrixMode(GL_TEXTURE);
- glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
+ gGL.matrixMode(LLRender::MM_TEXTURE);
+ gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
}
}
@@ -488,30 +496,34 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
// If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha.
- if (draw_glow_for_this_partition &&
- params.mGlowColor.mV[3] > 0)
+ if (current_shader &&
+ draw_glow_for_this_partition &&
+ params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
{
// install glow-accumulating blend mode
gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE, // don't touch color
LLRender::BF_ONE, LLRender::BF_ONE); // add to alpha (glow)
+ emissive_shader->bind();
+
// glow doesn't use vertex colors from the mesh data
- params.mVertexBuffer->setBuffer(mask & ~LLVertexBuffer::MAP_COLOR);
- glColor4ubv(params.mGlowColor.mV);
-
+ params.mVertexBuffer->setBuffer((mask & ~LLVertexBuffer::MAP_COLOR) | LLVertexBuffer::MAP_EMISSIVE);
+
// do the actual drawing, again
params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
// restore our alpha blend mode
gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
+
+ current_shader->bind();
}
if (tex_setup)
{
gGL.getTexUnit(0)->activate();
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
+ gGL.loadIdentity();
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
}
}
}