summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llinventory/llsettingssky.cpp74
-rw-r--r--indra/llinventory/llsettingssky.h16
-rw-r--r--indra/llrender/llshadermgr.cpp7
-rw-r--r--indra/llrender/llshadermgr.h9
-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/app_settings/shaders/class3/deferred/skyF.glsl40
-rw-r--r--indra/newview/app_settings/windlight/corona_lut.pngbin6129 -> 0 bytes
-rw-r--r--indra/newview/app_settings/windlight/rainbow_lut.pngbin200088 -> 0 bytes
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp39
-rw-r--r--indra/newview/llfloaterregioninfo.cpp1
-rw-r--r--indra/newview/llpaneleditsky.cpp56
-rw-r--r--indra/newview/llpaneleditsky.h4
-rw-r--r--indra/newview/llsettingsvo.cpp4
-rw-r--r--indra/newview/llviewermenu.cpp15
-rw-r--r--indra/newview/llviewershadermgr.cpp10
-rw-r--r--indra/newview/llvosky.cpp5
-rw-r--r--indra/newview/llvosky.h21
-rw-r--r--indra/newview/llworld.cpp51
-rw-r--r--indra/newview/llworld.h3
-rw-r--r--indra/newview/pipeline.cpp57
-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_density.xml56
-rw-r--r--indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml29
24 files changed, 461 insertions, 75 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index f298a9cbc7..dd3a76be31 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -37,6 +37,8 @@ namespace {
const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees
const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD);
const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef");
+ const LLUUID IMG_RAINBOW("12149143-f599-91a7-77ac-b52a3c0f59cd");
+ const LLUUID IMG_HALO("11b4c57c-56b3-04ed-1f82-2004363882e4");
}
namespace {
@@ -80,6 +82,8 @@ const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density");
const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon");
const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id");
+const std::string LLSettingsSky::SETTING_RAINBOW_TEXTUREID("rainbow_id");
+const std::string LLSettingsSky::SETTING_HALO_TEXTUREID("halo_id");
const std::string LLSettingsSky::SETTING_CLOUD_COLOR("cloud_color");
const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY1("cloud_pos_density1");
const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY2("cloud_pos_density2");
@@ -98,6 +102,8 @@ const std::string LLSettingsSky::SETTING_MAX_Y("max_y");
const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation");
const std::string LLSettingsSky::SETTING_MOON_SCALE("moon_scale");
const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id");
+const std::string LLSettingsSky::SETTING_MOON_BRIGHTNESS("moon_brightness");
+
const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness");
const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color");
const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation");
@@ -127,6 +133,7 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_ter
const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term");
const std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level");
+const std::string LLSettingsSky::SETTING_SKY_DROPLET_RADIUS("droplet_radius");
const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level");
const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("ff64f04e-097f-40bc-9063-d8d48c308739");
@@ -391,7 +398,9 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) :
mNextSunTextureId(),
mNextMoonTextureId(),
mNextCloudTextureId(),
- mNextBloomTextureId()
+ mNextBloomTextureId(),
+ mNextRainbowTextureId(),
+ mNextHaloTextureId()
{
}
@@ -400,7 +409,9 @@ LLSettingsSky::LLSettingsSky():
mNextSunTextureId(),
mNextMoonTextureId(),
mNextCloudTextureId(),
- mNextBloomTextureId()
+ mNextBloomTextureId(),
+ mNextRainbowTextureId(),
+ mNextHaloTextureId()
{
}
@@ -411,6 +422,8 @@ void LLSettingsSky::replaceSettings(LLSD settings)
mNextMoonTextureId.setNull();
mNextCloudTextureId.setNull();
mNextBloomTextureId.setNull();
+ mNextRainbowTextureId.setNull();
+ mNextHaloTextureId.setNull();
}
void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
@@ -426,6 +439,8 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
mNextMoonTextureId = other->getMoonTextureId();
mNextCloudTextureId = other->getCloudNoiseTextureId();
mNextBloomTextureId = other->getBloomTextureId();
+ mNextRainbowTextureId = other->getRainbowTextureId();
+ mNextHaloTextureId = other->getHaloTextureId();
}
else
{
@@ -500,6 +515,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList()
validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID));
+ validation.push_back(Validator(SETTING_RAINBOW_TEXTUREID, false, LLSD::TypeUUID));
+ validation.push_back(Validator(SETTING_HALO_TEXTUREID, false, LLSD::TypeUUID));
+
validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray,
boost::bind(&Validator::verifyVectorMinMax, _1,
LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")),
@@ -539,6 +557,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList()
validation.push_back(Validator(SETTING_MOON_SCALE, false, LLSD::TypeReal,
boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0)));
validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID));
+ validation.push_back(Validator(SETTING_MOON_BRIGHTNESS, false, LLSD::TypeReal,
+ boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f)))));
+
validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal,
boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(500.0f)))));
validation.push_back(Validator(SETTING_SUNLIGHT_COLOR, true, LLSD::TypeArray,
@@ -565,6 +586,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList()
validation.push_back(Validator(SETTING_SKY_MOISTURE_LEVEL, false, LLSD::TypeReal,
boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f)))));
+ validation.push_back(Validator(SETTING_SKY_DROPLET_RADIUS, false, LLSD::TypeReal,
+ boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(5.0f)(1000.0f)))));
+
validation.push_back(Validator(SETTING_SKY_ICE_LEVEL, false, LLSD::TypeReal,
boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f)))));
@@ -667,6 +691,9 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position)
dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605);
dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue();
+ dfltsetting[SETTING_MOON_BRIGHTNESS] = LLSD::Real(0.5f);
+ dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId();
+
dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(256.0000);
dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue();
dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue();
@@ -675,6 +702,8 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position)
dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId();
dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId();
dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId();
+ dfltsetting[SETTING_RAINBOW_TEXTUREID] = GetDefaultRainbowTextureId();
+ dfltsetting[SETTING_HALO_TEXTUREID] = GetDefaultHaloTextureId();
dfltsetting[SETTING_TYPE] = "sky";
@@ -685,6 +714,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position)
dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00045f;
dfltsetting[SETTING_SKY_MOISTURE_LEVEL] = 0.0f;
+ dfltsetting[SETTING_SKY_DROPLET_RADIUS] = 800.0f;
dfltsetting[SETTING_SKY_ICE_LEVEL] = 0.0f;
dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault();
@@ -995,6 +1025,11 @@ void LLSettingsSky::setSkyMoistureLevel(F32 moisture_level)
mSettings[SETTING_SKY_MOISTURE_LEVEL] = moisture_level;
}
+void LLSettingsSky::setSkyDropletRadius(F32 radius)
+{
+ mSettings[SETTING_SKY_DROPLET_RADIUS] = radius;
+}
+
void LLSettingsSky::setSkyIceLevel(F32 ice_level)
{
mSettings[SETTING_SKY_ICE_LEVEL] = ice_level;
@@ -1190,6 +1225,16 @@ LLUUID LLSettingsSky::GetDefaultBloomTextureId()
return IMG_BLOOM1;
}
+LLUUID LLSettingsSky::GetDefaultRainbowTextureId()
+{
+ return IMG_RAINBOW;
+}
+
+LLUUID LLSettingsSky::GetDefaultHaloTextureId()
+{
+ return IMG_HALO;
+}
+
F32 LLSettingsSky::getPlanetRadius() const
{
return mSettings[SETTING_PLANET_RADIUS].asReal();
@@ -1200,6 +1245,11 @@ F32 LLSettingsSky::getSkyMoistureLevel() const
return mSettings[SETTING_SKY_MOISTURE_LEVEL].asReal();
}
+F32 LLSettingsSky::getSkyDropletRadius() const
+{
+ return mSettings[SETTING_SKY_DROPLET_RADIUS].asReal();
+}
+
F32 LLSettingsSky::getSkyIceLevel() const
{
return mSettings[SETTING_SKY_ICE_LEVEL].asReal();
@@ -1278,6 +1328,16 @@ LLUUID LLSettingsSky::getBloomTextureId() const
return mSettings[SETTING_BLOOM_TEXTUREID].asUUID();
}
+LLUUID LLSettingsSky::getRainbowTextureId() const
+{
+ return mSettings[SETTING_RAINBOW_TEXTUREID].asUUID();
+}
+
+LLUUID LLSettingsSky::getHaloTextureId() const
+{
+ return mSettings[SETTING_HALO_TEXTUREID].asUUID();
+}
+
//---------------------------------------------------------------------
LLColor3 LLSettingsSky::getAmbientColor() const
{
@@ -1444,6 +1504,16 @@ void LLSettingsSky::setMoonTextureId(LLUUID id)
setValue(SETTING_MOON_TEXTUREID, id);
}
+F32 LLSettingsSky::getMoonBrightness() const
+{
+ return mSettings[SETTING_MOON_BRIGHTNESS].asReal();
+}
+
+void LLSettingsSky::setMoonBrightness(F32 brightness_factor)
+{
+ setValue(SETTING_MOON_BRIGHTNESS, brightness_factor);
+}
+
F32 LLSettingsSky::getStarBrightness() const
{
return mSettings[SETTING_STAR_BRIGHTNESS].asReal();
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 2052908bd3..89dd6d20fd 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -42,6 +42,8 @@ class LLSettingsSky: public LLSettingsBase
public:
static const std::string SETTING_AMBIENT;
static const std::string SETTING_BLOOM_TEXTUREID;
+ static const std::string SETTING_RAINBOW_TEXTUREID;
+ static const std::string SETTING_HALO_TEXTUREID;
static const std::string SETTING_BLUE_DENSITY;
static const std::string SETTING_BLUE_HORIZON;
static const std::string SETTING_DENSITY_MULTIPLIER;
@@ -64,6 +66,8 @@ public:
static const std::string SETTING_MOON_ROTATION;
static const std::string SETTING_MOON_SCALE;
static const std::string SETTING_MOON_TEXTUREID;
+ static const std::string SETTING_MOON_BRIGHTNESS;
+
static const std::string SETTING_STAR_BRIGHTNESS;
static const std::string SETTING_SUNLIGHT_COLOR;
static const std::string SETTING_SUN_ROTATION;
@@ -88,6 +92,7 @@ public:
static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM;
static const std::string SETTING_SKY_MOISTURE_LEVEL;
+ static const std::string SETTING_SKY_DROPLET_RADIUS;
static const std::string SETTING_SKY_ICE_LEVEL;
static const std::string SETTING_LEGACY_HAZE;
@@ -120,6 +125,7 @@ public:
F32 getMieAnisotropy() const;
F32 getSkyMoistureLevel() const;
+ F32 getSkyDropletRadius() const;
F32 getSkyIceLevel() const;
// Return first (only) profile layer represented in LLSD
@@ -133,6 +139,8 @@ public:
LLSD getAbsorptionConfigs() const;
LLUUID getBloomTextureId() const;
+ LLUUID getRainbowTextureId() const;
+ LLUUID getHaloTextureId() const;
void setRayleighConfigs(const LLSD& rayleighConfig);
void setMieConfigs(const LLSD& mieConfig);
@@ -145,6 +153,7 @@ public:
void setMieAnisotropy(F32 aniso_factor);
void setSkyMoistureLevel(F32 moisture_level);
+ void setSkyDropletRadius(F32 radius);
void setSkyIceLevel(F32 ice_level);
//---------------------------------------------------------------------
@@ -198,6 +207,9 @@ public:
LLUUID getMoonTextureId() const;
void setMoonTextureId(LLUUID id);
+ F32 getMoonBrightness() const;
+ void setMoonBrightness(F32 brightness_factor);
+
F32 getStarBrightness() const;
void setStarBrightness(F32 val);
@@ -272,6 +284,8 @@ public:
static LLUUID GetDefaultMoonTextureId();
static LLUUID GetDefaultCloudNoiseTextureId();
static LLUUID GetDefaultBloomTextureId();
+ static LLUUID GetDefaultRainbowTextureId();
+ static LLUUID GetDefaultHaloTextureId();
static LLSD createDensityProfileLayer(
F32 width,
@@ -326,6 +340,8 @@ private:
LLUUID mNextMoonTextureId;
LLUUID mNextCloudTextureId;
LLUUID mNextBloomTextureId;
+ LLUUID mNextRainbowTextureId;
+ LLUUID mNextHaloTextureId;
typedef std::map<std::string, S32> mapNameToUniformId_t;
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 3c25d6aaa8..3927632dbe 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1320,6 +1320,13 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("irradiance_texture");
mReservedUniforms.push_back("blend_factor");
mReservedUniforms.push_back("no_atmo");
+ mReservedUniforms.push_back("moisture_level");
+ mReservedUniforms.push_back("droplet_radius");
+ mReservedUniforms.push_back("ice_level");
+ mReservedUniforms.push_back("rainbow_map");
+ mReservedUniforms.push_back("halo_map");
+ mReservedUniforms.push_back("moon_brightness");
+ mReservedUniforms.push_back("moon_phase");
llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS);
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index 7898b2d90a..489caa49ae 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -234,6 +234,15 @@ public:
BLEND_FACTOR,
NO_ATMO,
+ MOISTURE_LEVEL,
+ DROPLET_RADIUS,
+ ICE_LEVEL,
+ RAINBOW_MAP,
+ HALO_MAP,
+
+ MOON_BRIGHTNESS,
+ MOON_PHASE,
+
END_RESERVED_UNIFORMS
} eGLSLReservedUniforms;
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/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
index 7bfc114383..2073fc066f 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
@@ -42,25 +42,46 @@ uniform sampler2D transmittance_texture;
uniform sampler3D scattering_texture;
uniform sampler3D single_mie_scattering_texture;
uniform sampler2D irradiance_texture;
+uniform sampler2D rainbow_map;
+uniform sampler2D halo_map;
+
+uniform float moisture_level;
+uniform float droplet_radius;
+uniform float ice_level;
vec3 GetSolarLuminance();
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 rainbow(float d)
+{
+ float rad = (droplet_radius - 5.0f) / 1024.0f;
+ return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level;
+}
+
+vec3 halo22(float d)
+{
+ float v = sqrt(max(0, 1 - (d*d)));
+ return texture2D(halo_map, vec2(0, v)).rgb * ice_level;
+}
+
void main()
{
- vec3 pos = vec3((vary_frag * 2.0) - vec2(1.0, 1.0), 0.0);
+ vec3 pos = vec3((vary_frag * 2.0) - vec2(1.0, 1.0f), 1.0);
vec4 view_pos = (inv_proj * vec4(pos, 1.0f));
+
view_pos /= view_pos.w;
- vec3 view_ray = (inv_modelview * vec4(view_pos.xyz, 0.0f)).xyz;
+
+ vec3 view_ray = (inv_modelview * vec4(view_pos.xyz, 0.0f)).xyz + camPosLocal;
vec3 view_direction = normalize(view_ray);
vec3 sun_direction = normalize(sun_dir);
+ vec3 earth_center = vec3(0, 0, -6360.0f);
+ vec3 camPos = (camPosLocal / 1000.0f) - earth_center;
- vec3 camPos = (camPosLocal / 1000.0f) + vec3(0, 0, 6360.0f);
vec3 transmittance;
vec3 radiance_sun = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance);
- vec3 solar_luminance = transmittance * GetSolarLuminance();
+ vec3 solar_luminance = GetSolarLuminance();
// If the view ray intersects the Sun, add the Sun radiance.
float s = dot(view_direction, sun_direction);
@@ -68,12 +89,21 @@ void main()
// cheesy solar disc...
if (s >= (sun_size * 0.999))
{
- radiance_sun += pow(smoothstep(0.0, 1.3, (s - (sun_size * 0.9))), 2.0) * solar_luminance;
+ radiance_sun += pow(smoothstep(0.0, 1.3, (s - (sun_size * 0.9))), 2.0) * solar_luminance * transmittance;
}
s = smoothstep(0.9, 1.0, s) * 16.0f;
vec3 color = vec3(1.0) - exp(-radiance_sun * 0.0001);
+ float optic_d = dot(view_direction, sun_direction);
+
+ vec3 halo_22 = halo22(optic_d);
+
+ if (optic_d <= 0)
+ color.rgb += rainbow(optic_d);
+
+ color.rgb += halo_22;
+
color = pow(color, vec3(1.0 / 2.2));
frag_data[0] = vec4(color, 1.0 + s);
diff --git a/indra/newview/app_settings/windlight/corona_lut.png b/indra/newview/app_settings/windlight/corona_lut.png
deleted file mode 100644
index c4843667d9..0000000000
--- a/indra/newview/app_settings/windlight/corona_lut.png
+++ /dev/null
Binary files differ
diff --git a/indra/newview/app_settings/windlight/rainbow_lut.png b/indra/newview/app_settings/windlight/rainbow_lut.png
deleted file mode 100644
index 4bede25649..0000000000
--- a/indra/newview/app_settings/windlight/rainbow_lut.png
+++ /dev/null
Binary files differ
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 5104dc18fd..b89588a463 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -176,6 +176,13 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca
sky_shader->bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance());
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);
+
LLVector3 sun_dir = LLEnvironment::instance().getSunDirection();
LLVector3 moon_dir = LLEnvironment::instance().getMoonDirection();
@@ -184,6 +191,14 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca
sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, sun_dir.mV);
sky_shader->uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, moon_dir.mV);
+ 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);
+
llassert(sky_shader->getUniformLocation(LLShaderMgr::INVERSE_PROJECTION_MATRIX));
glh::matrix4f proj_mat = get_current_projection();
@@ -195,7 +210,7 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca
LLGLDisable cull(GL_CULL_FACE);
renderFsSky(camPosLocal, camHeightLocal, sky_shader);
-
+
sky_shader->unbind();
}
}
@@ -209,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);
@@ -469,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/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index c8ed43871d..4fd23252fa 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -191,6 +191,7 @@ public:
void refreshFromEstate();
virtual BOOL postBuild() override;
+ virtual void onOpen(const LLSD& key) override {};
virtual S32 getParcelId() override { return INVALID_PARCEL_ID; }
diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp
index 0d36fce90a..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");
@@ -92,6 +93,10 @@ namespace
const std::string FIELD_SKY_DENSITY_ABSORPTION_CONSTANT("absorption_constant");
const std::string FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE("absorption_max_altitude");
+ const std::string FIELD_SKY_DENSITY_MOISTURE_LEVEL("moisture_level");
+ const std::string FIELD_SKY_DENSITY_DROPLET_RADIUS("droplet_radius");
+ const std::string FIELD_SKY_DENSITY_ICE_LEVEL("ice_level");
+
const F32 SLIDER_SCALE_SUN_AMBIENT(3.0f);
const F32 SLIDER_SCALE_BLUE_HORIZON_DENSITY(2.0f);
const F32 SLIDER_SCALE_GLOW_R(20.0f);
@@ -394,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();
@@ -407,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()
@@ -434,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());
}
//-------------------------------------------------------------------------
@@ -509,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()
{
@@ -536,6 +552,10 @@ BOOL LLPanelSettingsSkyDensityTab::postBuild()
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAbsorptionMaxAltitudeChanged(); });
+ getChild<LLUICtrl>(FIELD_SKY_DENSITY_MOISTURE_LEVEL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoistureLevelChanged(); });
+ getChild<LLUICtrl>(FIELD_SKY_DENSITY_DROPLET_RADIUS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onDropletRadiusChanged(); });
+ getChild<LLUICtrl>(FIELD_SKY_DENSITY_ICE_LEVEL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onIceLevelChanged(); });
+
refresh();
return TRUE;
}
@@ -562,6 +582,11 @@ void LLPanelSettingsSkyDensityTab::setEnabled(BOOL enabled)
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_LINEAR)->setEnabled(enabled);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_CONSTANT)->setEnabled(enabled);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->setEnabled(enabled);
+
+ getChild<LLUICtrl>(FIELD_SKY_DENSITY_MOISTURE_LEVEL)->setEnabled(enabled);
+ getChild<LLUICtrl>(FIELD_SKY_DENSITY_DROPLET_RADIUS)->setEnabled(enabled);
+ getChild<LLUICtrl>(FIELD_SKY_DENSITY_ICE_LEVEL)->setEnabled(enabled);
+
}
void LLPanelSettingsSkyDensityTab::refresh()
@@ -600,6 +625,10 @@ void LLPanelSettingsSkyDensityTab::refresh()
F32 absorption_constant_term = absorption_config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal();
F32 absorption_max_alt = absorption_config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal();
+ F32 moisture_level = mSkySettings->getSkyMoistureLevel();
+ F32 droplet_radius = mSkySettings->getSkyDropletRadius();
+ F32 ice_level = mSkySettings->getSkyIceLevel();
+
getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL)->setValue(rayleigh_exponential_term);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE)->setValue(rayleigh_exponential_scale);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_LINEAR)->setValue(rayleigh_linear_term);
@@ -618,6 +647,10 @@ void LLPanelSettingsSkyDensityTab::refresh()
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_LINEAR)->setValue(absorption_linear_term);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_CONSTANT)->setValue(absorption_constant_term);
getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->setValue(absorption_max_alt);
+
+ getChild<LLUICtrl>(FIELD_SKY_DENSITY_MOISTURE_LEVEL)->setValue(moisture_level);
+ getChild<LLUICtrl>(FIELD_SKY_DENSITY_DROPLET_RADIUS)->setValue(droplet_radius);
+ getChild<LLUICtrl>(FIELD_SKY_DENSITY_ICE_LEVEL)->setValue(ice_level);
}
void LLPanelSettingsSkyDensityTab::updateProfile()
@@ -645,6 +678,10 @@ void LLPanelSettingsSkyDensityTab::updateProfile()
LLSD mie_config = LLSettingsSky::createSingleLayerDensityProfile(mie_max_alt, mie_exponential_term, mie_exponential_scale, mie_linear_term, mie_constant_term, mie_aniso_factor);
LLSD absorption_layer = LLSettingsSky::createSingleLayerDensityProfile(absorption_max_alt, absorption_exponential_term, absorption_exponential_scale, absorption_linear_term, absorption_constant_term);
+ F32 moisture_level = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MOISTURE_LEVEL)->getValueF32();
+ F32 droplet_radius = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_DROPLET_RADIUS)->getValueF32();
+ F32 ice_level = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ICE_LEVEL)->getValueF32();
+
static LLSD absorption_layer_ozone = LLSettingsSky::createDensityProfileLayer(0.0f, 0.0f, 0.0f, -1.0f / 15000.0f, 8.0f / 3.0f);
LLSD absorption_config;
@@ -654,7 +691,9 @@ void LLPanelSettingsSkyDensityTab::updateProfile()
mSkySettings->setRayleighConfigs(rayleigh_config);
mSkySettings->setMieConfigs(mie_config);
mSkySettings->setAbsorptionConfigs(absorption_config);
-
+ mSkySettings->setSkyMoistureLevel(moisture_level);
+ mSkySettings->setSkyDropletRadius(droplet_radius);
+ mSkySettings->setSkyIceLevel(ice_level);
mSkySettings->update();
setIsDirty();
@@ -745,3 +784,18 @@ void LLPanelSettingsSkyDensityTab::onAbsorptionMaxAltitudeChanged()
{
updateProfile();
}
+
+void LLPanelSettingsSkyDensityTab::onMoistureLevelChanged()
+{
+ updateProfile();
+}
+
+void LLPanelSettingsSkyDensityTab::onDropletRadiusChanged()
+{
+ updateProfile();
+}
+
+void LLPanelSettingsSkyDensityTab::onIceLevelChanged()
+{
+ updateProfile();
+}
diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h
index b34271f610..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();
};
@@ -158,6 +159,9 @@ protected:
void onAbsorptionLinearChanged();
void onAbsorptionConstantChanged();
void onAbsorptionMaxAltitudeChanged();
+ void onMoistureLevelChanged();
+ void onDropletRadiusChanged();
+ void onIceLevelChanged();
// update the settings for our profile type
void updateProfile();
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 8d66004ddb..386a5deec6 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -661,6 +661,10 @@ LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const
param_map[SETTING_MAX_Y] = LLShaderMgr::MAX_Y;
param_map[SETTING_SUNLIGHT_COLOR] = LLShaderMgr::SUNLIGHT_COLOR;
+ param_map[SETTING_SKY_MOISTURE_LEVEL] = LLShaderMgr::MOISTURE_LEVEL;
+ param_map[SETTING_SKY_DROPLET_RADIUS] = LLShaderMgr::DROPLET_RADIUS;
+ param_map[SETTING_SKY_ICE_LEVEL] = LLShaderMgr::ICE_LEVEL;
+
// AdvancedAtmospherics TODO
// Provide mappings for new shader params here
}
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 26f0ec7905..db18d6ed2c 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -8452,20 +8452,7 @@ class LLWorldEnvSettings : public view_listener_t
}
else if (event_name == "my_environs")
{
- LLUUID asset_id;
-
- LLSettingsBase::ptr_t cur(LLEnvironment::instance().getCurrentDay());
- if (!cur)
- {
- cur = LLEnvironment::instance().getCurrentSky();
- }
-
- if (cur)
- {
- asset_id = cur->getAssetId();
- }
-
- LLFloaterReg::showInstance("my_environments", LLSDMap("asset_id", LLSD::UUID(asset_id)));
+ LLFloaterReg::showInstance("my_environments");
}
return true;
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 3fdcac8917..b013250bfc 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -2110,10 +2110,12 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredWLSkyProgram.mName = "Deferred Windlight Sky Shader";
//gWLSkyProgram.mFeatures.hasGamma = true;
gDeferredWLSkyProgram.mShaderFiles.clear();
+ gDeferredWLSkyProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredWLSkyProgram.mFeatures.hasTransport = true;
gDeferredWLSkyProgram.mFeatures.hasGamma = true;
gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB));
- gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
+ gDeferredWLSkyProgram.mShaderLevel = gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics") ? 3 : mVertexShaderLevel[SHADER_DEFERRED];
gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
if (gAtmosphere && mVertexShaderLevel[SHADER_WINDLIGHT] > 1)
{
@@ -2127,12 +2129,14 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
{
gDeferredWLCloudProgram.mName = "Deferred Windlight Cloud Program";
gDeferredWLCloudProgram.mShaderFiles.clear();
+ gDeferredWLCloudProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredWLCloudProgram.mFeatures.hasTransport = true;
gDeferredWLCloudProgram.mFeatures.hasGamma = true;
gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB));
- gDeferredWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
+ gDeferredWLCloudProgram.mShaderLevel = gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics") ? 3 : mVertexShaderLevel[SHADER_DEFERRED];
gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
- if (gAtmosphere && mVertexShaderLevel[SHADER_WINDLIGHT] >= 3)
+ if (gAtmosphere && mVertexShaderLevel[SHADER_WINDLIGHT] > 1)
{
gDeferredWLSkyProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink();
}
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 705e382a99..7564a5003b 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -429,7 +429,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
mHeavenlyBodyUpdated = FALSE ;
mDrawRefl = 0;
- mInterpVal = 0.f;
+ mInterpVal = 0.f;
}
@@ -492,6 +492,9 @@ void LLVOSky::init()
mInitialized = true;
mHeavenlyBodyUpdated = FALSE ;
+
+ mRainbowMap = LLViewerTextureManager::getFetchedTexture(psky->getRainbowTextureId(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
+ mHaloMap = LLViewerTextureManager::getFetchedTexture(psky->getHaloTextureId(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI);
}
void LLVOSky::initCubeMap()
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index e465dcbe27..660db1e518 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -263,15 +263,18 @@ public:
bool isReflFace(const LLFace* face) const { return face == mFace[FACE_REFLECTION]; }
LLFace* getReflFace() const { return mFace[FACE_REFLECTION]; }
- LLViewerTexture* getSunTex() const { return mSunTexturep[0]; }
- LLViewerTexture* getMoonTex() const { return mMoonTexturep[0]; }
- LLViewerTexture* getBloomTex() const { return mBloomTexturep[0]; }
- LLViewerTexture* getCloudNoiseTex() const { return mCloudNoiseTexturep[0]; }
+ LLViewerTexture* getSunTex() const { return mSunTexturep[0]; }
+ LLViewerTexture* getMoonTex() const { return mMoonTexturep[0]; }
+ LLViewerTexture* getBloomTex() const { return mBloomTexturep[0]; }
+ LLViewerTexture* getCloudNoiseTex() const { return mCloudNoiseTexturep[0]; }
- LLViewerTexture* getSunTexNext() const { return mSunTexturep[1]; }
- LLViewerTexture* getMoonTexNext() const { return mMoonTexturep[1]; }
- LLViewerTexture* getBloomTexNext() const { return mBloomTexturep[1]; }
- LLViewerTexture* getCloudNoiseTexNext() const { return mCloudNoiseTexturep[1]; }
+ LLViewerTexture* getRainbowTex() const { return mRainbowMap; }
+ LLViewerTexture* getHaloTex() const { return mHaloMap; }
+
+ LLViewerTexture* getSunTexNext() const { return mSunTexturep[1]; }
+ LLViewerTexture* getMoonTexNext() const { return mMoonTexturep[1]; }
+ LLViewerTexture* getBloomTexNext() const { return mBloomTexturep[1]; }
+ LLViewerTexture* getCloudNoiseTexNext() const { return mCloudNoiseTexturep[1]; }
void setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next);
void setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_texture_next);
@@ -299,6 +302,8 @@ protected:
LLPointer<LLViewerFetchedTexture> mMoonTexturep[2];
LLPointer<LLViewerFetchedTexture> mCloudNoiseTexturep[2];
LLPointer<LLViewerFetchedTexture> mBloomTexturep[2];
+ LLPointer<LLViewerFetchedTexture> mRainbowMap;
+ LLPointer<LLViewerFetchedTexture> mHaloMap;
F32 mSunScale = 1.0f;
F32 mMoonScale = 1.0f;
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index cee47a591e..a519b5a957 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -873,6 +873,57 @@ void LLWorld::waterHeightRegionInfo(std::string const& sim_name, F32 water_heigh
}
}
+void LLWorld::precullWaterObjects(LLCamera& camera, LLCullResult* cull, bool include_void_water)
+{
+ if (!gAgent.getRegion())
+ {
+ return;
+ }
+
+ if (mRegionList.empty())
+ {
+ LL_WARNS() << "No regions!" << LL_ENDL;
+ return;
+ }
+
+ for (region_list_t::iterator iter = mRegionList.begin();
+ iter != mRegionList.end(); ++iter)
+ {
+ LLViewerRegion* regionp = *iter;
+ LLVOWater* waterp = regionp->getLand().getWaterObj();
+ if (waterp && waterp->mDrawable)
+ {
+ waterp->mDrawable->setVisible(camera);
+ cull->pushDrawable(waterp->mDrawable);
+ }
+ }
+
+ if (include_void_water)
+ {
+ for (std::list<LLVOWater*>::iterator iter = mHoleWaterObjects.begin();
+ iter != mHoleWaterObjects.end(); ++ iter)
+ {
+ LLVOWater* waterp = *iter;
+ if (waterp && waterp->mDrawable)
+ {
+ waterp->mDrawable->setVisible(camera);
+ cull->pushDrawable(waterp->mDrawable);
+ }
+ }
+ }
+
+ S32 dir;
+ for (dir = 0; dir < 8; dir++)
+ {
+ LLVOWater* waterp = mEdgeWaterObjects[dir];
+ if (waterp && waterp->mDrawable)
+ {
+ waterp->mDrawable->setVisible(camera);
+ cull->pushDrawable(waterp->mDrawable);
+ }
+ }
+}
+
void LLWorld::updateWaterObjects()
{
if (!gAgent.getRegion())
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index c9ac241d5a..9722448746 100644
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -138,6 +138,9 @@ public:
LLViewerTexture *getDefaultWaterTexture();
void updateWaterObjects();
+
+ void precullWaterObjects(LLCamera& camera, LLCullResult* cull, bool include_void_water);
+
void waterHeightRegionInfo(std::string const& sim_name, F32 water_height);
void shiftRegions(const LLVector3& offset);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index a513588568..c1b7fdc780 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -88,6 +88,7 @@
#include "llvocache.h"
#include "llvoground.h"
#include "llvosky.h"
+#include "llvowlsky.h"
#include "llvotree.h"
#include "llvovolume.h"
#include "llvosurfacepatch.h"
@@ -2415,21 +2416,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
{
LLVector3 pnorm;
F32 height = region->getWaterHeight();
- if (water_clip < 0)
- { //camera is above water, clip plane points up
- pnorm.setVec(0,0,1);
- plane.setVec(pnorm, -height);
- }
- else if (water_clip > 0)
- { //camera is below water, clip plane points down
- pnorm = LLVector3(0,0,-1);
- plane.setVec(pnorm, height);
- }
+ pnorm.setVec(0,0,-(F32)water_clip);
+ plane.setVec(pnorm, height * pnorm.mV[VZ]);
}
}
glh::matrix4f modelview = get_last_modelview();
- glh::matrix4f proj = get_last_projection();
+ glh::matrix4f proj = get_last_projection();
+
LLGLUserClipPlane clip(plane, modelview, proj, water_clip != 0 && LLPipeline::sReflectionRender);
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
@@ -2455,9 +2449,9 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* region = *iter;
- if (water_clip != 0)
+ if (water_clip != 0 && LLPipeline::sReflectionRender)
{
- LLPlane plane(LLVector3(0,0, (F32) -water_clip), (F32) water_clip*region->getWaterHeight());
+ LLPlane plane(LLVector3(0,0, -(F32)water_clip), water_clip * region->getWaterHeight());
camera.setUserClipPlane(plane);
}
else
@@ -2513,7 +2507,20 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
sCull->pushDrawable(gSky.mVOGroundp->mDrawable);
}
+ if (hasRenderType(LLPipeline::RENDER_TYPE_WL_SKY) &&
+ gPipeline.canUseWindLightShaders() &&
+ gSky.mVOWLSkyp.notNull() &&
+ gSky.mVOWLSkyp->mDrawable.notNull())
+ {
+ gSky.mVOWLSkyp->mDrawable->setVisible(camera);
+ sCull->pushDrawable(gSky.mVOWLSkyp->mDrawable);
+ }
+ if (hasRenderType(LLPipeline::RENDER_TYPE_WATER))
+ {
+ LLWorld::getInstance()->precullWaterObjects(camera, sCull, hasRenderType(LLPipeline::RENDER_TYPE_VOIDWATER));
+ }
+
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
@@ -9823,21 +9830,23 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
F32 plane_d;
S32 water_clip = 0;
- if (!LLViewerCamera::getInstance()->cameraUnderWater())
- { //camera is above water, clip plane points up
- pnorm.setVec(0,0,1);
- plane_d = -water_height;
- plane.setVec(pnorm, -distance_to_water);
- water_clip = -1;
+
+ if (LLViewerCamera::getInstance()->cameraUnderWater())
+ {
+ //camera is below water, clip plane points down
+ water_clip = 1;
}
else
- { //camera is below water, clip plane points down
- pnorm = LLVector3(0,0,-1);
- plane_d = water_height;
- plane.setVec(pnorm, distance_to_water);
- water_clip = 1;
+ {
+ //camera is above water, clip plane points up
+ water_clip = -1;
}
+ //camera is below water, clip plane points down
+ pnorm = LLVector3(0,0,-(F32)water_clip);
+ plane_d = water_height * pnorm.mV[VZ];
+ plane.setVec(pnorm, distance_to_water * pnorm.mV[VZ]);
+
bool materials_in_water = false;
#if MATERIALS_IN_REFLECTIONS
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_density.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml
index e9aa07957e..a21ba44b32 100644
--- a/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml
+++ b/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml
@@ -22,7 +22,7 @@
auto_resize="true"
user_resize="false"
visible="true"
- height="14">
+ height="12">
<slider
decimal_digits="6"
follows="left|top"
@@ -101,7 +101,7 @@
auto_resize="true"
user_resize="false"
visible="true"
- height="16">
+ height="14">
<slider
decimal_digits="6"
follows="left|top"
@@ -195,7 +195,7 @@
auto_resize="true"
user_resize="false"
visible="true"
- height="14">
+ height="12">
<slider
decimal_digits="6"
follows="left|top"
@@ -269,5 +269,55 @@
label_width="160"
can_edit_text="true"/>
</layout_panel>
+ <layout_panel
+ border="true"
+ bevel_style="in"
+ auto_resize="true"
+ user_resize="false"
+ visible="true"
+ height="14">
+ <slider
+ decimal_digits="3"
+ follows="left|top"
+ height="14"
+ increment="0.001"
+ initial_value="0"
+ layout="topleft"
+ min_val="0"
+ max_val="1"
+ name="moisture_level"
+ label="Moisture Level:"
+ width="400"
+ label_width="160"
+ can_edit_text="true"/>
+ <slider
+ decimal_digits="2"
+ follows="left|top"
+ height="14"
+ increment="0.01"
+ initial_value="0"
+ layout="topleft"
+ min_val="5.0"
+ max_val="1000.0"
+ name="droplet_radius"
+ label="Droplet Radius:"
+ width="400"
+ label_width="160"
+ can_edit_text="true"/>
+ <slider
+ decimal_digits="1"
+ follows="left|top"
+ height="14"
+ increment="0.1"
+ initial_value="0"
+ layout="topleft"
+ min_val="0"
+ max_val="1"
+ name="ice_level"
+ label="Ice Level:"
+ width="400"
+ label_width="160"
+ can_edit_text="true"/>
+ </layout_panel>
</layout_stack>
</panel>
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"