diff options
Diffstat (limited to 'indra/newview/lldrawpoolterrain.cpp')
-rw-r--r-- | indra/newview/lldrawpoolterrain.cpp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index b716a76543..e676b8d9f9 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -48,6 +48,7 @@ #include "pipeline.h" #include "llviewershadermgr.h" #include "llrender.h" +#include "llenvironment.h" const F32 DETAIL_SCALE = 1.f/16.f; int DebugDetailMap = 0; @@ -110,7 +111,7 @@ U32 LLDrawPoolTerrain::getVertexDataMask() void LLDrawPoolTerrain::prerender() { - mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); + mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT); sDetailMode = gSavedSettings.getS32("RenderTerrainDetail"); } @@ -123,7 +124,7 @@ void LLDrawPoolTerrain::beginRenderPass( S32 pass ) &gTerrainWaterProgram : &gTerrainProgram; - if (mVertexShaderLevel > 1 && sShader->mShaderLevel > 0) + if (mShaderLevel > 1 && sShader->mShaderLevel > 0) { sShader->bind(); } @@ -134,7 +135,7 @@ void LLDrawPoolTerrain::endRenderPass( S32 pass ) LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); //LLFacePool::endRenderPass(pass); - if (mVertexShaderLevel > 1 && sShader->mShaderLevel > 0) { + if (mShaderLevel > 1 && sShader->mShaderLevel > 0) { sShader->unbind(); } } @@ -145,6 +146,18 @@ S32 LLDrawPoolTerrain::getDetailMode() return sDetailMode; } +void LLDrawPoolTerrain::boostTerrainDetailTextures() +{ + // Hack! Get the region that this draw pool is rendering from! + LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); + LLVLComposition *compp = regionp->getComposition(); + for (S32 i = 0; i < 4; i++) + { + compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); + compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area + } +} + void LLDrawPoolTerrain::render(S32 pass) { LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); @@ -154,14 +167,7 @@ void LLDrawPoolTerrain::render(S32 pass) return; } - // Hack! Get the region that this draw pool is rendering from! - LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion(); - LLVLComposition *compp = regionp->getComposition(); - for (S32 i = 0; i < 4; i++) - { - compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN); - compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area - } + boostTerrainDetailTextures(); LLOverrideFaceColor override(this, 1.f, 1.f, 1.f, 1.f); @@ -180,7 +186,7 @@ void LLDrawPoolTerrain::render(S32 pass) LLGLSPipeline gls; - if (mVertexShaderLevel > 1 && sShader->mShaderLevel > 0) + if (mShaderLevel > 1 && sShader->mShaderLevel > 0) { gPipeline.enableLightsDynamic(); @@ -216,7 +222,7 @@ void LLDrawPoolTerrain::beginDeferredPass(S32 pass) LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); LLFacePool::beginRenderPass(pass); - sShader = &gDeferredTerrainProgram; + sShader = LLPipeline::sUnderWaterRender ? &gDeferredTerrainWaterProgram : &gDeferredTerrainProgram; sShader->bind(); } @@ -236,6 +242,8 @@ void LLDrawPoolTerrain::renderDeferred(S32 pass) return; } + boostTerrainDetailTextures(); + renderFullShader(); // Special-case for land ownership feedback @@ -252,6 +260,9 @@ void LLDrawPoolTerrain::beginShadowPass(S32 pass) LLFacePool::beginRenderPass(pass); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gDeferredShadowProgram.bind(); + + LLEnvironment& environment = LLEnvironment::instance(); + gDeferredShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); } void LLDrawPoolTerrain::endShadowPass(S32 pass) @@ -434,7 +445,7 @@ void LLDrawPoolTerrain::renderFullShader() void LLDrawPoolTerrain::hilightParcelOwners() { - if (mVertexShaderLevel > 1) + if (mShaderLevel > 1) { //use fullbright shader for highlighting LLGLSLShader* old_shader = sShader; sShader->unbind(); |