diff options
author | Rider Linden <rider@lindenlab.com> | 2018-10-09 20:11:47 +0000 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-10-09 20:11:47 +0000 |
commit | 4e930a9f82ae6fa2937ca2ef2c2b74e16a3caa03 (patch) | |
tree | 5e6db7152215f4bb8845fbabdd7937bd4d564fb3 /indra/newview | |
parent | ac6d2b09c048d8589c572acb2965a0643b07d5ce (diff) | |
parent | 6015e2a5059a03c54c7024e84bb3467bf32c4436 (diff) |
Merged in graham_linden/viewer-eep-graham (pull request #140)
SL-9708 slight refrain
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/pipeline.cpp | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c1b7fdc780..f91878587f 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2416,14 +2416,21 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl { LLVector3 pnorm; F32 height = region->getWaterHeight(); - pnorm.setVec(0,0,-(F32)water_clip); - plane.setVec(pnorm, height * pnorm.mV[VZ]); + 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(); - + glh::matrix4f proj = get_last_projection(); LLGLUserClipPlane clip(plane, modelview, proj, water_clip != 0 && LLPipeline::sReflectionRender); LLGLDepthTest depth(GL_TRUE, GL_FALSE); @@ -2449,9 +2456,9 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; - if (water_clip != 0 && LLPipeline::sReflectionRender) + if (water_clip != 0) { - LLPlane plane(LLVector3(0,0, -(F32)water_clip), water_clip * region->getWaterHeight()); + LLPlane plane(LLVector3(0,0, (F32) -water_clip), (F32) water_clip*region->getWaterHeight()); camera.setUserClipPlane(plane); } else @@ -9830,23 +9837,21 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) F32 plane_d; S32 water_clip = 0; - - if (LLViewerCamera::getInstance()->cameraUnderWater()) - { - //camera is below water, clip plane points down - water_clip = 1; + 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; } else - { - //camera is above water, clip plane points up - water_clip = -1; + { //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; } - //camera is below water, clip plane points down - pnorm = LLVector3(0,0,-(F32)water_clip); - plane_d = water_height * pnorm.mV[VZ]; - plane.setVec(pnorm, distance_to_water * pnorm.mV[VZ]); - bool materials_in_water = false; #if MATERIALS_IN_REFLECTIONS |