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/alphaF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/skyF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl1
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp6
-rw-r--r--indra/newview/llenvironment.cpp66
-rw-r--r--indra/newview/llenvironment.h12
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp36
-rw-r--r--indra/newview/llfloatereditextdaycycle.h4
-rw-r--r--indra/newview/lllegacyatmospherics.cpp8
-rw-r--r--indra/newview/llpaneleditsky.cpp4
-rw-r--r--indra/newview/llsettingsvo.cpp3
-rw-r--r--indra/newview/pipeline.cpp27
-rw-r--r--indra/newview/pipeline.h3
19 files changed, 181 insertions, 55 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 2234ceeb53..8dda96984e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -43,6 +43,7 @@ uniform mat3 env_mat;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
#if HAS_SHADOW
uniform sampler2DShadow shadowMap0;
@@ -287,7 +288,10 @@ void main()
vec2 abnormal = encode_normal(norm.xyz);
norm.xyz = decode_normal(abnormal.xy);
- float da = dot(norm.xyz, sun_dir.xyz);
+ float da_sun = dot(norm.xyz, sun_dir.xyz);
+ float da_moon = dot(norm.xyz, moon_dir.xyz);
+
+ float da = max(da_sun, da_moon);
float final_da = da;
final_da = min(final_da, shadow);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index a90e433622..4dc15dbc89 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -98,6 +98,7 @@ uniform mat3 env_mat;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
VARYING vec2 vary_fragcoord;
VARYING vec3 vary_position;
@@ -388,7 +389,9 @@ void main()
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- float da =dot(norm.xyz, sun_dir.xyz);
+ float da_sun =dot(norm.xyz, sun_dir.xyz);
+ float da_moon =dot(norm.xyz, moon_dir.xyz);
+ float da = max(da_sun, da_moon);
float final_da = da;
final_da = min(final_da, shadow);
@@ -418,7 +421,10 @@ void main()
// the old infinite-sky shiny reflection
//
- float sa = dot(refnormpersp, sun_dir.xyz);
+ float sa_sun = dot(refnormpersp, sun_dir.xyz);
+ float sa_moon = dot(refnormpersp, moon_dir.xyz);
+ float sa = max(sa_sun, sa_moon);
+
vec3 dumbshiny = sunlit*shadow*(texture2D(lightFunc, vec2(sa, spec.a)).r);
// add the two types of shiny together
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index fbfd43a4da..a4543c325e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -56,6 +56,7 @@ uniform mat3 env_mat;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
@@ -106,7 +107,9 @@ void main()
float envIntensity = norm.z;
norm.xyz = decode_normal(norm.xy); // unpack norm
- float da = dot(norm.xyz, sun_dir.xyz);
+ float da_sun = dot(norm.xyz, sun_dir.xyz);
+ float da_moon = dot(norm.xyz, moon_dir.xyz);
+ float da = max(da_sun, da_moon);
float final_da = max(0.0,da);
final_da = min(final_da, 1.0f);
@@ -148,7 +151,10 @@ void main()
// the old infinite-sky shiny reflection
//
- float sa = dot(refnormpersp, sun_dir.xyz);
+ float sa_sun = dot(refnormpersp, sun_dir.xyz);
+ float sa_moon = dot(refnormpersp, moon_dir.xyz);
+ float sa = max(sa_sun, sa_moon);
+
vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r);
// add the two types of shiny together
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
index a7c28a1ac3..68ce2843d0 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
@@ -25,7 +25,6 @@
-uniform vec4 lightnorm;
uniform vec4 waterPlane;
uniform vec4 waterFogColor;
uniform float waterFogDensity;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 9f56bff4c2..5046ede00d 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -49,7 +49,6 @@ uniform vec4 morphFactor;
uniform vec3 camPosLocal;
//uniform vec4 camPosWorld;
uniform vec4 gamma;
-uniform vec4 lightnorm;
uniform vec4 sunlight_color;
uniform vec4 ambient;
uniform vec4 blue_horizon;
@@ -68,6 +67,7 @@ uniform vec4 shadow_clip;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
@@ -117,7 +117,9 @@ void main()
float envIntensity = norm.z;
norm.xyz = decode_normal(norm.xy); // unpack norm
- float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
+ float da_sun = max(dot(norm.xyz, sun_dir.xyz), 0.0);
+ float da_moon = max(dot(norm.xyz, moon_dir.xyz), 0.0);
+ float da = max(da_sun, da_moon);
float light_gamma = 1.0/1.3;
da = pow(da, light_gamma);
@@ -168,7 +170,9 @@ void main()
// the old infinite-sky shiny reflection
//
- float sa = dot(refnormpersp, sun_dir.xyz);
+ float sa_sun = dot(refnormpersp, sun_dir.xyz);
+ float sa_moon = dot(refnormpersp, moon_dir.xyz);
+ float sa = max(sa_sun, sa_moon);
vec3 dumbshiny = sunlit*scol_ambocc.r*(texture2D(lightFunc, vec2(sa, spec.a)).r);
// add the two types of shiny together
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index aa5e99a2f7..11ccdf638c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -59,6 +59,7 @@ uniform mat4 inv_proj;
uniform vec2 screen_res;
uniform vec2 proj_shadow_res;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
uniform vec2 shadow_res;
uniform float shadow_bias;
@@ -139,10 +140,14 @@ void main()
}*/
float shadow = 0.0;
- float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
+ float da_sun = dot(norm, sun_dir.xyz);
+ float da_moon = dot(norm, moon_dir.xyz);
+ float da = max(da_sun, da_moon);
+
+ float dp_directional_light = max(0.0, da);
vec3 shadow_pos = pos.xyz;
- vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
+ vec3 offset = ((da_sun > da_moon) ? sun_dir.xyz : moon_dir.xyz) * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 58f3f2f91e..4fccb1d33c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -59,6 +59,7 @@ uniform mat4 inv_proj;
uniform vec2 screen_res;
uniform vec2 proj_shadow_res;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
uniform vec2 shadow_res;
@@ -200,10 +201,13 @@ void main()
}*/
float shadow = 0.0;
- float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
+ float da_sun = dot(norm, sun_dir.xyz);
+ float da_moon = dot(norm, moon_dir.xyz);
+ float da = max(da_sun, da_moon);
+ float dp_directional_light = max(0.0, da);
vec3 shadow_pos = pos.xyz;
- vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
+ vec3 offset = ((da_sun > da_moon) ? sun_dir.xyz : moon_dir.xyz) * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
index a439aa64d7..0fb990611e 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
@@ -34,6 +34,7 @@ in vec3 view_dir;
uniform vec3 cameraPosLocal;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
uniform float sun_size;
uniform sampler2D transmittance_texture;
@@ -42,9 +43,9 @@ uniform sampler3D single_mie_scattering_texture;
uniform sampler2D irradiance_texture;
vec3 GetSolarLuminance();
-vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 sun_dir, out vec3 transmittance);
-vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 sun_dir, out vec3 transmittance);
-vec3 GetSunAndSkyIlluminance(vec3 pos, vec3 norm, vec3 sun_dir, out vec3 sky_irradiance);
+vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 dir, out vec3 transmittance);
+vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir, out vec3 transmittance);
+vec3 GetSunAndSkyIlluminance(vec3 pos, vec3 norm, vec3 dir, out vec3 sky_irradiance);
void main()
{
@@ -55,8 +56,9 @@ void main()
vec3 camPos = cameraPosLocal + vec3(0, 0, 6360.0f);
vec3 transmittance;
vec3 sky_illum;
- vec3 radiance = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance);
- vec3 radiance2 = GetSunAndSkyIlluminance(camPos, view_direction, sun_direction, sky_illum);
+
+ vec3 radiance_sun = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance);
+ vec3 radiance2_sun = GetSunAndSkyIlluminance(camPos, view_direction, sun_direction, sky_illum);
radiance *= transmittance;
diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl
index fed3edf7de..bdb54a1d63 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl
@@ -33,6 +33,7 @@ in vec3 view_dir;
uniform vec3 cameraPosLocal;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
uniform float sun_size;
uniform sampler2D transmittance_texture;
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 0126f1e2ca..4b77e18c15 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -151,11 +151,13 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca
sky_shader->bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance());
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- LLVector4 light_dir = LLEnvironment::instance().getClampedLightNorm();
+ LLVector4 sun_dir = LLEnvironment::instance().getClampedSunNorm();
+ LLVector4 moon_dir = LLEnvironment::instance().getClampedMoonNorm();
F32 sunSize = (float)cosf(psky->getSunArcRadians());
sky_shader->uniform1f(LLShaderMgr::SUN_SIZE, sunSize);
- sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, light_dir.mV);
+ sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, sun_dir.mV);
+ sky_shader->uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, moon_dir.mV);
// clouds are rendered along with sky in adv atmo
if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && gSky.mVOSkyp->getCloudNoiseTex())
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index a5ee7d0737..f0bec2fda1 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -700,6 +700,18 @@ void LLEnvironment::updateEnvironment(LLSettingsBase::Seconds transition, bool f
}
}
+LLVector4 LLEnvironment::toCFR(const LLVector3 vec) const
+{
+ LLVector4 vec_cfr(vec.mV[1], vec.mV[0], vec.mV[2], 0.0f);
+ return vec_cfr;
+}
+
+LLVector4 LLEnvironment::toLightNorm(const LLVector3 vec) const
+{
+ LLVector4 vec_ogl(vec.mV[1], vec.mV[2], vec.mV[0], 0.0f);
+ return vec_ogl;
+}
+
LLVector3 LLEnvironment::getLightDirection() const
{
LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
@@ -710,16 +722,24 @@ LLVector3 LLEnvironment::getLightDirection() const
return psky->getLightDirection();
}
-LLVector4 LLEnvironment::toCFR(const LLVector3 vec) const
+LLVector3 LLEnvironment::getSunDirection() const
{
- LLVector4 vec_cfr(vec.mV[1], vec.mV[0], vec.mV[2], 0.0f);
- return vec_cfr;
+ LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
+ if (!psky)
+ {
+ return LLVector3(0, 0, 1);
+ }
+ return psky->getSunDirection();
}
-LLVector4 LLEnvironment::toLightNorm(const LLVector3 vec) const
+LLVector3 LLEnvironment::getMoonDirection() const
{
- LLVector4 vec_ogl(vec.mV[1], vec.mV[2], vec.mV[0], 0.0f);
- return vec_ogl;
+ LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky();
+ if (!psky)
+ {
+ return LLVector3(0, 0, -1);
+ }
+ return psky->getMoonDirection();
}
LLVector4 LLEnvironment::getLightDirectionCFR() const
@@ -729,6 +749,20 @@ LLVector4 LLEnvironment::getLightDirectionCFR() const
return light_direction_cfr;
}
+LLVector4 LLEnvironment::getSunDirectionCFR() const
+{
+ LLVector3 light_direction = getSunDirection();
+ LLVector4 light_direction_cfr = toCFR(light_direction);
+ return light_direction_cfr;
+}
+
+LLVector4 LLEnvironment::getMoonDirectionCFR() const
+{
+ LLVector3 light_direction = getMoonDirection();
+ LLVector4 light_direction_cfr = toCFR(light_direction);
+ return light_direction_cfr;
+}
+
LLVector4 LLEnvironment::getClampedLightNorm() const
{
LLVector3 light_direction = getLightDirection();
@@ -739,6 +773,26 @@ LLVector4 LLEnvironment::getClampedLightNorm() const
return toLightNorm(light_direction);
}
+LLVector4 LLEnvironment::getClampedSunNorm() const
+{
+ LLVector3 light_direction = getSunDirection();
+ if (light_direction.mV[2] < -0.1f)
+ {
+ light_direction.mV[2] = -0.1f;
+ }
+ return toLightNorm(light_direction);
+}
+
+LLVector4 LLEnvironment::getClampedMoonNorm() const
+{
+ LLVector3 light_direction = getMoonDirection();
+ if (light_direction.mV[2] < -0.1f)
+ {
+ light_direction.mV[2] = -0.1f;
+ }
+ return toLightNorm(light_direction);
+}
+
LLVector4 LLEnvironment::getRotatedLightNorm() const
{
LLVector3 light_direction = getLightDirection();
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index 9da6de60ae..0fdedb91f7 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -193,14 +193,20 @@ public:
// Returns either sun or moon direction (depending on which is up and stronger)
// Light direction in +x right, +z up, +y at internal coord sys
- LLVector3 getLightDirection() const;
+ LLVector3 getLightDirection() const; // returns sun or moon depending on which is up
+ LLVector3 getSunDirection() const;
+ LLVector3 getMoonDirection() const;
// Returns light direction converted to CFR coord system
- LLVector4 getLightDirectionCFR() const;
+ LLVector4 getLightDirectionCFR() const; // returns sun or moon depending on which is up
+ LLVector4 getSunDirectionCFR() const;
+ LLVector4 getMoonDirectionCFR() const;
// Returns light direction converted to OGL coord system
// and clamped above -0.1f in Y to avoid render artifacts in sky shaders
- LLVector4 getClampedLightNorm() const;
+ LLVector4 getClampedLightNorm() const; // returns sun or moon depending on which is up
+ LLVector4 getClampedSunNorm() const;
+ LLVector4 getClampedMoonNorm() const;
// Returns light direction converted to OGL coord system
// and rotated by last cam yaw needed by water rendering shaders
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 5a6af85334..38e45dd6d5 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -410,7 +410,9 @@ void LLFloaterEditExtDayCycle::onTrackSelectionCallback(const LLSD& user_data)
void LLFloaterEditExtDayCycle::onPlayActionCallback(const LLSD& user_data)
{
std::string action = user_data.asString();
+
F32 frame = mTimeSlider->getCurSliderValue();
+
if (action == ACTION_PLAY)
{
startPlay();
@@ -424,13 +426,13 @@ void LLFloaterEditExtDayCycle::onPlayActionCallback(const LLSD& user_data)
F32 new_frame = 0;
if (action == ACTION_FORWARD)
{
- new_frame = mEditDay->getUpperBoundFrame(mCurrentTrack, frame);
+ new_frame = mEditDay->getUpperBoundFrame(mCurrentTrack, frame + (mTimeSlider->getIncrement() / 2));
}
else if (action == ACTION_BACK)
{
new_frame = mEditDay->getLowerBoundFrame(mCurrentTrack, frame - (mTimeSlider->getIncrement() / 2));
}
- selectFrame(new_frame);
+ selectFrame(new_frame, 0.0f);
stopPlay();
}
}
@@ -538,12 +540,12 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask)
LL_WARNS("LAPRAS") << " UP: X=" << x << " Y=" << y << " MASK=" << mask << " Position=" << sliderpos << LL_ENDL;
mTimeSlider->setCurSliderValue(sliderpos);
- selectFrame(sliderpos);
+ selectFrame(sliderpos, FRAME_SLOP_FACTOR);
}
void LLFloaterEditExtDayCycle::onTimeSliderMoved()
{
- selectFrame(mTimeSlider->getCurSliderValue());
+ selectFrame(mTimeSlider->getCurSliderValue(), FRAME_SLOP_FACTOR);
}
void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force )
@@ -566,16 +568,16 @@ void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force )
updateSlider();
}
-void LLFloaterEditExtDayCycle::selectFrame(F32 frame)
+void LLFloaterEditExtDayCycle::selectFrame(F32 frame, F32 slop_factor)
{
mFramesSlider->resetCurSlider();
-
keymap_t::iterator iter = mSliderKeyMap.begin();
keymap_t::iterator end_iter = mSliderKeyMap.end();
while (iter != end_iter)
{
- if (fabs(iter->second.mFrame - frame) <= FRAME_SLOP_FACTOR)
+ F32 keyframe = iter->second.mFrame;
+ if (fabs(keyframe - frame) <= slop_factor)
{
mFramesSlider->setCurSlider(iter->first);
frame = iter->second.mFrame;
@@ -587,6 +589,7 @@ void LLFloaterEditExtDayCycle::selectFrame(F32 frame)
mTimeSlider->setCurSliderValue(frame);
// block or update tabs according to new selection
updateTabs();
+ LLEnvironment::instance().updateEnvironment();
}
void LLFloaterEditExtDayCycle::clearTabs()
@@ -685,11 +688,16 @@ void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable)
void LLFloaterEditExtDayCycle::updateButtons()
{
- LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue());
- LLSettingsBase::ptr_t settings = mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack);
- bool can_add = static_cast<bool>(settings);
- mAddFrameButton->setEnabled(can_add);
- mDeleteFrameButton->setEnabled(!can_add);
+ // This logic appears to work in reverse, the add frame button
+ // is only enabled when you're on an existing frame and disabled
+ // in all the interim positions where you'd want to add a frame...
+ //LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue());
+ //LLSettingsBase::ptr_t settings = mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack);
+ //bool can_add = static_cast<bool>(settings);
+ //mAddFrameButton->setEnabled(can_add);
+ //mDeleteFrameButton->setEnabled(!can_add);
+ mAddFrameButton->setEnabled(true);
+ mDeleteFrameButton->setEnabled(true);
}
void LLFloaterEditExtDayCycle::updateSlider()
@@ -717,7 +725,7 @@ void LLFloaterEditExtDayCycle::updateSlider()
mLastFrameSlider.clear();
}
- selectFrame(frame_position);
+ selectFrame(frame_position, FRAME_SLOP_FACTOR);
}
void LLFloaterEditExtDayCycle::updateTimeAndLabel()
@@ -1101,7 +1109,7 @@ void LLFloaterEditExtDayCycle::stopPlay()
gIdleCallbacks.deleteFunction(onIdlePlay, this);
mPlayTimer.stop();
F32 frame = mTimeSlider->getCurSliderValue();
- selectFrame(frame);
+ selectFrame(frame, FRAME_SLOP_FACTOR);
getChild<LLView>("play_layout", true)->setVisible(TRUE);
getChild<LLView>("pause_layout", true)->setVisible(FALSE);
diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h
index 0ec5e91b4d..94b2d6c21b 100644
--- a/indra/newview/llfloatereditextdaycycle.h
+++ b/indra/newview/llfloatereditextdaycycle.h
@@ -79,6 +79,8 @@ public:
private:
+ F32 getCurrentFrame() const;
+
// flyout response/click
void onButtonApply(LLUICtrl *ctrl, const LLSD &data);
void onBtnCancel();
@@ -98,7 +100,7 @@ private:
void onFrameSliderMouseUp(S32 x, S32 y, MASK mask);
void selectTrack(U32 track_index, bool force = false);
- void selectFrame(F32 frame);
+ void selectFrame(F32 frame, F32 slop_factor);
void clearTabs();
void updateTabs();
void updateWaterTabs(const LLSettingsWaterPtr_t &p_water);
diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp
index 59cfab61fd..36460475a8 100644
--- a/indra/newview/lllegacyatmospherics.cpp
+++ b/indra/newview/lllegacyatmospherics.cpp
@@ -267,7 +267,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
F32 density_multiplier = psky->getDensityMultiplier();
F32 max_y = psky->getMaxY();
- LLVector3 lightnorm = LLVector3(LLEnvironment::instance().getClampedLightNorm());
+ LLVector3 sun_norm = LLVector3(LLEnvironment::instance().getClampedSunNorm());
// project the direction ray onto the sky dome.
F32 phi = acos(Pn[1]);
@@ -316,7 +316,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
LLColor3 haze_weight = componentDiv(smear(haze_density), temp1);
// Compute sunlight from P & lightnorm (for long rays like sky)
- temp2.mV[1] = llmax(F_APPROXIMATELY_ZERO, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] );
+ temp2.mV[1] = llmax(F_APPROXIMATELY_ZERO, llmax(0.f, Pn[1]) * 1.0f + sun_norm[1] );
temp2.mV[1] = 1.f / temp2.mV[1];
componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1]));
@@ -329,7 +329,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
// Compute haze glow
- temp2.mV[0] = Pn * lightnorm;
+ temp2.mV[0] = Pn * sun_norm;
temp2.mV[0] = 1.f - temp2.mV[0];
// temp2.x is 0 at the sun and increases away from sun
@@ -360,7 +360,7 @@ void LLAtmospherics::calcSkyColorWLVert(LLVector3 & Pn, AtmosphericsVars& vars)
componentMultBy(vars.hazeColor, LLColor3::white - temp1);
sunlight = psky->getSunlightColor();
- temp2.mV[1] = llmax(0.f, lightnorm[1] * 2.f);
+ temp2.mV[1] = llmax(0.f, sun_norm[1] * 2.f);
temp2.mV[1] = 1.f / temp2.mV[1];
componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1]));
diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp
index e5c6116c4f..dc724ce9c7 100644
--- a/indra/newview/llpaneleditsky.cpp
+++ b/indra/newview/llpaneleditsky.cpp
@@ -374,19 +374,23 @@ void LLPanelSettingsSkySunMoonTab::onStarBrightnessChanged()
void LLPanelSettingsSkySunMoonTab::onSunRotationChanged()
{
mSkySettings->setSunRotation(getChild<LLJoystickQuaternion>(FIELD_SKY_SUN_ROTATION)->getRotation());
+ mSkySettings->update();
}
void LLPanelSettingsSkySunMoonTab::onSunImageChanged()
{
mSkySettings->setSunTextureId(getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->getValue().asUUID());
+ mSkySettings->update();
}
void LLPanelSettingsSkySunMoonTab::onMoonRotationChanged()
{
mSkySettings->setMoonRotation(getChild<LLJoystickQuaternion>(FIELD_SKY_MOON_ROTATION)->getRotation());
+ mSkySettings->update();
}
void LLPanelSettingsSkySunMoonTab::onMoonImageChanged()
{
mSkySettings->setMoonTextureId(getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->getValue().asUUID());
+ mSkySettings->update();
}
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 95bcf127ae..23c77c8a25 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -529,7 +529,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget)
{
LLGLSLShader *shader = (LLGLSLShader *)ptarget;
- LLVector4 light_direction = LLEnvironment::instance().getClampedLightNorm();
+ LLVector4 light_direction = LLEnvironment::instance().getClampedSunNorm();
if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT)
{
@@ -538,7 +538,6 @@ void LLSettingsVOSky::applySpecial(void *ptarget)
}
else if (shader->mShaderGroup == LLGLSLShader::SG_SKY)
{
- LLVector4 light_direction = LLEnvironment::instance().getClampedLightNorm();
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV);
LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 27db6778eb..7be05a1bcb 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -6258,8 +6258,11 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
// Light 0 = Sun or Moon (All objects)
{
- LLVector4 light_dir = environment.getLightDirectionCFR();
- mSunDir.setVec(light_dir);
+ LLVector4 sun_dir = environment.getSunDirectionCFR();
+ LLVector4 moon_dir = environment.getMoonDirectionCFR();
+
+ mSunDir.setVec(sun_dir);
+ mMoonDir.setVec(moon_dir);
if (environment.getIsSunUp())
{
@@ -6282,7 +6285,14 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
mHWLightColors[0] = light_diffuse;
LLLightState* light = gGL.getLight(0);
- light->setPosition(mSunDir);
+ if (environment.getIsSunUp())
+ {
+ light->setPosition(mSunDir);
+ }
+ else
+ {
+ light->setPosition(mMoonDir);
+ }
light->setDiffuse(light_diffuse);
light->setAmbient(LLColor4::black);
light->setSpecular(LLColor4::black);
@@ -8377,6 +8387,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n
shader.uniform1f(LLShaderMgr::DEFERRED_SPOT_SHADOW_BIAS, RenderSpotShadowBias);
shader.uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, mTransformedSunDir.mV);
+ shader.uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, mTransformedMoonDir.mV);
shader.uniform2f(LLShaderMgr::DEFERRED_SHADOW_RES, mShadow[0].getWidth(), mShadow[0].getHeight());
shader.uniform2f(LLShaderMgr::DEFERRED_PROJ_SHADOW_RES, mShadow[4].getWidth(), mShadow[4].getHeight());
shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
@@ -8465,10 +8476,13 @@ void LLPipeline::renderDeferredLighting()
vert[2].set(3,1,0);
{
- setupHWLights(NULL); //to set mSunDir;
+ setupHWLights(NULL); //to set mSun/MoonDir;
glh::vec4f tc(mSunDir.mV);
mat.mult_matrix_vec(tc);
mTransformedSunDir.set(tc.v);
+
+ glh::vec4f tc_moon(mMoonDir.mV);
+ mTransformedMoonDir.set(tc_moon.v);
}
gGL.pushMatrix();
@@ -9078,10 +9092,13 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target)
vert[2].set(3,1,0);
{
- setupHWLights(NULL); //to set mSunDir;
+ setupHWLights(NULL); //to set mSun/MoonDir;
glh::vec4f tc(mSunDir.mV);
mat.mult_matrix_vec(tc);
mTransformedSunDir.set(tc.v);
+
+ glh::vec4f tc_moon(mMoonDir.mV);
+ mTransformedMoonDir.set(tc_moon.v);
}
gGL.pushMatrix();
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 43aa7d891e..d17bab775d 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -657,7 +657,10 @@ public:
LLColor4 mSunDiffuse;
LLVector4 mSunDir;
+ LLVector4 mMoonDir;
+
LLVector4 mTransformedSunDir;
+ LLVector4 mTransformedMoonDir;
bool mInitialized;
bool mVertexShadersEnabled;