summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolalpha.cpp
diff options
context:
space:
mode:
authorDavid Parks <davep@lindenlab.com>2009-09-22 11:11:45 +0000
committerDavid Parks <davep@lindenlab.com>2009-09-22 11:11:45 +0000
commit536e38ad51b89808f26d8e3cd107fe093862d22a (patch)
tree230159ae9e319f5c419f1a643177b2bbb17d52c5 /indra/newview/lldrawpoolalpha.cpp
parent760adead96e62cab8f9cdacc6469773a87dfbc1a (diff)
Merging render-pipeline-6-qa-2 into viewer-2
Self reviewed.
Diffstat (limited to 'indra/newview/lldrawpoolalpha.cpp')
-rw-r--r--indra/newview/lldrawpoolalpha.cpp60
1 files changed, 40 insertions, 20 deletions
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 88f79fc1b9..a5a29dea7b 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -87,22 +87,23 @@ void LLDrawPoolAlpha::beginDeferredPass(S32 pass)
void LLDrawPoolAlpha::endDeferredPass(S32 pass)
{
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.4f);
+
+}
+
+void LLDrawPoolAlpha::renderDeferred(S32 pass)
+{
+ gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f);
{
LLFastTimer t(FTM_RENDER_GRASS);
gDeferredTreeProgram.bind();
LLGLEnable test(GL_ALPHA_TEST);
//render alpha masked objects
LLRenderPass::renderTexture(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask());
+ gDeferredTreeProgram.unbind();
}
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
-void LLDrawPoolAlpha::renderDeferred(S32 pass)
-{
-
-}
-
S32 LLDrawPoolAlpha::getNumPostDeferredPasses()
{
@@ -260,6 +261,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
{
BOOL initialized_lighting = FALSE;
BOOL light_enabled = TRUE;
+ S32 diffuse_channel = 0;
+
//BOOL is_particle = FALSE;
BOOL use_shaders = (LLPipeline::sUnderWaterRender && gPipeline.canUseVertexShaders())
|| gPipeline.canUseWindLightShadersOnObjects();
@@ -290,19 +293,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
LLRenderPass::applyModelMatrix(params);
- if (params.mTexture.notNull())
- {
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->bind(params.mTexture) ;
- params.mTexture->addTextureStats(params.mVSize);
- if (params.mTextureMatrix)
- {
- glMatrixMode(GL_TEXTURE);
- glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
- gPipeline.mTextureMatrixOps++;
- }
- }
-
if (params.mFullbright)
{
// Turn off lighting if it hasn't already been so.
@@ -343,11 +333,13 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
if (deferred_render && current_shader != NULL)
{
gPipeline.unbindDeferredShader(*current_shader);
+ diffuse_channel = 0;
}
current_shader = target_shader;
if (deferred_render)
{
gPipeline.bindDeferredShader(*current_shader);
+ diffuse_channel = current_shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
}
else
{
@@ -356,11 +348,12 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
}
else if (!use_shaders && current_shader != NULL)
{
- LLGLSLShader::bindNoShader();
if (deferred_render)
{
gPipeline.unbindDeferredShader(*current_shader);
+ diffuse_channel = 0;
}
+ LLGLSLShader::bindNoShader();
current_shader = NULL;
}
@@ -368,6 +361,24 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
{
params.mGroup->rebuildMesh();
}
+
+
+ if (params.mTexture.notNull())
+ {
+ gGL.getTexUnit(diffuse_channel)->bind(params.mTexture.get());
+ if(params.mTexture.notNull())
+ {
+ params.mTexture->addTextureStats(params.mVSize);
+ }
+ if (params.mTextureMatrix)
+ {
+ gGL.getTexUnit(0)->activate();
+ glMatrixMode(GL_TEXTURE);
+ glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
+ gPipeline.mTextureMatrixOps++;
+ }
+ }
+
params.mVertexBuffer->setBuffer(mask);
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
gPipeline.addTrianglesDrawn(params.mCount/3);
@@ -382,6 +393,15 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
}
}
+ if (deferred_render && current_shader != NULL)
+ {
+ gPipeline.unbindDeferredShader(*current_shader);
+ LLVertexBuffer::unbind();
+ LLGLState::checkStates();
+ LLGLState::checkTextureChannels();
+ LLGLState::checkClientArrays();
+ }
+
if (!light_enabled)
{
gPipeline.enableLightsDynamic();