summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolbump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lldrawpoolbump.cpp')
-rw-r--r--indra/newview/lldrawpoolbump.cpp109
1 files changed, 70 insertions, 39 deletions
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 813b3820ee..0742250b0b 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -155,6 +155,7 @@ void LLStandardBumpmap::addstandard()
LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id));
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL );
+ gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ;
LLStandardBumpmap::sStandardBumpmapCount++;
}
@@ -464,11 +465,15 @@ void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32&
}
}
}
- gGL.getTexUnit(diffuse_channel)->disable();
- gGL.getTexUnit(cube_channel)->disable();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+ if (!LLGLSLShader::sNoFixedFunction)
+ {
+ gGL.getTexUnit(diffuse_channel)->disable();
+ gGL.getTexUnit(cube_channel)->disable();
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+ }
}
void LLDrawPoolBump::endShiny(bool invisible)
@@ -583,19 +588,19 @@ void LLDrawPoolBump::endFullbrightShiny()
cube_map->disable();
cube_map->restoreMatrix();
- if (diffuse_channel != 0)
+ /*if (diffuse_channel != 0)
{
shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
}
gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);*/
shader->unbind();
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+ //gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+ //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ //gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
diffuse_channel = -1;
cube_channel = 0;
@@ -706,36 +711,44 @@ void LLDrawPoolBump::beginBump(U32 pass)
// Optional second pass: emboss bump map
stop_glerror();
- // TEXTURE UNIT 0
- // Output.rgb = texture at texture coord 0
- gGL.getTexUnit(0)->activate();
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gObjectBumpProgram.bind();
+ }
+ else
+ {
+ // TEXTURE UNIT 0
+ // Output.rgb = texture at texture coord 0
+ gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
- gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
+ gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
+ gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
- // TEXTURE UNIT 1
- gGL.getTexUnit(1)->activate();
+ // TEXTURE UNIT 1
+ gGL.getTexUnit(1)->activate();
- gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
+
+ gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD_SIGNED, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_ONE_MINUS_TEX_ALPHA);
+ gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
- gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD_SIGNED, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_ONE_MINUS_TEX_ALPHA);
- gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
+ // src = tex0 + (1 - tex1) - 0.5
+ // = (bump0/2 + 0.5) + (1 - (bump1/2 + 0.5)) - 0.5
+ // = (1 + bump0 - bump1) / 2
- // src = tex0 + (1 - tex1) - 0.5
- // = (bump0/2 + 0.5) + (1 - (bump1/2 + 0.5)) - 0.5
- // = (1 + bump0 - bump1) / 2
+ // Blend: src * dst + dst * src
+ // = 2 * src * dst
+ // = 2 * ((1 + bump0 - bump1) / 2) * dst [0 - 2 * dst]
+ // = (1 + bump0 - bump1) * dst.rgb
+ // = dst.rgb + dst.rgb * (bump0 - bump1)
+
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
+ }
- // Blend: src * dst + dst * src
- // = 2 * src * dst
- // = 2 * ((1 + bump0 - bump1) / 2) * dst [0 - 2 * dst]
- // = (1 + bump0 - bump1) * dst.rgb
- // = dst.rgb + dst.rgb * (bump0 - bump1)
gGL.setSceneBlendType(LLRender::BT_MULT_X2);
- gGL.getTexUnit(0)->activate();
stop_glerror();
-
- gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
}
//static
@@ -765,14 +778,21 @@ void LLDrawPoolBump::endBump(U32 pass)
return;
}
- // Disable texture unit 1
- gGL.getTexUnit(1)->activate();
- gGL.getTexUnit(1)->disable();
- gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT);
+ if (LLGLSLShader::sNoFixedFunction)
+ {
+ gObjectBumpProgram.unbind();
+ }
+ else
+ {
+ // Disable texture blending on unit 1
+ gGL.getTexUnit(1)->activate();
+ //gGL.getTexUnit(1)->disable();
+ gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT);
- // Disable texture unit 0
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+ // Disable texture blending on unit 0
+ gGL.getTexUnit(0)->activate();
+ gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+ }
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
@@ -1054,11 +1074,12 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText
if (!src_image->hasCallbacks())
{ //if image has no callbacks but resolutions don't match, trigger raw image loaded callback again
if (src_image->getWidth() != bump->getWidth() ||
- src_image->getHeight() != bump->getHeight() ||
- (LLPipeline::sRenderDeferred && bump->getComponents() != 4))
+ src_image->getHeight() != bump->getHeight())// ||
+ //(LLPipeline::sRenderDeferred && bump->getComponents() != 4))
{
src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
+ src_image->forceToSaveRawImage(0) ;
}
}
}
@@ -1407,6 +1428,11 @@ void LLDrawPoolInvisible::render(S32 pass)
{ //render invisiprims
LLFastTimer t(FTM_RENDER_INVISIBLE);
+ if (gPipeline.canUseVertexShaders())
+ {
+ gOcclusionProgram.bind();
+ }
+
U32 invisi_mask = LLVertexBuffer::MAP_VERTEX;
glStencilMask(0);
gGL.setColorMask(false, false);
@@ -1414,6 +1440,11 @@ void LLDrawPoolInvisible::render(S32 pass)
gGL.setColorMask(true, false);
glStencilMask(0xFFFFFFFF);
+ if (gPipeline.canUseVertexShaders())
+ {
+ gOcclusionProgram.unbind();
+ }
+
if (gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))
{
beginShiny(true);