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.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 2f65f3dec3..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"
@@ -989,6 +990,15 @@ void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
{
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);