diff options
| author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2024-06-06 12:10:10 +0200 |
|---|---|---|
| committer | Guru <alexandrgproductengine@lindenlab.com> | 2024-06-15 00:18:49 +0200 |
| commit | 3fc8d4b232a60931849e674b48273eb07157b4e1 (patch) | |
| tree | 4c1e7bd1c348d43c2597f97fca3b3c2a8242ecc2 /indra/newview/llviewercamera.cpp | |
| parent | fece367b9b6b351d112f9036ce445c52397c9b03 (diff) | |
#1611 Regression in anti-flipping mechanism for mouselook camera
Diffstat (limited to 'indra/newview/llviewercamera.cpp')
| -rw-r--r-- | indra/newview/llviewercamera.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index bda1a20fdd..836bcad784 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -103,18 +103,16 @@ LLViewerCamera::~LLViewerCamera() mCameraAngleChangedSignal.disconnect(); } -void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, const LLVector3 &up_direction, const LLVector3 &point_of_interest) +bool LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, const LLVector3 &up_direction, const LLVector3 &point_of_interest) { // do not update if avatar didn't move if (!LLViewerJoystick::getInstance()->getCameraNeedsUpdate()) { - return; + return true; } - LLVector3 last_position; - LLVector3 last_axis; - last_position = getOrigin(); - last_axis = getAtAxis(); + LLVector3 last_position = getOrigin(); + LLVector3 last_axis = getAtAxis(); mLastPointOfInterest = point_of_interest; @@ -139,10 +137,26 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, const LLVecto } } - setOriginAndLookAt(origin, up_direction, point_of_interest); + LLVector3 at(point_of_interest - origin); + at.normalize(); + if (at.isNull() || !at.isFinite()) + return false; - mVelocityDir = origin - last_position ; - F32 dpos = mVelocityDir.normVec() ; + LLVector3 left(up_direction % at); + left.normalize(); + if (left.isNull() || !left.isFinite()) + return false; + + LLVector3 up = at % left; + up.normalize(); + if (up.isNull() || !up.isFinite()) + return false; + + setOrigin(origin); + setAxes(at, left, up); + + mVelocityDir = origin - last_position; + F32 dpos = mVelocityDir.normVec(); LLQuaternion rotation; rotation.shortestArc(last_axis, getAtAxis()); @@ -161,6 +175,8 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, const LLVecto mPixelMeterRatio = getViewHeightInPixels()/ (2.f*tanf(mCameraFOVDefault*0.5)); // update screen pixel area mScreenPixelArea =(S32)((F32)getViewHeightInPixels() * ((F32)getViewHeightInPixels() * getAspect())); + + return true; } const LLMatrix4 &LLViewerCamera::getProjection() const |
