diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-09-05 13:19:10 +0200 |
---|---|---|
committer | Guru <alexandrgproductengine@lindenlab.com> | 2023-09-05 13:24:54 +0200 |
commit | 25388312cf28f8b30934ac3885783a96a3b2ed69 (patch) | |
tree | 70183264bdbdb47ee6e9f85f28a3dd4b53c86fe1 | |
parent | 512d450fe31eee5772339c27333e0d56f4bfbd45 (diff) |
SL-20206 Underwater visuals problematic when camera is swung below Z=0
-rw-r--r-- | indra/newview/llagentcamera.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
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) { |