From 25388312cf28f8b30934ac3885783a96a3b2ed69 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> Date: Tue, 5 Sep 2023 13:19:10 +0200 Subject: SL-20206 Underwater visuals problematic when camera is swung below Z=0 --- indra/newview/llagentcamera.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 098ff8fea9..6e8784b726 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1996,15 +1996,21 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) // Don't let camera go underground F32 camera_min_off_ground = getCameraMinOffGround(); - camera_land_height = LLWorld::getInstance()->resolveLandHeightGlobal(camera_position_global); - - if (camera_position_global.mdV[VZ] < camera_land_height + camera_min_off_ground) + F32 minZ = llmax(F_ALMOST_ZERO, camera_land_height + camera_min_off_ground); + if (camera_position_global.mdV[VZ] < minZ) { - camera_position_global.mdV[VZ] = camera_land_height + camera_min_off_ground; + camera_position_global.mdV[VZ] = minZ; isConstrained = TRUE; } + // Don't let camera go abovesky + F32 maxZ = LLWorld::getInstance()->getRegionMaxHeight() * 0.25 - F_ALMOST_ZERO; + if (camera_position_global.mdV[VZ] > maxZ) + { + camera_position_global.mdV[VZ] = maxZ; + isConstrained = TRUE; + } if (hit_limit) { -- cgit v1.2.3