diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 56 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.h | 11 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 5 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.h | 5 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/skyF.glsl | 40 | ||||
-rw-r--r-- | indra/newview/app_settings/windlight/corona_lut.png | bin | 6129 -> 0 bytes | |||
-rw-r--r-- | indra/newview/app_settings/windlight/rainbow_lut.png | bin | 200088 -> 0 bytes | |||
-rw-r--r-- | indra/newview/lldrawpoolwlsky.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llpaneleditsky.cpp | 44 | ||||
-rw-r--r-- | indra/newview/llpaneleditsky.h | 3 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llvosky.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llvosky.h | 21 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_settings_sky_density.xml | 56 |
15 files changed, 253 insertions, 24 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f298a9cbc7..21fde72941 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"); @@ -127,6 +131,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 +396,9 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : mNextSunTextureId(), mNextMoonTextureId(), mNextCloudTextureId(), - mNextBloomTextureId() + mNextBloomTextureId(), + mNextRainbowTextureId(), + mNextHaloTextureId() { } @@ -400,7 +407,9 @@ LLSettingsSky::LLSettingsSky(): mNextSunTextureId(), mNextMoonTextureId(), mNextCloudTextureId(), - mNextBloomTextureId() + mNextBloomTextureId(), + mNextRainbowTextureId(), + mNextHaloTextureId() { } @@ -411,6 +420,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 +437,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 +513,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)("*")), @@ -565,6 +581,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))))); @@ -675,6 +694,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 +706,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 +1017,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 +1217,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 +1237,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 +1320,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 { diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 2052908bd3..fbae6739b8 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; @@ -88,6 +90,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 +123,7 @@ public: F32 getMieAnisotropy() const; F32 getSkyMoistureLevel() const; + F32 getSkyDropletRadius() const; F32 getSkyIceLevel() const; // Return first (only) profile layer represented in LLSD @@ -133,6 +137,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 +151,7 @@ public: void setMieAnisotropy(F32 aniso_factor); void setSkyMoistureLevel(F32 moisture_level); + void setSkyDropletRadius(F32 radius); void setSkyIceLevel(F32 ice_level); //--------------------------------------------------------------------- @@ -272,6 +279,8 @@ public: static LLUUID GetDefaultMoonTextureId(); static LLUUID GetDefaultCloudNoiseTextureId(); static LLUUID GetDefaultBloomTextureId(); + static LLUUID GetDefaultRainbowTextureId(); + static LLUUID GetDefaultHaloTextureId(); static LLSD createDensityProfileLayer( F32 width, @@ -326,6 +335,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..153cef0317 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1320,6 +1320,11 @@ 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"); llassert(mReservedUniforms.size() == END_RESERVED_UNIFORMS); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 7898b2d90a..ffdd2da529 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -234,6 +234,11 @@ public: BLEND_FACTOR, NO_ATMO, + MOISTURE_LEVEL, + DROPLET_RADIUS, + ICE_LEVEL, + RAINBOW_MAP, + HALO_MAP, END_RESERVED_UNIFORMS } eGLSLReservedUniforms; 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 Binary files differdeleted file mode 100644 index c4843667d9..0000000000 --- a/indra/newview/app_settings/windlight/corona_lut.png +++ /dev/null diff --git a/indra/newview/app_settings/windlight/rainbow_lut.png b/indra/newview/app_settings/windlight/rainbow_lut.png Binary files differdeleted file mode 100644 index 4bede25649..0000000000 --- a/indra/newview/app_settings/windlight/rainbow_lut.png +++ /dev/null diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 5104dc18fd..d82cff516e 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(); } } diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index 0d36fce90a..faba2b7ed1 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -92,6 +92,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); @@ -536,6 +540,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 +570,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 +613,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 +635,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 +666,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 +679,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 +772,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..e9d956de74 100644 --- a/indra/newview/llpaneleditsky.h +++ b/indra/newview/llpaneleditsky.h @@ -158,6 +158,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/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/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> |