summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2019-04-10 17:40:52 +0000
committerRider Linden <rider@lindenlab.com>2019-04-10 17:40:52 +0000
commit4e1874184e5eb2fc69702f0934f245e8b9dd0350 (patch)
tree8e54eef11732426d0404be892073d435a272a044 /indra
parentb172ced57afd334db2aba19308e8793fd43ea5ec (diff)
parent2c568e7584ed4a5c000b2064a4d06f4b2347a34a (diff)
Merged in graham_linden/viewer-eep-fixes (pull request #347)
SL-10925, SL-10926, SL-10896
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonF.glsl4
-rw-r--r--indra/newview/llsettingsvo.cpp24
-rw-r--r--indra/newview/llviewershadermgr.cpp1
3 files changed, 28 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index 7732cf986e..aae6158673 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
@@ -44,6 +44,8 @@ uniform sampler2D altDiffuseMap;
uniform float blend_factor; // interp factor between moon A/B
VARYING vec2 vary_texcoord0;
+vec3 srgb_to_linear(vec3 c);
+
void main()
{
vec4 moonA = texture2D(diffuseMap, vary_texcoord0.xy);
@@ -58,6 +60,8 @@ void main()
vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0;
c.rgb = pow(c.rgb, exp);
+ c.rgb = srgb_to_linear(c.rgb);
+
//c.rgb *= moonlight_color.rgb;
frag_data[0] = vec4(c.rgb, c.a);
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index eb92c11952..628666c3ed 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -685,6 +685,28 @@ void LLSettingsVOSky::applySpecial(void *ptarget)
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();
+
+ LLColor4 sunDiffuse = psky->getSunDiffuse();
+ LLColor4 moonDiffuse = psky->getMoonDiffuse();
+
+ 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);
}
F32 g = getGamma();
@@ -721,7 +743,7 @@ LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const
param_map[SETTING_CLOUD_VARIANCE] = DefaultParam(LLShaderMgr::CLOUD_VARIANCE, sky_defaults[SETTING_CLOUD_VARIANCE]);
param_map[SETTING_GLOW] = DefaultParam(LLShaderMgr::GLOW, sky_defaults[SETTING_GLOW]);
param_map[SETTING_MAX_Y] = DefaultParam(LLShaderMgr::MAX_Y, sky_defaults[SETTING_MAX_Y]);
- param_map[SETTING_SUNLIGHT_COLOR] = DefaultParam(LLShaderMgr::SUNLIGHT_COLOR, sky_defaults[SETTING_SUNLIGHT_COLOR]);
+ //param_map[SETTING_SUNLIGHT_COLOR] = DefaultParam(LLShaderMgr::SUNLIGHT_COLOR, sky_defaults[SETTING_SUNLIGHT_COLOR]);
param_map[SETTING_MOON_BRIGHTNESS] = DefaultParam(LLShaderMgr::MOON_BRIGHTNESS, sky_defaults[SETTING_MOON_BRIGHTNESS]);
param_map[SETTING_SKY_MOISTURE_LEVEL] = DefaultParam(LLShaderMgr::MOISTURE_LEVEL, sky_defaults[SETTING_SKY_MOISTURE_LEVEL]);
param_map[SETTING_SKY_DROPLET_RADIUS] = DefaultParam(LLShaderMgr::DROPLET_RADIUS, sky_defaults[SETTING_SKY_DROPLET_RADIUS]);
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index c6d727430c..cf0cd693ae 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -2522,6 +2522,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredWLMoonProgram.mFeatures.hasTransport = true;
gDeferredWLMoonProgram.mFeatures.hasGamma = true;
gDeferredWLMoonProgram.mFeatures.hasAtmospherics = true;
+ gDeferredWLMoonProgram.mFeatures.hasSrgb = true;
gDeferredWLMoonProgram.mFeatures.isFullbright = true;
gDeferredWLMoonProgram.mFeatures.disableTextureIndex = true;