diff options
author | Graham Linden <graham@lindenlab.com> | 2018-10-30 00:23:22 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-10-30 00:23:22 +0100 |
commit | f334453af1cb2e7085cbe72da4fee357afceb80f (patch) | |
tree | 666447d52ffa8fb7bc6db8a7e14995897e47d8b5 | |
parent | 38a6f3b0dfd56ceb09bc5a689a678038f8022603 (diff) | |
parent | 2ee1f40411a9036c8d9d4d6cb6f9b75dead61315 (diff) |
Merge
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 192 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.h | 26 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 10 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llenvironment.cpp | 65 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 2 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 50 |
7 files changed, 194 insertions, 153 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 2adbb213e6..80680948b5 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -80,7 +80,7 @@ LLSettingsBase::LLSettingsBase(const LLSD setting) : //========================================================================= void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F64 mix) { - mSettings = interpolateSDMap(mSettings, other.mSettings, mix); + mSettings = interpolateSDMap(mSettings, other.mSettings, other.getParameterMap(), mix); setDirtyFlag(true); } @@ -158,7 +158,7 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons return newSettings; } -LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const +LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, F64 mix) const { LLSD newSettings; @@ -173,81 +173,33 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F if (skip.find(key_name) != skip.end()) continue; - if (!other.has(key_name)) - { // The other does not contain this setting, keep the original value - // TODO: Should I blend this out instead? - newSettings[key_name] = value; - continue; - } - LLSD::Type setting_type = value.type(); - LLSD other_value = other[key_name]; - - if (other_value.type() != setting_type) - { - // The data type mismatched between this and other. Hard switch when we pass the break point - // but issue a warning. - LL_WARNS("SETTINGS") << "Setting lerp between mismatched types for '" << key_name << "'." << LL_ENDL; - newSettings[key_name] = (mix > BREAK_POINT) ? other_value : value; - continue; + LLSD other_value; + if (other.has(key_name)) + { + other_value = other[key_name]; } - - switch (setting_type) + else { - case LLSD::TypeInteger: - // lerp between the two values rounding the result to the nearest integer. - newSettings[key_name] = LLSD::Integer(llroundf(lerp(value.asReal(), other_value.asReal(), mix))); - break; - case LLSD::TypeReal: - // lerp between the two values. - newSettings[key_name] = LLSD::Real(lerp(value.asReal(), other_value.asReal(), mix)); - break; - case LLSD::TypeMap: - // deep copy. - newSettings[key_name] = interpolateSDMap(value, other_value, mix); - break; - - case LLSD::TypeArray: + parammapping_t::const_iterator def_iter = defaults.find(key_name); + if (def_iter != defaults.end()) { - LLSD newvalue(LLSD::emptyArray()); - - if (slerps.find(key_name) != slerps.end()) - { - LLQuaternion a(value); - LLQuaternion b(other_value); - LLQuaternion q = slerp(mix, a, b); - newvalue = q.getValue(); - } - else - { // TODO: We could expand this to inspect the type and do a deep lerp based on type. - // for now assume a heterogeneous array of reals. - size_t len = std::max(value.size(), other_value.size()); - - for (size_t i = 0; i < len; ++i) - { - - newvalue[i] = lerp(value[i].asReal(), other_value[i].asReal(), mix); - } - } - - newSettings[key_name] = newvalue; + other_value = def_iter->second.getDefaultValue(); + } + else if (value.type() == LLSD::TypeMap) + { + // interpolate in case there are defaults inside (part of legacy) + other_value = LLSDMap(); + } + else + { + // The other or defaults does not contain this setting, keep the original value + // TODO: Should I blend this out instead? + newSettings[key_name] = value; + continue; } - - break; - - case LLSD::TypeUUID: - newSettings[key_name] = value.asUUID(); - break; - -// case LLSD::TypeBoolean: -// case LLSD::TypeString: -// case LLSD::TypeURI: -// case LLSD::TypeBinary: -// case LLSD::TypeDate: - default: - // atomic or unknown data types. Lerping between them does not make sense so switch at the break. - newSettings[key_name] = (mix > BREAK_POINT) ? other_value : value; - break; } + + newSettings[key_name] = interpolateSDValue(key_name, value, other_value, defaults, mix, slerps); } // Special handling cases @@ -264,6 +216,27 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F // Now add anything that is in other but not in the settings for (LLSD::map_const_iterator it = other.beginMap(); it != other.endMap(); ++it) { + std::string key_name = (*it).first; + + if (skip.find(key_name) != skip.end()) + continue; + + if (settings.has(key_name)) + continue; + + parammapping_t::const_iterator def_iter = defaults.find(key_name); + if (def_iter != defaults.end()) + { + // Blend against default value + newSettings[key_name] = interpolateSDValue(key_name, def_iter->second.getDefaultValue(), (*it).second, defaults, mix, slerps); + } + // else do nothing when no known defaults + // TODO: Should I blend this out instead? + } + + // Note: writes variables from skip list, bug? + for (LLSD::map_const_iterator it = other.beginMap(); it != other.endMap(); ++it) + { // TODO: Should I blend this in instead? if (skip.find((*it).first) == skip.end()) continue; @@ -277,6 +250,81 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F return newSettings; } +LLSD LLSettingsBase::interpolateSDValue(const std::string& key_name, const LLSD &value, const LLSD &other_value, const parammapping_t& defaults, BlendFactor mix, const stringset_t& slerps) const +{ + LLSD new_value; + + LLSD::Type setting_type = value.type(); + + if (other_value.type() != setting_type) + { + // The data type mismatched between this and other. Hard switch when we pass the break point + // but issue a warning. + LL_WARNS("SETTINGS") << "Setting lerp between mismatched types for '" << key_name << "'." << LL_ENDL; + new_value = (mix > BREAK_POINT) ? other_value : value; + } + + switch (setting_type) + { + case LLSD::TypeInteger: + // lerp between the two values rounding the result to the nearest integer. + new_value = LLSD::Integer(llroundf(lerp(value.asReal(), other_value.asReal(), mix))); + break; + case LLSD::TypeReal: + // lerp between the two values. + new_value = LLSD::Real(lerp(value.asReal(), other_value.asReal(), mix)); + break; + case LLSD::TypeMap: + // deep copy. + new_value = interpolateSDMap(value, other_value, defaults, mix); + break; + + case LLSD::TypeArray: + { + LLSD new_array(LLSD::emptyArray()); + + if (slerps.find(key_name) != slerps.end()) + { + LLQuaternion a(value); + LLQuaternion b(other_value); + LLQuaternion q = slerp(mix, a, b); + new_array = q.getValue(); + } + else + { // TODO: We could expand this to inspect the type and do a deep lerp based on type. + // for now assume a heterogeneous array of reals. + size_t len = std::max(value.size(), other_value.size()); + + for (size_t i = 0; i < len; ++i) + { + + new_array[i] = lerp(value[i].asReal(), other_value[i].asReal(), mix); + } + } + + new_value = new_array; + } + + break; + + case LLSD::TypeUUID: + new_value = value.asUUID(); + break; + + // case LLSD::TypeBoolean: + // case LLSD::TypeString: + // case LLSD::TypeURI: + // case LLSD::TypeBinary: + // case LLSD::TypeDate: + default: + // atomic or unknown data types. Lerping between them does not make sense so switch at the break. + new_value = (mix > BREAK_POINT) ? other_value : value; + break; + } + + return new_value; +} + LLSettingsBase::stringset_t LLSettingsBase::getSkipInterpolateKeys() const { static stringset_t skipSet; diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index aea1bc3fde..c7b685c6d5 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -76,7 +76,21 @@ public: static const U32 FLAG_NOMOD; static const U32 FLAG_NOTRANS; - typedef std::map<std::string, S32> parammapping_t; + class DefaultParam + { + public: + DefaultParam(S32 key, const LLSD& value) : mShaderKey(key), mDefaultValue(value) {} + DefaultParam() : mShaderKey(-1) {} + S32 getShaderKey() const { return mShaderKey; } + const LLSD getDefaultValue() const { return mDefaultValue; } + + private: + S32 mShaderKey; + LLSD mDefaultValue; + }; + // Contains settings' names (map key), related shader id-key and default + // value for revert in case we need to reset shader (no need to search each time) + typedef std::map<std::string, DefaultParam> parammapping_t; typedef PTR_NAMESPACE::shared_ptr<LLSettingsBase> ptr_t; @@ -312,7 +326,15 @@ protected: // combining settings objects. Customize for specific setting types virtual void lerpSettings(const LLSettingsBase &other, BlendFactor mix); - LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, BlendFactor mix) const; + + // combining settings maps where it can based on mix rate + // @settings initial value (mix==0) + // @other target value (mix==1) + // @defaults list of default values for legacy fields and (re)setting shaders + // @mix from 0 to 1, ratio or rate of transition from initial 'settings' to 'other' + // return interpolated and combined LLSD map + LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, BlendFactor mix) const; + LLSD interpolateSDValue(const std::string& name, const LLSD &value, const LLSD &other, const parammapping_t& defaults, BlendFactor mix, const stringset_t& slerps) const; /// when lerping between settings, some may require special handling. /// Get a list of these key to be skipped by the default settings lerp. diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8a1e74d7ea..cf6bc45080 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -438,7 +438,14 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast<LLSettingsSky>(end); if (other) { - LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + if (!mSettings.has(SETTING_LEGACY_HAZE) && !mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + { + // Special case since SETTING_AMBIENT is both in outer and legacy maps, we prioritize legacy one + // see getAmbientColor() + setAmbientColor(getAmbientColor()); + } + + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf); replaceSettings(blenddata); mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); @@ -924,6 +931,7 @@ LLVector3 LLSettingsSky::getLightDirection() const LLColor3 LLSettingsSky::getAmbientColor() const { + // Todo: this causes complications, preferably to get rid of this duality if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) { return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT]); diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 87744453ed..7cfff954a0 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -178,7 +178,7 @@ void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSettingsWater::ptr_t other = PTR_NAMESPACE::static_pointer_cast<LLSettingsWater>(end); if (other) { - LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf); replaceSettings(blenddata); mNextNormalMapID = other->getNormalMapID(); mNextTransparentTextureID = other->getTransparentTextureID(); diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index ae625630eb..da558a0ba3 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -885,6 +885,7 @@ void LLEnvironment::updateCloudScroll() } +// static void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLSettingsBase::ptr_t &psetting) { LL_RECORD_BLOCK_TIME(FTM_SHADER_PARAM_UPDATE); @@ -894,62 +895,19 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS for (auto &it: params) { LLSD value; - - bool found_in_settings = psetting->mSettings.has(it.first); - bool found_in_legacy_settings = !found_in_settings && psetting->mSettings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE].has(it.first); - - if (found_in_settings) - { - value = psetting->mSettings[it.first]; - } - else if (found_in_legacy_settings) + // legacy first since it contains ambient color and we prioritize value from legacy, see getAmbientColor() + if (psetting->mSettings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE].has(it.first)) { value = psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE][it.first]; } - else if (psetting->getSettingsType() == "sky") + else if (psetting->mSettings.has(it.first)) { - // Legacy atmospherics is a special case, - // these values either have non zero defaults when they are not present - // in LLSD or need to be acounted for (reset) even if they are not present - // Todo: consider better options, for example make LLSettingsSky init these options - // Todo: we should reset shaders for all missing fields, not just these ones - LLSettingsSky::ptr_t skyp = std::static_pointer_cast<LLSettingsSky>(psetting); - if (it.first == LLSettingsSky::SETTING_BLUE_DENSITY) - { - value = skyp->getBlueDensity().getValue(); - } - else if (it.first == LLSettingsSky::SETTING_BLUE_HORIZON) - { - value = skyp->getBlueHorizon().getValue(); - } - else if (it.first == LLSettingsSky::SETTING_DENSITY_MULTIPLIER) - { - value = skyp->getDensityMultiplier(); - } - else if (it.first == LLSettingsSky::SETTING_DISTANCE_MULTIPLIER) - { - value = skyp->getDistanceMultiplier(); - } - else if (it.first == LLSettingsSky::SETTING_HAZE_DENSITY) - { - value = skyp->getHazeDensity(); - } - else if (it.first == LLSettingsSky::SETTING_HAZE_HORIZON) - { - value = skyp->getHazeHorizon(); - } - else if (it.first == LLSettingsSky::SETTING_AMBIENT) - { - value = skyp->getAmbientColor().getValue(); - } - else - { - continue; - } + value = psetting->mSettings[it.first]; } else { - continue; + // We need to reset shaders, use defaults + value = it.second.getDefaultValue(); } LLSD::Type setting_type = value.type(); @@ -957,16 +915,16 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS switch (setting_type) { case LLSD::TypeInteger: - shader->uniform1i(it.second, value.asInteger()); + shader->uniform1i(it.second.getShaderKey(), value.asInteger()); //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL; break; case LLSD::TypeReal: - shader->uniform1f(it.second, value.asReal()); + shader->uniform1f(it.second.getShaderKey(), value.asReal()); //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL; break; case LLSD::TypeBoolean: - shader->uniform1i(it.second, value.asBoolean() ? 1 : 0); + shader->uniform1i(it.second.getShaderKey(), value.asBoolean() ? 1 : 0); //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL; break; @@ -974,8 +932,7 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS { LLVector4 vect4(value); //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL; - shader->uniform4fv(it.second, 1, vect4.mV); - + shader->uniform4fv(it.second.getShaderKey(), 1, vect4.mV); break; } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 31c9d290be..63020ab5d7 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -124,7 +124,7 @@ public: void update(const LLViewerCamera * cam); - void updateGLVariablesForSettings(LLGLSLShader *shader, const LLSettingsBase::ptr_t &psetting); + static void updateGLVariablesForSettings(LLGLSLShader *shader, const LLSettingsBase::ptr_t &psetting); void updateShaderUniforms(LLGLSLShader *shader); void setSelectedEnvironment(EnvSelection_t env, LLSettingsBase::Seconds transition = TRANSITION_DEFAULT, bool forced = false); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index dad7fc9448..2696ad4df5 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -683,26 +683,31 @@ LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const if (param_map.empty()) { // LEGACY_ATMOSPHERICS - param_map[SETTING_AMBIENT] = LLShaderMgr::AMBIENT; - param_map[SETTING_BLUE_DENSITY] = LLShaderMgr::BLUE_DENSITY; - param_map[SETTING_BLUE_HORIZON] = LLShaderMgr::BLUE_HORIZON; - param_map[SETTING_HAZE_DENSITY] = LLShaderMgr::HAZE_DENSITY; - param_map[SETTING_HAZE_HORIZON] = LLShaderMgr::HAZE_HORIZON; - param_map[SETTING_DENSITY_MULTIPLIER] = LLShaderMgr::DENSITY_MULTIPLIER; - param_map[SETTING_DISTANCE_MULTIPLIER] = LLShaderMgr::DISTANCE_MULTIPLIER; - - param_map[SETTING_CLOUD_COLOR] = LLShaderMgr::CLOUD_COLOR; - param_map[SETTING_CLOUD_POS_DENSITY2] = LLShaderMgr::CLOUD_POS_DENSITY2; - param_map[SETTING_CLOUD_SCALE] = LLShaderMgr::CLOUD_SCALE; - param_map[SETTING_CLOUD_SHADOW] = LLShaderMgr::CLOUD_SHADOW; - param_map[SETTING_CLOUD_VARIANCE] = LLShaderMgr::CLOUD_VARIANCE; - param_map[SETTING_GLOW] = LLShaderMgr::GLOW; - param_map[SETTING_MAX_Y] = LLShaderMgr::MAX_Y; - param_map[SETTING_SUNLIGHT_COLOR] = LLShaderMgr::SUNLIGHT_COLOR; - param_map[SETTING_MOON_BRIGHTNESS] = LLShaderMgr::MOON_BRIGHTNESS; - 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; + + // Todo: default 'legacy' values duplicate the ones from functions like getBlueDensity() find a better home for them + // There is LLSettingsSky::defaults(), but it doesn't contain everything since it is geared towards creating new settings. + param_map[SETTING_AMBIENT] = DefaultParam(LLShaderMgr::AMBIENT, LLColor3(0.25f, 0.25f, 0.25f).getValue()); + param_map[SETTING_BLUE_DENSITY] = DefaultParam(LLShaderMgr::BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f).getValue()); + param_map[SETTING_BLUE_HORIZON] = DefaultParam(LLShaderMgr::BLUE_HORIZON, LLColor3(0.4954f, 0.4954f, 0.6399f).getValue()); + param_map[SETTING_HAZE_DENSITY] = DefaultParam(LLShaderMgr::HAZE_DENSITY, LLSD(0.7f)); + param_map[SETTING_HAZE_HORIZON] = DefaultParam(LLShaderMgr::HAZE_HORIZON, LLSD(0.19f)); + param_map[SETTING_DENSITY_MULTIPLIER] = DefaultParam(LLShaderMgr::DENSITY_MULTIPLIER, LLSD(0.0001f)); + param_map[SETTING_DISTANCE_MULTIPLIER] = DefaultParam(LLShaderMgr::DISTANCE_MULTIPLIER, LLSD(0.8f)); + + // Following values are always present, so we can just zero these ones, but used values from defaults() + LLSD& sky_defaults = LLSettingsSky::defaults(); + param_map[SETTING_CLOUD_COLOR] = DefaultParam(LLShaderMgr::CLOUD_COLOR, sky_defaults[SETTING_CLOUD_COLOR]); + param_map[SETTING_CLOUD_POS_DENSITY2] = DefaultParam(LLShaderMgr::CLOUD_POS_DENSITY2, sky_defaults[SETTING_CLOUD_POS_DENSITY2]); + param_map[SETTING_CLOUD_SCALE] = DefaultParam(LLShaderMgr::CLOUD_SCALE, sky_defaults[SETTING_CLOUD_SCALE]); + param_map[SETTING_CLOUD_SHADOW] = DefaultParam(LLShaderMgr::CLOUD_SHADOW, sky_defaults[SETTING_CLOUD_SHADOW]); + param_map[SETTING_CLOUD_VARIANCE] = DefaultParam(LLShaderMgr::CLOUD_VARIANCE, sky_defaults[SETTING_CLOUD_VARIANCE]); + param_map[SETTING_GLOW] = DefaultParam(LLShaderMgr::GLOW, sky_defaults[SETTING_GLOW]); + param_map[SETTING_MAX_Y] = DefaultParam(LLShaderMgr::MAX_Y, sky_defaults[SETTING_MAX_Y]); + param_map[SETTING_SUNLIGHT_COLOR] = DefaultParam(LLShaderMgr::SUNLIGHT_COLOR, sky_defaults[SETTING_SUNLIGHT_COLOR]); + param_map[SETTING_MOON_BRIGHTNESS] = DefaultParam(LLShaderMgr::MOON_BRIGHTNESS, sky_defaults[SETTING_MOON_BRIGHTNESS]); + param_map[SETTING_SKY_MOISTURE_LEVEL] = DefaultParam(LLShaderMgr::MOISTURE_LEVEL, sky_defaults[SETTING_SKY_MOISTURE_LEVEL]); + param_map[SETTING_SKY_DROPLET_RADIUS] = DefaultParam(LLShaderMgr::DROPLET_RADIUS, sky_defaults[SETTING_SKY_DROPLET_RADIUS]); + param_map[SETTING_SKY_ICE_LEVEL] = DefaultParam(LLShaderMgr::ICE_LEVEL, sky_defaults[SETTING_SKY_ICE_LEVEL]); // AdvancedAtmospherics TODO // Provide mappings for new shader params here @@ -911,8 +916,9 @@ LLSettingsWater::parammapping_t LLSettingsVOWater::getParameterMap() const if (param_map.empty()) { - param_map[SETTING_FOG_COLOR] = LLShaderMgr::WATER_FOGCOLOR; - param_map[SETTING_FOG_DENSITY] = LLShaderMgr::WATER_FOGDENSITY; + LLSD &water_defaults = LLSettingsWater::defaults(); + param_map[SETTING_FOG_COLOR] = DefaultParam(LLShaderMgr::WATER_FOGCOLOR, water_defaults[SETTING_FOG_COLOR]); + param_map[SETTING_FOG_DENSITY] = DefaultParam(LLShaderMgr::WATER_FOGDENSITY, water_defaults[SETTING_FOG_DENSITY]); } return param_map; } |