summaryrefslogtreecommitdiff
path: root/indra/newview/llsettingsvo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llsettingsvo.cpp')
-rw-r--r--indra/newview/llsettingsvo.cpp86
1 files changed, 54 insertions, 32 deletions
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 57dabca2f5..01d7ab3dcf 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -1,5 +1,5 @@
/**
-* @file llvo.cpp
+* @file llsettingsvo.cpp
* @author Rider Linden
* @brief Subclasses for viewer specific settings behaviors.
*
@@ -334,13 +334,15 @@ LLSettingsBase::ptr_t LLSettingsVOBase::importFile(const std::string &filename)
//=========================================================================
-LLSettingsVOSky::LLSettingsVOSky(const LLSD &data):
- LLSettingsSky(data)
+LLSettingsVOSky::LLSettingsVOSky(const LLSD &data, bool isAdvanced)
+: LLSettingsSky(data)
+, m_isAdvanced(isAdvanced)
{
}
-LLSettingsVOSky::LLSettingsVOSky():
- LLSettingsSky()
+LLSettingsVOSky::LLSettingsVOSky()
+: LLSettingsSky()
+, m_isAdvanced(false)
{
}
@@ -348,14 +350,16 @@ LLSettingsVOSky::LLSettingsVOSky():
LLSettingsSky::ptr_t LLSettingsVOSky::buildSky(LLSD settings)
{
LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList();
- LLSD results = LLSettingsSky::settingValidation(settings, validations);
+
+ LLSD results = LLSettingsBase::settingValidation(settings, validations);
+
if (!results["success"].asBoolean())
{
LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL;
LLSettingsSky::ptr_t();
}
- return std::make_shared<LLSettingsVOSky>(settings);
+ return std::make_shared<LLSettingsVOSky>(settings, true);
}
@@ -367,7 +371,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n
newsettings[SETTING_NAME] = name;
LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList();
- LLSD results = LLSettingsSky::settingValidation(newsettings, validations);
+ LLSD results = LLSettingsBase::settingValidation(newsettings, validations);
if (!results["success"].asBoolean())
{
LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL;
@@ -377,7 +381,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n
LLSettingsSky::ptr_t skyp = std::make_shared<LLSettingsVOSky>(newsettings);
#ifdef VERIFY_LEGACY_CONVERSION
- LLSD oldsettings = LLSettingsVOSky::convertToLegacy(skyp);
+ LLSD oldsettings = LLSettingsVOSky::convertToLegacy(skyp, isAdvanced());
if (!llsd_equals(legacy, oldsettings))
{
@@ -397,7 +401,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky()
settings[SETTING_NAME] = std::string("_default_");
LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList();
- LLSD results = LLSettingsSky::settingValidation(settings, validations);
+ LLSD results = LLSettingsBase::settingValidation(settings, validations);
if (!results["success"].asBoolean())
{
LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL;
@@ -413,7 +417,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
LLSD settings = cloneSettings();
LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList();
- LLSD results = LLSettingsSky::settingValidation(settings, validations);
+ LLSD results = LLSettingsBase::settingValidation(settings, validations);
if (!results["success"].asBoolean())
{
LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL;
@@ -424,30 +428,44 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
return skyp;
}
-LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky)
+void LLSettingsVOSky::convertAtmosphericsToLegacy(LLSD& legacy, LLSD& settings)
{
- LLSD legacy(LLSD::emptyMap());
- LLSD settings = psky->getSettings();
-
+// LEGACY_ATMOSPHERICS
+ // These will need to be inferred from new settings' density profiles
legacy[SETTING_AMBIENT] = ensureArray4(settings[SETTING_AMBIENT], 1.0f);
legacy[SETTING_BLUE_DENSITY] = ensureArray4(settings[SETTING_BLUE_DENSITY], 1.0);
legacy[SETTING_BLUE_HORIZON] = ensureArray4(settings[SETTING_BLUE_HORIZON], 1.0);
+ legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(settings[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(settings[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_HAZE_DENSITY] = LLSDArray(settings[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_HAZE_HORIZON] = LLSDArray(settings[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f);
+
+ //legacy[SETTING_AMBIENT] = LLColor4::black.getValue();
+ //legacy[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue();
+ //legacy[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue();
+ //legacy[SETTING_HAZE_DENSITY] = LLSDArray(0.6999f)(0.0f)(0.0f)(1.0f);
+ //legacy[SETTING_HAZE_HORIZON] = LLSDArray(0.1899f)(0.0f)(0.0f)(1.0f);
+ //legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(0.0001f)(0.0f)(0.0f)(1.0f);LLSD::Real(0.0001);
+ //legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(0.8f)(0.0f)(0.0f)(1.0f);
+}
+
+LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isAdvanced)
+{
+ LLSD legacy(LLSD::emptyMap());
+ LLSD settings = psky->getSettings();
+
+ convertAtmosphericsToLegacy(legacy, settings);
+
legacy[SETTING_CLOUD_COLOR] = ensureArray4(settings[SETTING_CLOUD_COLOR], 1.0);
legacy[SETTING_CLOUD_POS_DENSITY1] = ensureArray4(settings[SETTING_CLOUD_POS_DENSITY1], 1.0);
legacy[SETTING_CLOUD_POS_DENSITY2] = ensureArray4(settings[SETTING_CLOUD_POS_DENSITY2], 1.0);
- legacy[SETTING_CLOUD_SCALE] = LLSDArray(settings[SETTING_CLOUD_SCALE])(LLSD::Real(0.0))(LLSD::Real(0.0))(LLSD::Real(1.0));
-
+ legacy[SETTING_CLOUD_SCALE] = LLSDArray(settings[SETTING_CLOUD_SCALE])(LLSD::Real(0.0))(LLSD::Real(0.0))(LLSD::Real(1.0));
legacy[SETTING_CLOUD_SCROLL_RATE] = settings[SETTING_CLOUD_SCROLL_RATE];
legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL] = LLSDArray(LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][0].asReal())))
- (LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal())));
-
- legacy[SETTING_CLOUD_SHADOW] = LLSDArray(settings[SETTING_CLOUD_SHADOW].asReal())(0.0f)(0.0f)(1.0f);
- legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(settings[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
- legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(settings[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
+ (LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal())));
+ legacy[SETTING_CLOUD_SHADOW] = LLSDArray(settings[SETTING_CLOUD_SHADOW].asReal())(0.0f)(0.0f)(1.0f);
legacy[SETTING_GAMMA] = LLSDArray(settings[SETTING_GAMMA])(0.0f)(0.0f)(1.0f);
legacy[SETTING_GLOW] = ensureArray4(settings[SETTING_GLOW], 1.0);
- legacy[SETTING_HAZE_DENSITY] = LLSDArray(settings[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f);
- legacy[SETTING_HAZE_HORIZON] = LLSDArray(settings[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f);
legacy[SETTING_LIGHT_NORMAL] = ensureArray4(psky->getLightDirection().getValue(), 0.0f);
legacy[SETTING_MAX_Y] = LLSDArray(settings[SETTING_MAX_Y])(0.0f)(0.0f)(1.0f);
legacy[SETTING_STAR_BRIGHTNESS] = settings[SETTING_STAR_BRIGHTNESS];
@@ -497,21 +515,25 @@ 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_CLOUD_COLOR] = LLShaderMgr::CLOUD_COLOR;
+ 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_DENSITY_MULTIPLIER] = LLShaderMgr::DENSITY_MULTIPLIER;
- param_map[SETTING_DISTANCE_MULTIPLIER] = LLShaderMgr::DISTANCE_MULTIPLIER;
- param_map[SETTING_GLOW] = LLShaderMgr::GLOW;
- param_map[SETTING_HAZE_DENSITY] = LLShaderMgr::HAZE_DENSITY;
- param_map[SETTING_HAZE_HORIZON] = LLShaderMgr::HAZE_HORIZON;
+ param_map[SETTING_CLOUD_SHADOW] = LLShaderMgr::CLOUD_SHADOW;
+ param_map[SETTING_GLOW] = LLShaderMgr::GLOW;
param_map[SETTING_MAX_Y] = LLShaderMgr::MAX_Y;
param_map[SETTING_SUNLIGHT_COLOR] = LLShaderMgr::SUNLIGHT_COLOR;
+
+// AdvancedAtmospherics TODO
+// Provide mappings for new shader params here
}
return param_map;
@@ -936,7 +958,7 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday)
for (std::map<std::string, LLSettingsSky::ptr_t>::iterator its = skys.begin(); its != skys.end(); ++its)
{
- LLSD llsdsky = LLSettingsVOSky::convertToLegacy((*its).second);
+ LLSD llsdsky = LLSettingsVOSky::convertToLegacy((*its).second, false);
llsdsky[SETTING_NAME] = (*its).first;
llsdskylist[(*its).first] = llsdsky;