diff options
author | Rider Linden <rider@lindenlab.com> | 2018-11-26 21:57:03 +0000 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-11-26 21:57:03 +0000 |
commit | 3cbe7fa715c92b36d97c3af826747b1b7a9e9383 (patch) | |
tree | 13f012f2b24823cdc0d95eb6c7571b99bd3af2c0 /indra/newview | |
parent | 917077ec29cd7e32756f760e321da7285fd1ef0a (diff) | |
parent | 86981981c8754c13dd6ba3e01d68b49ce28c57d6 (diff) |
Merged in graham_linden/viewer-eep-fixes (pull request #200)
SL-10099
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/pipeline.cpp | 61 |
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(); |