summaryrefslogtreecommitdiff
path: root/indra/newview/llagentcamera.cpp
diff options
context:
space:
mode:
authorleviathan <leviathan@lindenlab.com>2026-09-24 14:11:18 -0700
committerleviathan <leviathan@lindenlab.com>2026-10-16 13:14:38 -0700
commit2cdb4ab7b14593f70372af80aea96bde5fbc22e3 (patch)
tree69319f75539a492e5cfca2e83b0c3bc4a2201ca4 /indra/newview/llagentcamera.cpp
parentffe47a24800c89f36d1316fa5f8802570804b69a (diff)
add support for mousewheel zoom while in flycam mode
Diffstat (limited to 'indra/newview/llagentcamera.cpp')
-rw-r--r--indra/newview/llagentcamera.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index ea38ac34a3..1d61dcea6a 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -2162,6 +2162,21 @@ LLVector3 LLAgentCamera::getAvatarRootPosition()
//-----------------------------------------------------------------------------
void LLAgentCamera::handleScrollWheel(S32 clicks)
{
+ if (isUsingFlycam())
+ {
+ // Flycam preempts updateCamera() entirely (see the comment on
+ // mUsingFlycam in llagentcamera.h), so none of the mCameraMode-based
+ // zoom logic below applies to it; drive the flycam's own FOV-based
+ // "zoom" (LLFlycam::mView, also fed by the FLYCAM_ZOOM game-control
+ // channel in updateFlycam()) instead.
+ // Negative 'clicks' (forward/up scroll) narrows the FOV to zoom in,
+ // matching the sign convention used by the non-flycam paths below.
+ constexpr F32 FLYCAM_SCROLL_ZOOM_FACTOR_PER_CLICK = 0.9f;
+ F32 zoom_factor = (F32)pow(FLYCAM_SCROLL_ZOOM_FACTOR_PER_CLICK, -clicks);
+ mFlycam.setView(mFlycam.getView() * zoom_factor);
+ return;
+ }
+
if (mCameraMode == CAMERA_MODE_FOLLOW && getFocusOnAvatar())
{
if (!mFollowCam.getPositionLocked()) // not if the followCam position is locked in place