summaryrefslogtreecommitdiff
path: root/indra/newview/llviewercamera.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-01-09 10:14:41 +0800
committerErik Kundiman <erik@megapahit.org>2024-01-09 10:14:41 +0800
commitf6dec0bf7b9baa990fa26398e77faf5a410b8be6 (patch)
tree9ed732e6801157018faff52d4782c2688fefdd73 /indra/newview/llviewercamera.cpp
parent0fd4a8b59677e1a85d19308379ab9967345749dc (diff)
parent3c858d7e2d6633df14df473a918d2fb848403972 (diff)
Merge tag '7.1.2-release'
source for viewer 7.1.2.7215179142
Diffstat (limited to 'indra/newview/llviewercamera.cpp')
-rw-r--r--indra/newview/llviewercamera.cpp75
1 files changed, 45 insertions, 30 deletions
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index 54d773f33c..325ab9b030 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -50,6 +50,7 @@
#include "llquaternion.h"
#include "llwindow.h" // getPixelAspectRatio()
#include "lltracerecording.h"
+#include "llenvironment.h"
// System includes
#include <iomanip> // for setprecision
@@ -96,35 +97,41 @@ LLViewerCamera::LLViewerCamera() : LLCamera()
gSavedSettings.getControl("CameraAngle")->getCommitSignal()->connect(boost::bind(&LLViewerCamera::updateCameraAngle, this, _2));
}
-void LLViewerCamera::updateCameraLocation(const LLVector3 &center,
- const LLVector3 &up_direction,
- const LLVector3 &point_of_interest)
+void LLViewerCamera::updateCameraLocation(const LLVector3 &center, const LLVector3 &up_direction, const LLVector3 &point_of_interest)
{
- // do not update if avatar didn't move
- if (!LLViewerJoystick::getInstance()->getCameraNeedsUpdate())
- {
- return;
- }
-
- LLVector3 last_position;
- LLVector3 last_axis;
- last_position = getOrigin();
- last_axis = getAtAxis();
-
- mLastPointOfInterest = point_of_interest;
-
- LLViewerRegion * regp = gAgent.getRegion();
- F32 water_height = (NULL != regp) ? regp->getWaterHeight() : 0.f;
-
- LLVector3 origin = center;
- if (origin.mV[2] > water_height)
- {
- origin.mV[2] = llmax(origin.mV[2], water_height+0.20f);
- }
- else
- {
- origin.mV[2] = llmin(origin.mV[2], water_height-0.20f);
- }
+ // do not update if avatar didn't move
+ if (!LLViewerJoystick::getInstance()->getCameraNeedsUpdate())
+ {
+ return;
+ }
+
+ LLVector3 last_position;
+ LLVector3 last_axis;
+ last_position = getOrigin();
+ last_axis = getAtAxis();
+
+ mLastPointOfInterest = point_of_interest;
+
+ LLViewerRegion* regp = LLWorld::instance().getRegionFromPosAgent(getOrigin());
+ if (!regp)
+ {
+ regp = gAgent.getRegion();
+ }
+
+ F32 water_height = (NULL != regp) ? regp->getWaterHeight() : 0.f;
+
+ LLVector3 origin = center;
+
+ {
+ if (origin.mV[2] > water_height)
+ {
+ origin.mV[2] = llmax(origin.mV[2], water_height + 0.20f);
+ }
+ else
+ {
+ origin.mV[2] = llmin(origin.mV[2], water_height - 0.20f);
+ }
+ }
setOriginAndLookAt(origin, up_direction, point_of_interest);
@@ -763,11 +770,19 @@ LLVector3 LLViewerCamera::roundToPixel(const LLVector3 &pos_agent)
BOOL LLViewerCamera::cameraUnderWater() const
{
- if(!gAgent.getRegion())
+ LLViewerRegion* regionp = LLWorld::instance().getRegionFromPosAgent(getOrigin());
+
+ if (!regionp)
+ {
+ regionp = gAgent.getRegion();
+ }
+
+ if(!regionp)
{
return FALSE ;
}
- return getOrigin().mV[VZ] < gAgent.getRegion()->getWaterHeight();
+
+ return getOrigin().mV[VZ] < regionp->getWaterHeight();
}
BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts)