summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/llsettingssky.cpp84
-rw-r--r--indra/llinventory/llsettingssky.h39
-rw-r--r--indra/newview/llenvironment.cpp18
-rw-r--r--indra/newview/llsettingsvo.cpp19
4 files changed, 96 insertions, 64 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 940680baab..37da95b95e 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -653,29 +653,13 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy)
{
LLSD newsettings(defaults());
- if (legacy.has(SETTING_BLUE_DENSITY))
- {
- newsettings[SETTING_BLUE_DENSITY] = LLColor3(legacy[SETTING_BLUE_DENSITY]).getValue();
- }
- if (legacy.has(SETTING_BLUE_HORIZON))
- {
- newsettings[SETTING_BLUE_HORIZON] = LLColor3(legacy[SETTING_BLUE_HORIZON]).getValue();
- }
- if (legacy.has(SETTING_DENSITY_MULTIPLIER))
- {
- newsettings[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(legacy[SETTING_DENSITY_MULTIPLIER][0].asReal());
- }
- if (legacy.has(SETTING_DISTANCE_MULTIPLIER))
- {
- newsettings[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(legacy[SETTING_DISTANCE_MULTIPLIER][0].asReal());
- }
- if (legacy.has(SETTING_HAZE_DENSITY))
- {
- newsettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal());
- }
- if (legacy.has(SETTING_HAZE_HORIZON))
+ // Move legacy haze parameters to an inner map
+ // allowing backward compat and simple conversion to legacy format
+ LLSD legacyhazesettings;
+ legacyhazesettings = translateLegacyHazeSettings(legacy);
+ if (legacyhazesettings.size() > 0)
{
- newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal());
+ newsettings[SETTING_LEGACY_HAZE] = legacyhazesettings;
}
if (legacy.has(SETTING_AMBIENT))
@@ -831,6 +815,60 @@ void LLSettingsSky::calculateHeavnlyBodyPositions()
}
}
+LLColor3 LLSettingsSky::getBlueDensity() const
+{
+ if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY))
+ {
+ return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY]);
+ }
+ return LLColor3(0.2447f, 0.4487f, 0.7599f);
+}
+
+LLColor3 LLSettingsSky::getBlueHorizon() const
+{
+ if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY))
+ {
+ return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON]);
+ }
+ return LLColor3(0.4954f, 0.4954f, 0.6399f);
+}
+
+F32 LLSettingsSky::getHazeDensity() const
+{
+ if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_HAZE_DENSITY))
+ {
+ return mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY].asReal();
+ }
+ return 0.7f;
+}
+
+F32 LLSettingsSky::getHazeHorizon() const
+{
+ if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_HAZE_HORIZON))
+ {
+ return mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON].asReal();
+ }
+ return 0.19f;
+}
+
+F32 LLSettingsSky::getDensityMultiplier() const
+{
+ if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DENSITY_MULTIPLIER))
+ {
+ return mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER].asReal();
+ }
+ return 0.0001f;
+}
+
+F32 LLSettingsSky::getDistanceMultiplier() const
+{
+ if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DISTANCE_MULTIPLIER))
+ {
+ return mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER].asReal();
+ }
+ return 0.8f;
+}
+
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const
@@ -838,7 +876,7 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const
// LEGACY_ATMOSPHERICS
LLColor3 blue_density = getBlueDensity();
F32 haze_density = getHazeDensity();
- F32 density_multiplier = getDensityMultiplier();
+ F32 density_multiplier = getDensityMultiplier();
LLColor3 density = (blue_density * 1.0 + smear(haze_density * 0.25f));
LLColor3 light_atten = density * density_multiplier * distance;
return light_atten;
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index e424d7e3b9..70d7a1c54f 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -116,37 +116,6 @@ public:
setValue(SETTING_AMBIENT, val);
}
-// LEGACY_ATMOSPHERICS
- LLColor3 getBlueDensity() const
- {
- return LLColor3(mSettings[SETTING_BLUE_DENSITY]);
- }
-
- LLColor3 getBlueHorizon() const
- {
- return LLColor3(mSettings[SETTING_BLUE_HORIZON]);
- }
-
- F32 getHazeDensity() const
- {
- return mSettings[SETTING_HAZE_DENSITY].asReal();
- }
-
- F32 getHazeHorizon() const
- {
- return mSettings[SETTING_HAZE_HORIZON].asReal();
- }
-
- F32 getDensityMultiplier() const
- {
- return mSettings[SETTING_DENSITY_MULTIPLIER].asReal();
- }
-
- F32 getDistanceMultiplier() const
- {
- return mSettings[SETTING_DISTANCE_MULTIPLIER].asReal();
- }
-
LLColor3 getCloudColor() const
{
return LLColor3(mSettings[SETTING_CLOUD_COLOR]);
@@ -412,6 +381,14 @@ public:
LLColor3 getLightTransmittance() const;
LLColor3 gammaCorrect(const LLColor3& in) const;
+// LEGACY_ATMOSPHERICS
+ LLColor3 getBlueDensity() const;
+ LLColor3 getBlueHorizon() const;
+ F32 getHazeDensity() const;
+ F32 getHazeHorizon() const;
+ F32 getDensityMultiplier() const;
+ F32 getDistanceMultiplier() const;
+
protected:
static const std::string SETTING_LEGACY_EAST_ANGLE;
static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL;
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index c5a1af8747..b03367c4dd 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -440,12 +440,24 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS
LLSettingsBase::parammapping_t params = psetting->getParameterMap();
for (auto &it: params)
{
- if (!psetting->mSettings.has(it.first))
+ 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 && !found_in_legacy_settings)
continue;
- LLSD value = psetting->mSettings[it.first];
- LLSD::Type setting_type = value.type();
+ if (found_in_settings)
+ {
+ value = psetting->mSettings[it.first];
+ }
+ else if (found_in_legacy_settings)
+ {
+ value = psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE][it.first];
+ }
+ LLSD::Type setting_type = value.type();
stop_glerror();
switch (setting_type)
{
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 8cacd6d0f9..e398b4ee46 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -431,13 +431,18 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
void LLSettingsVOSky::convertAtmosphericsToLegacy(LLSD& legacy, LLSD& settings)
{
// 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);
+ if (settings.has(SETTING_LEGACY_HAZE))
+ {
+ LLSD legacyhaze = settings[SETTING_LEGACY_HAZE];
+
+ legacy[SETTING_AMBIENT] = ensureArray4(legacyhaze[SETTING_AMBIENT], 1.0f);
+ legacy[SETTING_BLUE_DENSITY] = ensureArray4(legacyhaze[SETTING_BLUE_DENSITY], 1.0);
+ legacy[SETTING_BLUE_HORIZON] = ensureArray4(legacyhaze[SETTING_BLUE_HORIZON], 1.0);
+ legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(legacyhaze[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(legacyhaze[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_HAZE_DENSITY] = LLSDArray(legacyhaze[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f);
+ legacy[SETTING_HAZE_HORIZON] = LLSDArray(legacyhaze[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f);
+ }
}
LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isAdvanced)