diff options
author | Graham Linden <graham@lindenlab.com> | 2019-08-27 12:49:18 -0700 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-08-27 12:49:18 -0700 |
commit | ad26896a1086536cf47d3cb0041b0410aebf2119 (patch) | |
tree | 66cbe552b9ea2d9a0992df0a63ffceacc504b866 /indra/newview | |
parent | b660db7324387e2fcc55312e2c4f05897ca2c0eb (diff) |
SL-11055
Remedy cloud_shadow and hack halving being done twice to ambient in some cases (i.e. artificial dimunition of necessary bullshit factor).
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 56 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.h | 8 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 19 |
3 files changed, 37 insertions, 46 deletions
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 11bb732be8..bbee94287d 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -663,7 +663,7 @@ void LLSettingsVOSky::updateSettings() gSky.setMoonScale(getMoonScale()); } -void LLSettingsVOSky::applySpecial(void *ptarget) +void LLSettingsVOSky::applySpecial(void *ptarget, bool force) { LLGLSLShader *shader = (LLGLSLShader *)ptarget; @@ -671,46 +671,38 @@ void LLSettingsVOSky::applySpecial(void *ptarget) if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT) { - shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); - shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); + shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV); } else if (shader->mShaderGroup == LLGLSLShader::SG_SKY) { - shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV); - LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]); - vect_c_p_d1 += LLVector4(LLEnvironment::instance().getCloudScrollDelta()); - shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV); + LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]); + vect_c_p_d1 += LLVector4(LLEnvironment::instance().getCloudScrollDelta()); + shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV); - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - LLColor4 sunDiffuse = psky->getSunlightColor(); - LLColor4 moonDiffuse = psky->getMoonlightColor(); + LLColor4 sunDiffuse = psky->getSunlightColor(); + LLColor4 moonDiffuse = psky->getMoonlightColor(); - F32 max_color = llmax(sunDiffuse.mV[0], sunDiffuse.mV[1], sunDiffuse.mV[2]); - if (max_color > 1.f) - { - sunDiffuse *= 1.f/max_color; - } - sunDiffuse.clamp(); - - max_color = llmax(moonDiffuse.mV[0], moonDiffuse.mV[1], moonDiffuse.mV[2]); - if (max_color > 1.f) - { - moonDiffuse *= 1.f/max_color; - } - moonDiffuse.clamp(); + shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, sunDiffuse.mV); + shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, moonDiffuse.mV); - shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, sunDiffuse.mV); - shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, moonDiffuse.mV); - - LLColor4 cloud_color(psky->getCloudColor(), 1.0); - shader->uniform4fv(LLShaderMgr::CLOUD_COLOR, 1, cloud_color.mV); + LLColor4 cloud_color(psky->getCloudColor(), 1.0); + shader->uniform4fv(LLShaderMgr::CLOUD_COLOR, 1, cloud_color.mV); } - - shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mSceneLightStrength); + + LLColor4 ambient(getTotalAmbient()); + shader->uniform4fv(LLShaderMgr::AMBIENT, 1, ambient.mV); + + shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, getIsSunUp() ? 1 : 0); + shader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, getSunMoonGlowFactor()); + shader->uniform1f(LLShaderMgr::DENSITY_MULTIPLIER, getDensityMultiplier()); + shader->uniform1f(LLShaderMgr::DISTANCE_MULTIPLIER, getDistanceMultiplier()); F32 g = getGamma(); F32 display_gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma"); @@ -904,13 +896,13 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater) } //------------------------------------------------------------------------- //------------------------------------------------------------------------- -void LLSettingsVOWater::applySpecial(void *ptarget) +void LLSettingsVOWater::applySpecial(void *ptarget, bool force) { LLGLSLShader *shader = (LLGLSLShader *)ptarget; LLEnvironment& env = LLEnvironment::instance(); - if (shader->mShaderGroup == LLGLSLShader::SG_WATER) + if (force || (shader->mShaderGroup == LLGLSLShader::SG_WATER)) { F32 water_height = env.getWaterHeight(); diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h index 6f105c9d61..1f29013ecf 100644 --- a/indra/newview/llsettingsvo.h +++ b/indra/newview/llsettingsvo.h @@ -102,7 +102,7 @@ public: bool isAdvanced() const { return m_isAdvanced; } - virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader); } + virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader, true); } protected: LLSettingsVOSky(); @@ -112,7 +112,7 @@ protected: virtual void updateSettings() override; - virtual void applySpecial(void *) override; + virtual void applySpecial(void *, bool) override; virtual parammapping_t getParameterMap() const override; @@ -136,13 +136,13 @@ public: static LLSD convertToLegacy(const ptr_t &); - virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader); } + virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader, true); } protected: LLSettingsVOWater(); virtual void updateSettings() override; - virtual void applySpecial(void *) override; + virtual void applySpecial(void *, bool) override; virtual parammapping_t getParameterMap() const override; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 7048b921b0..33847b097b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -116,6 +116,7 @@ #include "llcleanup.h" #include "llenvironment.h" +#include "llsettingsvo.h" #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 @@ -8424,21 +8425,19 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff); shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff); - shader.uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV); - shader.uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV); - - - LLEnvironment& environment = LLEnvironment::instance(); - LLColor4 ambient(environment.getCurrentSky()->getTotalAmbient()); - shader.uniform4fv(LLShaderMgr::AMBIENT, 1, ambient.mV); - shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); - shader.uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, environment.getCurrentSky()->getSunMoonGlowFactor()); - if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0) { glh::matrix4f norm_mat = get_current_modelview().inverse().transpose(); shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m); } + + shader.uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV); + shader.uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV); + + LLEnvironment& environment = LLEnvironment::instance(); + LLSettingsSky::ptr_t sky = environment.getCurrentSky(); + + static_cast<LLSettingsVOSky*>(sky.get())->updateShader(&shader); } LLColor3 pow3f(LLColor3 v, F32 f) |