summaryrefslogtreecommitdiff
path: root/indra/newview/llsettingsvo.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-01-08 21:33:06 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-01-08 21:33:06 +0200
commitafe91b7eb68da65687beef451bd094ff0091b717 (patch)
tree5bdb9e5b5a78a16a8c1362c33717a6931fb40458 /indra/newview/llsettingsvo.cpp
parent6e6df8c31e09e6ba69156150ecd37cc4ac4ea0e6 (diff)
parent77395eddc911e0801e50fd693f7bbaee8046aa95 (diff)
Merge main (DRTVWR-596 GLTF Materials Maint) into DRTVWR-591-maint-X
# Conflicts: # indra/newview/VIEWER_VERSION.txt
Diffstat (limited to 'indra/newview/llsettingsvo.cpp')
-rw-r--r--indra/newview/llsettingsvo.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 42587658a6..7009fb98ab 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -63,6 +63,7 @@
#include <boost/algorithm/string/replace.hpp>
#include "llinventoryobserver.h"
#include "llinventorydefines.h"
+#include "llworld.h"
#include "lltrans.h"
@@ -983,12 +984,21 @@ void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
LLEnvironment& env = LLEnvironment::instance();
- auto group = LLGLSLShader::SG_WATER;
+ auto group = LLGLSLShader::SG_ANY;
LLShaderUniforms* shader = &((LLShaderUniforms*)ptarget)[group];
{
F32 water_height = env.getWaterHeight();
+ if (LLViewerCamera::instance().cameraUnderWater())
+ { // when the camera is under water, use the water height at the camera position
+ LLViewerRegion* region = LLWorld::instance().getRegionFromPosAgent(LLViewerCamera::instance().getOrigin());
+ if (region)
+ {
+ water_height = region->getWaterHeight();
+ }
+ }
+
//transform water plane to eye space
glh::vec3f norm(0.f, 0.f, 1.f);
glh::vec3f p(0.f, 0.f, water_height);