summaryrefslogtreecommitdiff
path: root/indra/newview/llsettingsvo.cpp
diff options
context:
space:
mode:
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);