summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/moonF.glsl18
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp22
-rw-r--r--indra/newview/llpaneleditsky.cpp12
-rw-r--r--indra/newview/llpaneleditsky.h1
-rw-r--r--indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml6
-rw-r--r--indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml29
7 files changed, 90 insertions, 13 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index e86bca3ddd..f65a6eb32b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
@@ -39,6 +39,7 @@ vec3 fullbrightScaleSoftClip(vec3 light);
uniform vec4 color;
uniform vec4 sunlight_color;
uniform vec3 lumWeights;
+uniform float moon_brightness;
uniform float minLuminance;
uniform sampler2D diffuseMap;
uniform sampler2D altDiffuseMap;
@@ -51,15 +52,23 @@ void main()
vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(moonA, moonB, blend_factor);
+ if (c.a < 0.1f)
+ {
+ discard;
+ }
+
c.rgb = pow(c.rgb, vec3(0.7f));
c.rgb = fullbrightAtmosTransport(c.rgb);
c.rgb = fullbrightScaleSoftClip(c.rgb);
// mix factor which blends when sunlight is brighter
// and shows true moon color at night
- vec3 luma_weights = vec3(0.1, 0.3, 0.0);
- float mix = 1.0f - dot(sunlight_color.rgb, luma_weights);
- frag_data[0] = vec4(c.rgb, mix * c.a);
+ vec3 luma_weights = vec3(0.2, 0.3, 0.2);
+ float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights);
+
+ c.rgb = pow(c.rgb, 1.2 - vec3(mix * moon_brightness));
+
+ frag_data[0] = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25)));
frag_data[1] = vec4(0.0);
frag_data[2] = vec4(0.0f);
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
index 933625986c..8cc7fc3bb5 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
@@ -39,6 +39,7 @@ vec3 fullbrightScaleSoftClip(vec3 light);
uniform vec4 color;
uniform vec4 sunlight_color;
uniform vec3 lumWeights;
+uniform float moon_brightness;
uniform float minLuminance;
uniform sampler2D diffuseMap;
uniform sampler2D altDiffuseMap;
@@ -51,13 +52,22 @@ void main()
vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(moonA, moonB, blend_factor);
- c.rgb = pow(c.rgb, vec3(0.45f));
+ if (c.a < 0.1f)
+ {
+ discard;
+ }
+
+ c.rgb = pow(c.rgb, vec3(0.7f));
c.rgb = fullbrightAtmosTransport(c.rgb);
c.rgb = fullbrightScaleSoftClip(c.rgb);
+
// mix factor which blends when sunlight is brighter
// and shows true moon color at night
- vec3 luma_weights = vec3(0.1, 0.3, 0.0);
- float mix = 1.0f - dot(sunlight_color.rgb, luma_weights);
- frag_color = vec4(c.rgb, mix * c.a);
+ vec3 luma_weights = vec3(0.2, 0.3, 0.2);
+ float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights);
+
+ c.rgb = pow(c.rgb, 1.2 - vec3(mix * moon_brightness));
+
+ frag_color = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25)));
}
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index d82cff516e..b89588a463 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -224,6 +224,22 @@ void LLDrawPoolWLSky::renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightL
LLGLDisable blend(GL_BLEND);
sky_shader->bind();
+ LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
+
+ LLViewerTexture* rainbow_tex = gSky.mVOSkyp->getRainbowTex();
+ LLViewerTexture* halo_tex = gSky.mVOSkyp->getHaloTex();
+
+ sky_shader->bindTexture(LLShaderMgr::RAINBOW_MAP, rainbow_tex);
+ sky_shader->bindTexture(LLShaderMgr::HALO_MAP, halo_tex);
+
+ F32 moisture_level = (float)psky->getSkyMoistureLevel();
+ F32 droplet_radius = (float)psky->getSkyDropletRadius();
+ F32 ice_level = (float)psky->getSkyIceLevel();
+
+ sky_shader->uniform1f(LLShaderMgr::MOISTURE_LEVEL, moisture_level);
+ sky_shader->uniform1f(LLShaderMgr::DROPLET_RADIUS, droplet_radius);
+ sky_shader->uniform1f(LLShaderMgr::ICE_LEVEL, ice_level);
+
/// Render the skydome
renderDome(origin, camHeightLocal, sky_shader);
@@ -484,6 +500,12 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
moon_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE);
}
+ LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
+
+ F32 moon_brightness = (float)psky->getMoonBrightness();
+
+ moon_shader->uniform1f(LLShaderMgr::MOON_BRIGHTNESS, moon_brightness);
+
moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp
index faba2b7ed1..0d8c9a988a 100644
--- a/indra/newview/llpaneleditsky.cpp
+++ b/indra/newview/llpaneleditsky.cpp
@@ -72,6 +72,7 @@ namespace
const std::string FIELD_SKY_MOON_ROTATION("moon_rotation");
const std::string FIELD_SKY_MOON_IMAGE("moon_image");
const std::string FIELD_SKY_MOON_SCALE("moon_scale");
+ const std::string FIELD_SKY_MOON_BRIGHTNESS("moon_brightness");
const std::string FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL("rayleigh_exponential");
const std::string FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE("rayleigh_exponential_scale");
@@ -398,6 +399,7 @@ BOOL LLPanelSettingsSkySunMoonTab::postBuild()
getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowNoTexture(TRUE);
getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowLocalTexture(FALSE);
getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonScaleChanged(); });
+ getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonBrightnessChanged(); });
refresh();
@@ -411,6 +413,9 @@ void LLPanelSettingsSkySunMoonTab::setEnabled(BOOL enabled)
getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->setEnabled(enabled);
getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->setEnabled(enabled);
getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->setEnabled(enabled);
+ getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setEnabled(enabled);
+ getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setEnabled(enabled);
+ getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setEnabled(enabled);
}
void LLPanelSettingsSkySunMoonTab::refresh()
@@ -438,6 +443,7 @@ void LLPanelSettingsSkySunMoonTab::refresh()
getChild<LLVirtualTrackball>(FIELD_SKY_MOON_ROTATION)->setRotation(mSkySettings->getMoonRotation());
getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setValue(mSkySettings->getMoonTextureId());
getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setValue(mSkySettings->getMoonScale());
+ getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setValue(mSkySettings->getMoonBrightness());
}
//-------------------------------------------------------------------------
@@ -513,6 +519,12 @@ void LLPanelSettingsSkySunMoonTab::onMoonScaleChanged()
setIsDirty();
}
+void LLPanelSettingsSkySunMoonTab::onMoonBrightnessChanged()
+{
+ mSkySettings->setMoonBrightness((getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->getValue().asReal()));
+ mSkySettings->update();
+ setIsDirty();
+}
LLPanelSettingsSkyDensityTab::LLPanelSettingsSkyDensityTab()
{
diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h
index e9d956de74..829a65dae5 100644
--- a/indra/newview/llpaneleditsky.h
+++ b/indra/newview/llpaneleditsky.h
@@ -123,6 +123,7 @@ private:
void onSunImageChanged();
void onMoonRotationChanged();
void onMoonScaleChanged();
+ void onMoonBrightnessChanged();
void onMoonImageChanged();
};
diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
index e1c08a24f2..9aa7c6f499 100644
--- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
+++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
@@ -6,9 +6,9 @@
save_rect="false"
title="Edit Day Cycle"
width="705"
- height="650"
+ height="700"
min_width="705"
- min_height="650"
+ min_height="700"
single_instance="true"
can_resize="false">
@@ -25,7 +25,7 @@
<!-- Layout -->
<layout_stack name="outer_stack"
width="705"
- height="650"
+ height="700"
follows="all"
animate="false"
top="0"
diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml
index 6d12f6bb94..1332ecd965 100644
--- a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml
+++ b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml
@@ -14,14 +14,14 @@
top="5"
right="-5"
bottom="-5"
- orientation="hoizontal">
+ orientation="horizontal">
<layout_panel
border="true"
bevel_style="in"
auto_resize="true"
user_resize="false"
visible="true"
- height="350">
+ height="400">
<text
follows="left|top"
height="10"
@@ -176,6 +176,29 @@
top_delta="15"
width="250"
can_edit_text="true"/>
+ <text
+ follows="left|top"
+ height="10"
+ layout="topleft"
+ left_delta="-5"
+ top_delta="22"
+ width="200">
+ Moon Brightness:
+ </text>
+ <slider
+ decimal_digits="2"
+ follows="left|top"
+ height="16"
+ increment="0.01"
+ initial_value="0"
+ layout="topleft"
+ left_delta="5"
+ min_val="0.0"
+ max_val="1.0"
+ name="moon_brightness"
+ top_delta="15"
+ width="250"
+ can_edit_text="true"/>
</layout_panel>
<layout_panel
border="false"
@@ -183,7 +206,7 @@
auto_resize="true"
user_resize="false"
visible="true"
- height="350">
+ height="400">
<layout_stack
left="5"
top="5"