From 894261862d9af0fd768003eee55407cff755ac5b Mon Sep 17 00:00:00 2001 From: Shyotl Date: Thu, 27 Mar 2014 22:31:47 -0500 Subject: [PATCH] Tweaks to stencil handling to allow masking out of sky (or geometry). Reset stencil clear value to 0 after done clearing. --- indra/newview/lldrawpoolwater.cpp | 1 + indra/newview/lldrawpoolwlsky.cpp | 1 + indra/newview/llmaniptranslate.cpp | 1 + indra/newview/llspatialpartition.cpp | 3 +++ indra/newview/pipeline.cpp | 1 + 5 files changed, 7 insertions(+) diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 0872f5f9d..12f91ea67 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -253,6 +253,7 @@ void LLDrawPoolWater::render(S32 pass) glClearStencil(1); glClear(GL_STENCIL_BUFFER_BIT); + glClearStencil(0); LLGLEnable gls_stencil(GL_STENCIL_TEST); glStencilOp(GL_KEEP, GL_REPLACE, GL_KEEP); glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF); diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 3d0762132..864975460 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -326,6 +326,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) const F32 camHeightLocal = LLWLParamManager::getInstance()->getDomeOffset() * LLWLParamManager::getInstance()->getDomeRadius(); + LLGLDisable stencil(GL_STENCIL_TEST); LLGLSNoFog disableFog; LLGLDepthTest depth(GL_TRUE, GL_FALSE); LLGLDisable clip(GL_CLIP_PLANE0); diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index bdbc132c5..f9a3b0cdd 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1676,6 +1676,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, glStencilMask(stencil_mask); glClearStencil(1); glClear(GL_STENCIL_BUFFER_BIT); + glClearStencil(0); LLGLEnable cull_face(GL_CULL_FACE); LLGLEnable stencil(GL_STENCIL_TEST); LLGLDepthTest depth (GL_TRUE, GL_FALSE, GL_ALWAYS); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index c2fb74365..1919611ec 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1528,6 +1528,7 @@ static LLFastTimer::DeclareTimer FTM_OCCLUSION_DRAW("Draw"); void LLSpatialGroup::doOcclusion(LLCamera* camera) { + LLGLDisable stencil(GL_STENCIL_TEST); if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1) { //static const LLCachedControl render_water_void_culling("RenderWaterVoidCulling", TRUE); @@ -3867,6 +3868,8 @@ public: return; } + LLGLDisable stencil(GL_STENCIL_TEST); + group->rebuildGeom(); group->rebuildMesh(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 9c83cfeb3..8ac0640fd 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2334,6 +2334,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl LLGLDisable blend(GL_BLEND); LLGLDisable test(GL_ALPHA_TEST); + LLGLDisable stencil(GL_STENCIL_TEST); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);