summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-11-26 11:45:08 -0800
committerGraham Linden <graham@lindenlab.com>2018-11-26 11:45:08 -0800
commit86981981c8754c13dd6ba3e01d68b49ce28c57d6 (patch)
treed9044205ca08fd3b81a1a1c4a8a46da09c9690f4 /indra/newview
parent8d3e5a3eac51170946e6f32a28f26fa523753d90 (diff)
SL-10099
Remove user clip plane from culling pass and from attachment vis update. There will be more slop and render submits, but the results will be more stable and involve less culling mystery bugs like 9708.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/pipeline.cpp61
1 files changed, 10 insertions, 51 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 5e597b85ff..ab933d9651 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -2433,36 +2433,8 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- //setup a clip plane in projection matrix for reflection renders (prevents flickering from occlusion culling)
- LLViewerRegion* region = gAgent.getRegion();
- LLPlane plane;
-
- if (planep)
- {
- plane = *planep;
- }
- else
- {
- if (region)
- {
- LLVector3 pnorm;
- F32 height = region->getWaterHeight();
- if (water_clip < 0)
- { //camera is above water, clip plane points up
- pnorm.setVec(0,0,1);
- plane.setVec(pnorm, -height);
- }
- else if (water_clip > 0)
- { //camera is below water, clip plane points down
- pnorm = LLVector3(0,0,-1);
- plane.setVec(pnorm, height);
- }
- }
- }
-
glh::matrix4f modelview = get_last_modelview();
glh::matrix4f proj = get_last_projection();
- LLGLUserClipPlane clip(plane, modelview, proj, water_clip != 0 && LLPipeline::sReflectionRender);
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
@@ -2483,21 +2455,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
}
+ camera.disableUserClipPlane();
+
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* region = *iter;
- if (water_clip != 0)
- {
- LLPlane plane(LLVector3(0,0, (F32) -water_clip), (F32) water_clip*region->getWaterHeight());
- camera.setUserClipPlane(plane);
- }
- else
- {
- camera.disableUserClipPlane();
- }
-
- for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+
+ for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
{
LLSpatialPartition* part = region->getSpatialPartition(i);
if (part)
@@ -9869,23 +9834,19 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point);
//plane params
- LLVector3 pnorm;
- F32 plane_d;
-
+ LLVector3 pnorm;
S32 water_clip = 0;
if (!LLViewerCamera::getInstance()->cameraUnderWater())
{ //camera is above water, clip plane points up
pnorm.setVec(0,0,1);
- plane_d = -water_height;
- plane.setVec(pnorm, -distance_to_water);
- water_clip = -1;
+ plane.setVec(pnorm, -water_height);
+ water_clip = 1;
}
else
{ //camera is below water, clip plane points down
pnorm = LLVector3(0,0,-1);
- plane_d = water_height;
- plane.setVec(pnorm, distance_to_water);
- water_clip = 1;
+ plane.setVec(pnorm, water_height);
+ water_clip = -1;
}
bool materials_in_water = false;
@@ -10002,7 +9963,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
LLGLUserClipPlane clip_plane(plane, mat, projection);
LLGLDisable cull(GL_CULL_FACE);
- updateCull(camera, ref_result, -water_clip, &plane);
+ updateCull(camera, ref_result, water_clip, &plane);
stateSort(camera, ref_result);
}
@@ -10145,8 +10106,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
gPipeline.popRenderTypeMask();
LLDrawPoolWater::sNeedsReflectionUpdate = FALSE;
LLDrawPoolWater::sNeedsDistortionUpdate = FALSE;
- LLPlane npnorm(-pnorm, -plane_d);
- LLViewerCamera::getInstance()->setUserClipPlane(npnorm);
LLGLState::checkStates();