summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolbump.cpp
diff options
context:
space:
mode:
authorDave SIMmONs <simon@lindenlab.com>2011-06-29 11:36:19 -0700
committerDave SIMmONs <simon@lindenlab.com>2011-06-29 11:36:19 -0700
commitcc73cf15e6c2a361df278cb0b66c4d68c6acfbcd (patch)
tree27140b901d74acd106c5fc4c7a96a2e578635347 /indra/newview/lldrawpoolbump.cpp
parent1fbf3e0ec297004879d766cad11c5e9e15b86d4b (diff)
parenta300902494f76b9542c3978c2ca80726cefbc942 (diff)
Merge latest from lindenlab/viewer-development
Diffstat (limited to 'indra/newview/lldrawpoolbump.cpp')
-rw-r--r--indra/newview/lldrawpoolbump.cpp102
1 files changed, 72 insertions, 30 deletions
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 2f76baaaf7..813b3820ee 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -316,6 +316,9 @@ void LLDrawPoolBump::endRenderPass(S32 pass)
llassert(0);
break;
}
+
+ //to cleanup texture channels
+ LLRenderPass::endRenderPass(pass);
}
//static
@@ -354,6 +357,11 @@ void LLDrawPoolBump::beginShiny(bool invisible)
}
bindCubeMap(shader, mVertexShaderLevel, diffuse_channel, cube_channel, invisible);
+
+ if (mVertexShaderLevel > 1)
+ { //indexed texture rendering, channel 0 is always diffuse
+ diffuse_channel = 0;
+ }
}
//static
@@ -421,16 +429,16 @@ void LLDrawPoolBump::renderShiny(bool invisible)
LLGLEnable blend_enable(GL_BLEND);
if (!invisible && mVertexShaderLevel > 1)
{
- LLRenderPass::renderTexture(LLRenderPass::PASS_SHINY, sVertexMask);
+ LLRenderPass::pushBatches(LLRenderPass::PASS_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
}
else if (!invisible)
{
renderGroups(LLRenderPass::PASS_SHINY, sVertexMask);
}
- else // invisible
- {
- renderGroups(LLRenderPass::PASS_INVISI_SHINY, sVertexMask);
- }
+ //else // invisible (deprecated)
+ //{
+ //renderGroups(LLRenderPass::PASS_INVISI_SHINY, sVertexMask);
+ //}
}
}
@@ -529,6 +537,12 @@ void LLDrawPoolBump::beginFullbrightShiny()
gGL.getTexUnit(cube_channel)->bind(cube_map);
gGL.getTexUnit(0)->activate();
}
+
+ if (mVertexShaderLevel > 1)
+ { //indexed texture rendering, channel 0 is always diffuse
+ diffuse_channel = 0;
+ }
+
mShiny = TRUE;
}
@@ -543,7 +557,15 @@ void LLDrawPoolBump::renderFullbrightShiny()
if( gSky.mVOSkyp->getCubeMap() )
{
LLGLEnable blend_enable(GL_BLEND);
- LLRenderPass::renderTexture(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask);
+
+ if (mVertexShaderLevel > 1)
+ {
+ LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
+ }
+ else
+ {
+ LLRenderPass::renderTexture(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask);
+ }
}
}
@@ -843,6 +865,9 @@ void LLDrawPoolBump::endPostDeferredPass(S32 pass)
endBump(LLRenderPass::PASS_POST_BUMP);
break;
}
+
+ //to disable texture channels
+ LLRenderPass::endRenderPass(pass);
}
void LLDrawPoolBump::renderPostDeferred(S32 pass)
@@ -1300,43 +1325,60 @@ void LLDrawPoolBump::renderBump(U32 type, U32 mask)
}
}
-void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
+void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures)
{
applyModelMatrix(params);
- if (params.mTextureMatrix)
+ bool tex_setup = false;
+
+ if (batch_textures && params.mTextureList.size() > 1)
{
- if (mShiny)
+ for (U32 i = 0; i < params.mTextureList.size(); ++i)
{
- gGL.getTexUnit(0)->activate();
- glMatrixMode(GL_TEXTURE);
+ if (params.mTextureList[i].notNull())
+ {
+ gGL.getTexUnit(i)->bind(params.mTextureList[i], TRUE);
+ }
}
- else
+ }
+ else
+ { //not batching textures or batch has only 1 texture -- might need a texture matrix
+ if (params.mTextureMatrix)
{
- gGL.getTexUnit(1)->activate();
- glMatrixMode(GL_TEXTURE);
+ if (mShiny)
+ {
+ gGL.getTexUnit(0)->activate();
+ glMatrixMode(GL_TEXTURE);
+ }
+ else
+ {
+ gGL.getTexUnit(1)->activate();
+ glMatrixMode(GL_TEXTURE);
+ glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
+ gPipeline.mTextureMatrixOps++;
+ gGL.getTexUnit(0)->activate();
+ }
+
glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
gPipeline.mTextureMatrixOps++;
- gGL.getTexUnit(0)->activate();
- }
-
- glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix);
- gPipeline.mTextureMatrixOps++;
- }
- if (mShiny && mVertexShaderLevel > 1 && texture)
- {
- if (params.mTexture.notNull())
- {
- gGL.getTexUnit(diffuse_channel)->bind(params.mTexture) ;
- params.mTexture->addTextureStats(params.mVSize);
+ tex_setup = true;
}
- else
+
+ if (mShiny && mVertexShaderLevel > 1 && texture)
{
- gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
+ if (params.mTexture.notNull())
+ {
+ gGL.getTexUnit(diffuse_channel)->bind(params.mTexture) ;
+ params.mTexture->addTextureStats(params.mVSize);
+ }
+ else
+ {
+ gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
+ }
}
}
-
+
if (params.mGroup)
{
params.mGroup->rebuildMesh();
@@ -1344,7 +1386,7 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture)
params.mVertexBuffer->setBuffer(mask);
params.mVertexBuffer->drawRange(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
- if (params.mTextureMatrix)
+ if (tex_setup)
{
if (mShiny)
{