summaryrefslogtreecommitdiff
path: root/indra/newview/llsettingsvo.cpp
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-02-13 13:09:14 -0800
committerGraham Linden <graham@lindenlab.com>2019-02-13 13:09:14 -0800
commit65927e0a76aaf8ff4dc268acdb12007265ff3a14 (patch)
treea42b75a5b880849c9ec5a7f610669f4c9dd674ad /indra/newview/llsettingsvo.cpp
parent5433ed60ac93c6ccc7692ad43d579a83ab544f31 (diff)
SL-10181, SL-10546
Fix distortion map rendering in deferred mode not including underwater fog effects. Fix distortion map rendering not including post-deferred content at all. Fix distortion map rendering not including anything but sky when camera is underwater. Update sun_up_factor/sunmoon_glow_factor uniforms even when sun disc isn't in use.
Diffstat (limited to 'indra/newview/llsettingsvo.cpp')
-rw-r--r--indra/newview/llsettingsvo.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 29217b3f42..3ef5e46e38 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -879,11 +879,15 @@ void LLSettingsVOWater::applySpecial(void *ptarget)
{
LLGLSLShader *shader = (LLGLSLShader *)ptarget;
+ LLEnvironment& env = LLEnvironment::instance();
+
if (shader->mShaderGroup == LLGLSLShader::SG_WATER)
{
+ F32 water_height = env.getWaterHeight();
+
//transform water plane to eye space
glh::vec3f norm(0.f, 0.f, 1.f);
- glh::vec3f p(0.f, 0.f, LLEnvironment::instance().getWaterHeight() + 0.1f);
+ glh::vec3f p(0.f, 0.f, water_height + 0.1f);
F32 modelView[16];
for (U32 i = 0; i < 16; i++)
@@ -903,13 +907,18 @@ void LLSettingsVOWater::applySpecial(void *ptarget)
shader->uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, waterPlane.mV);
- LLVector4 light_direction = LLEnvironment::instance().getClampedLightNorm();
+ LLVector4 light_direction = env.getClampedLightNorm();
F32 waterFogKS = 1.f / llmax(light_direction.mV[2], WATER_FOG_LIGHT_CLAMP);
shader->uniform1f(LLShaderMgr::WATER_FOGKS, waterFogKS);
- F32 blend_factor = LLEnvironment::instance().getCurrentWater()->getBlendFactor();
+ F32 eyedepth = LLViewerCamera::getInstance()->getOrigin().mV[2] - water_height;
+
+ F32 waterFogDensity = env.getCurrentWater()->getModifiedWaterFogDensity(LLPipeline::sUnderWaterRender || (eyedepth <= 0.0f));
+ shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, waterFogDensity);
+
+ F32 blend_factor = env.getCurrentWater()->getBlendFactor();
shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
LLVector4 rotated_light_direction = LLEnvironment::instance().getRotatedLightNorm();
@@ -941,7 +950,9 @@ LLSettingsWater::parammapping_t LLSettingsVOWater::getParameterMap() const
{
LLSD water_defaults = LLSettingsWater::defaults();
param_map[SETTING_FOG_COLOR] = DefaultParam(LLShaderMgr::WATER_FOGCOLOR, water_defaults[SETTING_FOG_COLOR]);
- param_map[SETTING_FOG_DENSITY] = DefaultParam(LLShaderMgr::WATER_FOGDENSITY, water_defaults[SETTING_FOG_DENSITY]);
+
+ // let this get set by LLSettingsVOWater::applySpecial so that it can properly reflect the underwater modifier
+ //param_map[SETTING_FOG_DENSITY] = DefaultParam(LLShaderMgr::WATER_FOGDENSITY, water_defaults[SETTING_FOG_DENSITY]);
}
return param_map;
}