diff options
author | Brad Kittenbrink <brad@lindenlab.com> | 2009-02-18 21:10:16 +0000 |
---|---|---|
committer | Brad Kittenbrink <brad@lindenlab.com> | 2009-02-18 21:10:16 +0000 |
commit | abdc99f21b542c4fea67030ddbd7166c9d1c6c63 (patch) | |
tree | 3e984e405adfdec189ca8a047daca5250737ffbf /indra/newview/lldrawpoolterrain.cpp | |
parent | 34412f0530cf6a411b4de906a8e9da59cbcb3a85 (diff) |
Merge of QAR-1267 to trunk. This was a combo merge of QAR-1175 (maint-render-9) and QAR-1236 (dll-msvcrt-2)
svn merge -r 109838:112264 svn+ssh://svn.lindenlab.com/svn/linden/branches/maint-render/maint-render-9-merge-r109833
Diffstat (limited to 'indra/newview/lldrawpoolterrain.cpp')
-rw-r--r-- | indra/newview/lldrawpoolterrain.cpp | 118 |
1 files changed, 76 insertions, 42 deletions
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 3080f99d9f..2c644b0fd5 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -74,14 +74,14 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerImage *texturep) : LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb")); gGL.getTexUnit(0)->bind(mAlphaRampImagep.get()); - mAlphaRampImagep->setClamp(TRUE, TRUE); + mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); m2DAlphaRampImagep = gImageList.getImageFromFile("alpha_gradient_2d.j2c", TRUE, TRUE, GL_ALPHA8, GL_ALPHA, LLUUID("38b86f85-2575-52a9-a531-23108d8da837")); gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); - m2DAlphaRampImagep->setClamp(TRUE, TRUE); + m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); mTexturep->setBoostLevel(LLViewerImage::BOOST_TERRAIN); @@ -100,6 +100,18 @@ LLDrawPool *LLDrawPoolTerrain::instancePool() } +U32 LLDrawPoolTerrain::getVertexDataMask() +{ + if (LLPipeline::sShadowRender) + { + return LLVertexBuffer::MAP_VERTEX; + } + else + { + return VERTEX_DATA_MASK; + } +} + void LLDrawPoolTerrain::prerender() { mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); @@ -217,6 +229,60 @@ void LLDrawPoolTerrain::render(S32 pass) } } +void LLDrawPoolTerrain::beginDeferredPass(S32 pass) +{ + LLFastTimer t(LLFastTimer::FTM_RENDER_TERRAIN); + LLFacePool::beginRenderPass(pass); + + sShader = &gDeferredTerrainProgram; + + sShader->bind(); +} + +void LLDrawPoolTerrain::endDeferredPass(S32 pass) +{ + LLFastTimer t(LLFastTimer::FTM_RENDER_TERRAIN); + LLFacePool::endRenderPass(pass); + sShader->unbind(); +} + +void LLDrawPoolTerrain::renderDeferred(S32 pass) +{ + LLFastTimer t(LLFastTimer::FTM_RENDER_TERRAIN); + if (mDrawFace.empty()) + { + return; + } + renderFullShader(); +} + +void LLDrawPoolTerrain::beginShadowPass(S32 pass) +{ + LLFastTimer t(LLFastTimer::FTM_SHADOW_TERRAIN); + LLFacePool::beginRenderPass(pass); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gDeferredShadowProgram.bind(); +} + +void LLDrawPoolTerrain::endShadowPass(S32 pass) +{ + LLFastTimer t(LLFastTimer::FTM_SHADOW_TERRAIN); + LLFacePool::endRenderPass(pass); + gDeferredShadowProgram.unbind(); +} + +void LLDrawPoolTerrain::renderShadow(S32 pass) +{ + LLFastTimer t(LLFastTimer::FTM_SHADOW_TERRAIN); + if (mDrawFace.empty()) + { + return; + } + //LLGLEnable offset(GL_POLYGON_OFFSET); + //glCullFace(GL_FRONT); + drawLoop(); + //glCullFace(GL_BACK); +} void LLDrawPoolTerrain::renderFullShader() { @@ -360,9 +426,6 @@ void LLDrawPoolTerrain::renderFullShader() void LLDrawPoolTerrain::renderFull4TU() { - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_NORMAL_ARRAY); - // Hack! Get the region that this draw pool is rendering from! LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); LLVLComposition *compp = regionp->getComposition(); @@ -390,7 +453,6 @@ void LLDrawPoolTerrain::renderFull4TU() // gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->bind(detail_texture0p); - glClientActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); @@ -409,9 +471,7 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(1)->bind(m2DAlphaRampImagep.get()); gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->activate(); - glClientActiveTextureARB(GL_TEXTURE1_ARB); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - + // Care about alpha only gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); @@ -423,9 +483,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(2)->activate(); - glClientActiveTextureARB(GL_TEXTURE2_ARB); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); @@ -441,14 +498,12 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(3)->bind(detail_texture1p); gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(3)->activate(); - glClientActiveTextureARB(GL_TEXTURE3_ARB); - + // Set alpha texture and do lighting modulation gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR); gGL.getTexUnit(0)->activate(); - glClientActiveTextureARB(GL_TEXTURE0_ARB); - + // GL_BLEND disabled by default drawLoop(); @@ -459,9 +514,7 @@ void LLDrawPoolTerrain::renderFull4TU() // gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->bind(detail_texture3p); - glClientActiveTextureARB(GL_TEXTURE0_ARB); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); @@ -477,9 +530,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(1)->bind(m2DAlphaRampImagep.get()); gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->activate(); - glClientActiveTextureARB(GL_TEXTURE1_ARB); - - glEnableClientState(GL_TEXTURE_COORD_ARRAY); // Set the texture matrix glMatrixMode(GL_TEXTURE); @@ -490,7 +540,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); - // // Stage 2: Interpolate detail2 with existing based on ramp // @@ -498,9 +547,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(2)->activate(); - glClientActiveTextureARB(GL_TEXTURE2_ARB); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); @@ -517,9 +563,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(3)->activate(); - glClientActiveTextureARB(GL_TEXTURE3_ARB); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - // Set the texture matrix glMatrixMode(GL_TEXTURE); glLoadIdentity(); @@ -530,7 +573,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(3)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); gGL.getTexUnit(0)->activate(); - glClientActiveTextureARB(GL_TEXTURE0_ARB); { LLGLEnable blend(GL_BLEND); drawLoop(); @@ -541,9 +583,7 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(3)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(3)->disable(); gGL.getTexUnit(3)->activate(); - glClientActiveTextureARB(GL_TEXTURE3_ARB); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - + glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); @@ -551,9 +591,7 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(2)->disable(); gGL.getTexUnit(2)->activate(); - glClientActiveTextureARB(GL_TEXTURE2_ARB); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - + glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glMatrixMode(GL_TEXTURE); @@ -563,9 +601,7 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->activate(); - glClientActiveTextureARB(GL_TEXTURE1_ARB); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - + glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); @@ -579,9 +615,7 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glClientActiveTextureARB(GL_TEXTURE0_ARB); - glDisableClientState(GL_NORMAL_ARRAY); - + glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glMatrixMode(GL_TEXTURE); @@ -856,7 +890,7 @@ void LLDrawPoolTerrain::renderOwnership() { LLFace *facep = *iter; facep->renderIndexed(LLVertexBuffer::MAP_VERTEX | - LLVertexBuffer::MAP_TEXCOORD); + LLVertexBuffer::MAP_TEXCOORD0); } glMatrixMode(GL_TEXTURE); |