summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llinventory/llsettingsbase.cpp89
-rw-r--r--indra/llinventory/llsettingsbase.h109
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp45
-rw-r--r--indra/llinventory/llsettingsdaycycle.h12
-rw-r--r--indra/llinventory/llsettingssky.cpp447
-rw-r--r--indra/llinventory/llsettingssky.h67
-rw-r--r--indra/llinventory/llsettingswater.cpp53
-rw-r--r--indra/llinventory/llsettingswater.h87
-rw-r--r--indra/newview/llenvironment.cpp105
-rw-r--r--indra/newview/llsettingsvo.cpp80
-rw-r--r--indra/newview/llsettingsvo.h10
11 files changed, 767 insertions, 337 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index 4aab3dee3b..8575ac6920 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -69,25 +69,80 @@ const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0);
LLSettingsBase::LLSettingsBase():
mSettings(LLSD::emptyMap()),
mDirty(true),
- mBlendedFactor(0.0)
+ mLLSDDirty(false),
+ mReplaced(false),
+ mBlendedFactor(0.0),
+ mSettingFlags(0)
{
+ loadValuesFromLLSD();
}
LLSettingsBase::LLSettingsBase(const LLSD setting) :
mSettings(setting),
+ mLLSDDirty(false),
mDirty(true),
- mBlendedFactor(0.0)
+ mReplaced(false),
+ mBlendedFactor(0.0),
+ mSettingFlags(0)
{
+ loadValuesFromLLSD();
+}
+
+//virtual
+void LLSettingsBase::loadValuesFromLLSD()
+{
+ mLLSDDirty = false;
+
+ mAssetId = mSettings[SETTING_ASSETID].asUUID();
+ mSettingId = getValue(SETTING_ID).asUUID();
+ mSettingName = getValue(SETTING_NAME).asString();
+ if (mSettings.has(SETTING_FLAGS))
+ {
+ mSettingFlags = (U32)mSettings[SETTING_FLAGS].asInteger();
+ }
+ else
+ {
+ mSettingFlags = 0;
+ }
+}
+
+//virtual
+void LLSettingsBase::saveValuesToLLSD()
+{
+ mLLSDDirty = false;
+
+ mSettings[SETTING_NAME] = mSettingName;
+ if (mAssetId.isNull())
+ {
+ mSettings.erase(SETTING_ASSETID);
+ }
+ else
+ {
+ mSettings[SETTING_ASSETID] = mAssetId;
+ }
+ mSettings[SETTING_FLAGS] = LLSD::Integer(mSettingFlags);
+}
+
+void LLSettingsBase::saveValuesIfNeeded()
+{
+ if (mLLSDDirty)
+ {
+ saveValuesToLLSD();
+ }
}
//=========================================================================
-void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F64 mix)
+void LLSettingsBase::lerpSettings(LLSettingsBase &other, F64 mix)
{
- mSettings = interpolateSDMap(mSettings, other.mSettings, other.getParameterMap(), mix);
+ saveValuesIfNeeded();
+ stringset_t skip = getSkipInterpolateKeys();
+ stringset_t slerps = getSlerpKeys();
+ mSettings = interpolateSDMap(mSettings, other.getSettings(), other.getParameterMap(), mix, skip, slerps);
setDirtyFlag(true);
+ loadValuesFromLLSD();
}
-LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) const
+LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other)
{
LLSD newSettings;
@@ -161,13 +216,10 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
return newSettings;
}
-LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, F64 mix) const
+LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, F64 mix, const stringset_t& skip, const stringset_t& slerps)
{
LLSD newSettings;
- stringset_t skip = getSkipInterpolateKeys();
- stringset_t slerps = getSlerpKeys();
-
llassert(mix >= 0.0f && mix <= 1.0f);
for (LLSD::map_const_iterator it = settings.beginMap(); it != settings.endMap(); ++it)
@@ -204,7 +256,7 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
}
}
- newSettings[key_name] = interpolateSDValue(key_name, value, other_value, defaults, mix, slerps);
+ newSettings[key_name] = interpolateSDValue(key_name, value, other_value, defaults, mix, skip, slerps);
}
// Special handling cases
@@ -233,12 +285,12 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
if (def_iter != defaults.end())
{
// Blend against default value
- newSettings[key_name] = interpolateSDValue(key_name, def_iter->second.getDefaultValue(), (*it).second, defaults, mix, slerps);
+ newSettings[key_name] = interpolateSDValue(key_name, def_iter->second.getDefaultValue(), (*it).second, defaults, mix, skip, slerps);
}
else if ((*it).second.type() == LLSD::TypeMap)
{
// interpolate in case there are defaults inside (part of legacy)
- newSettings[key_name] = interpolateSDValue(key_name, LLSDMap(), (*it).second, defaults, mix, slerps);
+ newSettings[key_name] = interpolateSDValue(key_name, LLSDMap(), (*it).second, defaults, mix, skip, slerps);
}
// else do nothing when no known defaults
// TODO: Should I blend this out instead?
@@ -260,7 +312,7 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
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 LLSettingsBase::interpolateSDValue(const std::string& key_name, const LLSD &value, const LLSD &other_value, const parammapping_t& defaults, BlendFactor mix, const stringset_t& skip, const stringset_t& slerps)
{
LLSD new_value;
@@ -286,7 +338,7 @@ LLSD LLSettingsBase::interpolateSDValue(const std::string& key_name, const LLSD
break;
case LLSD::TypeMap:
// deep copy.
- new_value = interpolateSDMap(value, other_value, defaults, mix);
+ new_value = interpolateSDMap(value, other_value, defaults, mix, skip, slerps);
break;
case LLSD::TypeArray:
@@ -348,13 +400,15 @@ LLSettingsBase::stringset_t LLSettingsBase::getSkipInterpolateKeys() const
return skipSet;
}
-LLSD LLSettingsBase::getSettings() const
+LLSD& LLSettingsBase::getSettings()
{
+ saveValuesIfNeeded();
return mSettings;
}
-LLSD LLSettingsBase::cloneSettings() const
+LLSD LLSettingsBase::cloneSettings()
{
+ saveValuesIfNeeded();
LLSD settings(combineSDMaps(getSettings(), LLSD()));
if (U32 flags = getFlags())
{
@@ -363,7 +417,7 @@ LLSD LLSettingsBase::cloneSettings() const
return settings;
}
-size_t LLSettingsBase::getHash() const
+size_t LLSettingsBase::getHash()
{ // get a shallow copy of the LLSD filtering out values to not include in the hash
LLSD hash_settings = llsd_shallow(getSettings(),
LLSDMap(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)("*", true));
@@ -381,6 +435,7 @@ bool LLSettingsBase::validate()
mSettings[SETTING_TYPE] = getSettingsType();
}
+ saveValuesIfNeeded();
LLSD result = LLSettingsBase::settingValidation(mSettings, validations);
if (result["errors"].size() > 0)
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 9d8d746b7e..c2867f32d9 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -110,71 +110,55 @@ public:
virtual bool isVeryDirty() const { return mReplaced; }
inline void setDirtyFlag(bool dirty) { mDirty = dirty; clearAssetId(); }
- size_t getHash() const; // Hash will not include Name, ID or a previously stored Hash
+ size_t getHash(); // Hash will not include Name, ID or a previously stored Hash
inline LLUUID getId() const
{
- return getValue(SETTING_ID).asUUID();
+ return mSettingId;
}
inline std::string getName() const
{
- return getValue(SETTING_NAME).asString();
+ return mSettingName;
}
inline void setName(std::string val)
{
- setValue(SETTING_NAME, val);
+ mSettingName = val;
+ setLLSDDirty();
}
inline LLUUID getAssetId() const
{
- if (mSettings.has(SETTING_ASSETID))
- return mSettings[SETTING_ASSETID].asUUID();
- return LLUUID();
+ return mAssetId;
}
inline U32 getFlags() const
{
- if (mSettings.has(SETTING_FLAGS))
- return static_cast<U32>(mSettings[SETTING_FLAGS].asInteger());
- return 0;
+ return mSettingFlags;
}
inline void setFlags(U32 value)
{
- setLLSD(SETTING_FLAGS, LLSD::Integer(value));
+ mSettingFlags = value;
+ setLLSDDirty();
}
inline bool getFlag(U32 flag) const
{
- if (mSettings.has(SETTING_FLAGS))
- return ((U32)mSettings[SETTING_FLAGS].asInteger() & flag) == flag;
- return false;
+ return (mSettingFlags & flag) == flag;
}
inline void setFlag(U32 flag)
{
- U32 flags((mSettings.has(SETTING_FLAGS)) ? (U32)mSettings[SETTING_FLAGS].asInteger() : 0);
-
- flags |= flag;
-
- if (flags)
- mSettings[SETTING_FLAGS] = LLSD::Integer(flags);
- else
- mSettings.erase(SETTING_FLAGS);
+ mSettingFlags |= flag;
+ setLLSDDirty();
}
inline void clearFlag(U32 flag)
{
- U32 flags((mSettings.has(SETTING_FLAGS)) ? (U32)mSettings[SETTING_FLAGS].asInteger() : 0);
-
- flags &= ~flag;
-
- if (flags)
- mSettings[SETTING_FLAGS] = LLSD::Integer(flags);
- else
- mSettings.erase(SETTING_FLAGS);
+ mSettingFlags &= ~flag;
+ setLLSDDirty();
}
virtual void replaceSettings(LLSD settings)
@@ -183,14 +167,31 @@ public:
setDirtyFlag(true);
mReplaced = true;
mSettings = settings;
+ loadValuesFromLLSD();
+ }
+
+ void setSettings(LLSD settings)
+ {
+ setDirtyFlag(true);
+ mSettings = settings;
+ loadValuesFromLLSD();
}
- virtual LLSD getSettings() const;
+ // if you are using getSettings to edit them, call setSettings(settings),
+ // replaceSettings(settings) or loadValuesFromLLSD() afterwards
+ virtual LLSD& getSettings();
+ virtual void setLLSDDirty()
+ {
+ mLLSDDirty = true;
+ mDirty = true;
+ clearAssetId();
+ }
//---------------------------------------------------------------------
//
inline void setLLSD(const std::string &name, const LLSD &value)
{
+ saveValuesIfNeeded();
mSettings[name] = value;
mDirty = true;
if (name != SETTING_ASSETID)
@@ -202,8 +203,9 @@ public:
setLLSD(name, value);
}
- inline LLSD getValue(const std::string &name, const LLSD &deflt = LLSD()) const
+ inline LLSD getValue(const std::string &name, const LLSD &deflt = LLSD())
{
+ saveValuesIfNeeded();
if (!mSettings.has(name))
return deflt;
return mSettings[name];
@@ -259,11 +261,11 @@ public:
(const_cast<LLSettingsBase *>(this))->updateSettings();
}
- virtual void blend(const ptr_t &end, BlendFactor blendf) = 0;
+ virtual void blend(ptr_t &end, BlendFactor blendf) = 0;
virtual bool validate();
- virtual ptr_t buildDerivedClone() const = 0;
+ virtual ptr_t buildDerivedClone() = 0;
class Validator
{
@@ -310,17 +312,20 @@ public:
inline void setAssetId(LLUUID value)
{ // note that this skips setLLSD
- mSettings[SETTING_ASSETID] = value;
+ mAssetId = value;
+ mLLSDDirty = true;
}
inline void clearAssetId()
{
- if (mSettings.has(SETTING_ASSETID))
- mSettings.erase(SETTING_ASSETID);
+ mAssetId.setNull();
+ mLLSDDirty = true;
}
// Calculate any custom settings that may need to be cached.
virtual void updateSettings() { mDirty = false; mReplaced = false; }
+ LLSD cloneSettings();
+
protected:
LLSettingsBase();
@@ -331,7 +336,7 @@ protected:
typedef std::set<std::string> stringset_t;
// combining settings objects. Customize for specific setting types
- virtual void lerpSettings(const LLSettingsBase &other, BlendFactor mix);
+ virtual void lerpSettings(LLSettingsBase &other, BlendFactor mix);
// combining settings maps where it can based on mix rate
// @settings initial value (mix==0)
@@ -339,8 +344,8 @@ protected:
// @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;
+ static LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, BlendFactor mix, const stringset_t& skip, const stringset_t& slerps);
+ static LLSD interpolateSDValue(const std::string& name, const LLSD &value, const LLSD &other, const parammapping_t& defaults, BlendFactor mix, const stringset_t& skip, const stringset_t& slerps);
/// when lerping between settings, some may require special handling.
/// Get a list of these key to be skipped by the default settings lerp.
@@ -353,32 +358,40 @@ protected:
virtual validation_list_t getValidationList() const = 0;
- // Apply any settings that need special handling.
- virtual void applySpecial(void *, bool force = false) { };
+ // Apply settings.
+ virtual void applyToUniforms(void *) { };
+ virtual void applySpecial(void*, bool force = false) { };
virtual parammapping_t getParameterMap() const { return parammapping_t(); }
- LLSD mSettings;
-
- LLSD cloneSettings() const;
-
inline void setBlendFactor(BlendFactor blendfactor)
{
mBlendedFactor = blendfactor;
}
- void replaceWith(LLSettingsBase::ptr_t other)
+ virtual void replaceWith(LLSettingsBase::ptr_t other)
{
replaceSettings(other->cloneSettings());
setBlendFactor(other->getBlendFactor());
}
+ virtual void loadValuesFromLLSD();
+ virtual void saveValuesToLLSD();
+ void saveValuesIfNeeded();
+
+ LLUUID mAssetId;
+ LLUUID mSettingId;
+ std::string mSettingName;
+ U32 mSettingFlags;
+
private:
+ bool mLLSDDirty;
bool mDirty;
bool mReplaced; // super dirty!
- LLSD combineSDMaps(const LLSD &first, const LLSD &other) const;
+ static LLSD combineSDMaps(const LLSD &first, const LLSD &other);
+ LLSD mSettings;
BlendFactor mBlendedFactor;
};
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index 1e7de94414..19d1bb1907 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -124,33 +124,40 @@ static const F32 DEFAULT_MULTISLIDER_INCREMENT(0.005f);
//=========================================================================
LLSettingsDay::LLSettingsDay(const LLSD &data) :
LLSettingsBase(data),
- mInitialized(false)
+ mInitialized(false),
+ mDaySettings(LLSD::emptyMap())
{
mDayTracks.resize(TRACK_MAX);
}
LLSettingsDay::LLSettingsDay() :
LLSettingsBase(),
- mInitialized(false)
+ mInitialized(false),
+ mDaySettings(LLSD::emptyMap())
{
mDayTracks.resize(TRACK_MAX);
}
//=========================================================================
-LLSD LLSettingsDay::getSettings() const
+LLSD& LLSettingsDay::getSettings()
{
- LLSD settings(LLSD::emptyMap());
+ if (!mDaySettings.emptyMap())
+ {
+ return mDaySettings;
+ }
+ mDaySettings = LLSD::emptyMap();
+ LLSD& settings = LLSettingsBase::getSettings();
- if (mSettings.has(SETTING_NAME))
- settings[SETTING_NAME] = mSettings[SETTING_NAME];
+ if (settings.has(SETTING_NAME))
+ mDaySettings[SETTING_NAME] = settings[SETTING_NAME];
- if (mSettings.has(SETTING_ID))
- settings[SETTING_ID] = mSettings[SETTING_ID];
+ if (settings.has(SETTING_ID))
+ mDaySettings[SETTING_ID] = settings[SETTING_ID];
- if (mSettings.has(SETTING_ASSETID))
- settings[SETTING_ASSETID] = mSettings[SETTING_ASSETID];
+ if (settings.has(SETTING_ASSETID))
+ mDaySettings[SETTING_ASSETID] = settings[SETTING_ASSETID];
- settings[SETTING_TYPE] = getSettingsType();
+ mDaySettings[SETTING_TYPE] = getSettingsType();
std::map<std::string, LLSettingsBase::ptr_t> in_use;
@@ -174,7 +181,7 @@ LLSD LLSettingsDay::getSettings() const
}
tracks.append(trackout);
}
- settings[SETTING_TRACKS] = tracks;
+ mDaySettings[SETTING_TRACKS] = tracks;
LLSD frames(LLSD::emptyMap());
for (std::map<std::string, LLSettingsBase::ptr_t>::iterator itFrame = in_use.begin(); itFrame != in_use.end(); ++itFrame)
@@ -184,9 +191,15 @@ LLSD LLSettingsDay::getSettings() const
frames[(*itFrame).first] = framesettings;
}
- settings[SETTING_FRAMES] = frames;
+ mDaySettings[SETTING_FRAMES] = frames;
- return settings;
+ return mDaySettings;
+}
+
+void LLSettingsDay::setLLSDDirty()
+{
+ mDaySettings = LLSD::emptyMap();
+ LLSettingsBase::setLLSDDirty();
}
bool LLSettingsDay::initialize(bool validate_frames)
@@ -392,6 +405,8 @@ bool LLSettingsDay::initialize(bool validate_frames)
mSettings[SETTING_ASSETID] = assetid;
}
+ loadValuesFromLLSD();
+
mInitialized = true;
return true;
}
@@ -449,7 +464,7 @@ LLSD LLSettingsDay::defaults()
return dfltsetting;
}
-void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F64 mix)
+void LLSettingsDay::blend(LLSettingsBase::ptr_t &other, F64 mix)
{
LL_ERRS("DAYCYCLE") << "Day cycles are not blendable!" << LL_ENDL;
}
diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h
index 917b0870f2..d37423ea9a 100644
--- a/indra/llinventory/llsettingsdaycycle.h
+++ b/indra/llinventory/llsettingsdaycycle.h
@@ -81,9 +81,10 @@ public:
bool initialize(bool validate_frames = false);
- virtual ptr_t buildClone() const = 0;
- virtual ptr_t buildDeepCloneAndUncompress() const = 0;
- virtual LLSD getSettings() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() = 0;
+ virtual ptr_t buildDeepCloneAndUncompress() = 0;
+ virtual LLSD& getSettings() SETTINGS_OVERRIDE;
+ virtual void setLLSDDirty() override;
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_DAYCYCLE; }
@@ -91,7 +92,7 @@ public:
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("daycycle"); }
// Settings status
- virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix) SETTINGS_OVERRIDE;
+ virtual void blend(LLSettingsBase::ptr_t &other, F64 mix) SETTINGS_OVERRIDE;
static LLSD defaults();
@@ -127,7 +128,7 @@ public:
virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE;
static validation_list_t validationList();
- virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
+ virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
LLSettingsBase::TrackPosition getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe);
LLSettingsBase::TrackPosition getLowerBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe);
@@ -143,6 +144,7 @@ protected:
private:
CycleList_t mDayTracks;
+ LLSD mDaySettings;
LLSettingsBase::Seconds mLastUpdateTime;
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index cbec2f4906..272219c02d 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -443,7 +443,7 @@ void LLSettingsSky::replaceWithSky(LLSettingsSky::ptr_t pother)
mNextHaloTextureId = pother->mNextHaloTextureId;
}
-void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
+void LLSettingsSky::blend(LLSettingsBase::ptr_t &end, F64 blendf)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
llassert(getSettingsType() == end->getSettingsType());
@@ -451,24 +451,29 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast<LLSettingsSky>(end);
if (other)
{
- if (other->mSettings.has(SETTING_LEGACY_HAZE))
+ LLSD& settings = getSettings();
+ LLSD& other_settings = other->getSettings();
+ if (other_settings.has(SETTING_LEGACY_HAZE))
{
- if (!mSettings.has(SETTING_LEGACY_HAZE) || !mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT))
+ if (!settings.has(SETTING_LEGACY_HAZE) || !settings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT))
{
// Special case since SETTING_AMBIENT is both in outer and legacy maps, we prioritize legacy one
- // see getAmbientColor(), we are about to replaceSettings(), so we are free to set it
- setAmbientColor(getAmbientColor());
+ // see getColor(), we are about to replaceSettings(), so we are free to set it
+ LLColor3 ambient = getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f));
+ setAmbientColor(ambient);
+ settings[SETTING_LEGACY_HAZE][SETTING_AMBIENT] = ambient.getValue();
}
}
else
{
- if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT))
+ if (settings.has(SETTING_LEGACY_HAZE) && settings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT))
{
// Special case due to ambient's duality
// We need to match 'other's' structure for interpolation.
// We are free to change mSettings, since we are about to reset it
- mSettings[SETTING_AMBIENT] = getAmbientColor().getValue();
- mSettings[SETTING_LEGACY_HAZE].erase(SETTING_AMBIENT);
+ LLColor3 ambient = getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f));
+ settings[SETTING_AMBIENT] = ambient.getValue();
+ settings[SETTING_LEGACY_HAZE].erase(SETTING_AMBIENT);
}
}
@@ -480,22 +485,24 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
// If there is no cloud texture in destination, reduce coverage to imitate disappearance
// See LLDrawPoolWLSky::renderSkyClouds... we don't blend present texture with null
// Note: Probably can be done by shader
- cloud_shadow = lerp((F32)mSettings[SETTING_CLOUD_SHADOW].asReal(), 0.f, (F32)blendf);
+ cloud_shadow = lerp((F32)settings[SETTING_CLOUD_SHADOW].asReal(), 0.f, (F32)blendf);
cloud_noise_id_next = cloud_noise_id;
}
else if (cloud_noise_id.isNull() && !cloud_noise_id_next.isNull())
{
// Source has no cloud texture, reduce initial coverage to imitate appearance
// use same texture as destination
- cloud_shadow = lerp(0.f, (F32)other->mSettings[SETTING_CLOUD_SHADOW].asReal(), (F32)blendf);
+ cloud_shadow = lerp(0.f, (F32)other_settings[SETTING_CLOUD_SHADOW].asReal(), (F32)blendf);
setCloudNoiseTextureId(cloud_noise_id_next);
}
else
{
- cloud_shadow = lerp((F32)mSettings[SETTING_CLOUD_SHADOW].asReal(), (F32)other->mSettings[SETTING_CLOUD_SHADOW].asReal(), (F32)blendf);
+ cloud_shadow = lerp((F32)settings[SETTING_CLOUD_SHADOW].asReal(), (F32)other_settings[SETTING_CLOUD_SHADOW].asReal(), (F32)blendf);
}
+ stringset_t skip = getSkipInterpolateKeys();
+ stringset_t slerps = getSlerpKeys();
- LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf);
+ LLSD blenddata = interpolateSDMap(settings, other_settings, other->getParameterMap(), blendf, skip, slerps);
blenddata[SETTING_CLOUD_SHADOW] = LLSD::Real(cloud_shadow);
replaceSettings(blenddata);
mNextSunTextureId = other->getSunTextureId();
@@ -955,6 +962,180 @@ void LLSettingsSky::updateSettings()
calculateLightSettings();
}
+
+F32 get_float(bool &use_legacy, LLSD& settings, std::string key, F32 default_value)
+{
+ if (settings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && settings[LLSettingsSky::SETTING_LEGACY_HAZE].has(key))
+ {
+ use_legacy = true;
+ return (F32)settings[LLSettingsSky::SETTING_LEGACY_HAZE][key].asReal();
+ }
+ if (settings.has(key))
+ {
+ return (F32)settings[key].asReal();
+ }
+ return default_value;
+}
+
+LLColor3 get_color(bool& use_legacy, LLSD& settings, const std::string& key, const LLColor3& default_value)
+{
+ if (settings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && settings[LLSettingsSky::SETTING_LEGACY_HAZE].has(key))
+ {
+ use_legacy = true;
+ return LLColor3(settings[LLSettingsSky::SETTING_LEGACY_HAZE][key]);
+ }
+ use_legacy = false;
+ if (settings.has(key))
+ {
+ return LLColor3(settings[key]);
+ }
+ return default_value;
+}
+
+
+void LLSettingsSky::loadValuesFromLLSD()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
+
+ LLSettingsBase::loadValuesFromLLSD();
+
+ LLSD& settings = getSettings();
+ mCanAutoAdjust = !settings.has(SETTING_REFLECTION_PROBE_AMBIANCE);
+ if (mCanAutoAdjust)
+ {
+ mReflectionProbeAmbiance = 0;
+ }
+ else
+ {
+ mReflectionProbeAmbiance = (F32)settings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal();
+ }
+
+ mSunTextureId = settings[SETTING_SUN_TEXTUREID].asUUID();
+ mMoonTextureId = settings[SETTING_MOON_TEXTUREID].asUUID();
+ mCloudTextureId = settings[SETTING_CLOUD_TEXTUREID].asUUID();
+ mHaloTextureId = settings[SETTING_HALO_TEXTUREID].asUUID();
+ mRainbowTextureId = settings[SETTING_RAINBOW_TEXTUREID].asUUID();
+ mBloomTextureId = settings[SETTING_BLOOM_TEXTUREID].asUUID();
+
+ mSunScale = (F32)settings[SETTING_SUN_SCALE].asReal();
+ mSunRotation = LLQuaternion(settings[SETTING_SUN_ROTATION]);
+ mSunlightColor = LLColor3(settings[SETTING_SUNLIGHT_COLOR]);
+ mStarBrightness = (F32)settings[SETTING_STAR_BRIGHTNESS].asReal();
+ mMoonBrightness = (F32)settings[SETTING_MOON_BRIGHTNESS].asReal();
+ mMoonScale = (F32)settings[SETTING_MOON_SCALE].asReal();
+ mMoonRotation = LLQuaternion(settings[SETTING_MOON_ROTATION]);
+ mMaxY = (F32)settings[SETTING_MAX_Y].asReal();
+ mGlow = LLColor3(settings[SETTING_GLOW]);
+ mGamma = (F32)settings[SETTING_GAMMA].asReal();
+ mCloudVariance = (F32)settings[SETTING_CLOUD_VARIANCE].asReal();
+ mCloudShadow = (F32)settings[SETTING_CLOUD_SHADOW].asReal();
+ mScrollRate = LLVector2(settings[SETTING_CLOUD_SCROLL_RATE]);
+ mCloudScale = (F32)settings[SETTING_CLOUD_SCALE].asReal();
+ mCloudPosDensity1 = LLColor3(settings[SETTING_CLOUD_POS_DENSITY1]);
+ mCloudPosDensity2 = LLColor3(settings[SETTING_CLOUD_POS_DENSITY2]);
+ mCloudColor = LLColor3(settings[SETTING_CLOUD_COLOR]);
+ mAbsorptionConfigs = settings[SETTING_ABSORPTION_CONFIG];
+ mMieConfigs = settings[SETTING_MIE_CONFIG];
+ mRayleighConfigs = settings[SETTING_RAYLEIGH_CONFIG];
+ mSunArcRadians = (F32)settings[SETTING_SUN_ARC_RADIANS].asReal();
+ mSkyTopRadius = (F32)settings[SETTING_SKY_TOP_RADIUS].asReal();
+ mSkyBottomRadius = (F32)settings[SETTING_SKY_BOTTOM_RADIUS].asReal();
+ mSkyMoistureLevel = (F32)settings[SETTING_SKY_MOISTURE_LEVEL].asReal();
+ mSkyDropletRadius = (F32)settings[SETTING_SKY_DROPLET_RADIUS].asReal();
+ mSkyIceLevel = (F32)settings[SETTING_SKY_ICE_LEVEL].asReal();
+ mPlanetRadius = (F32)settings[SETTING_PLANET_RADIUS].asReal();
+
+ // special case for legacy handling
+ mDistanceMultiplier = get_float(mLegacyDistanceMultiplier, settings, SETTING_DISTANCE_MULTIPLIER, 0.8f);
+ mDensityMultiplier = get_float(mLegacyDensityMultiplier, settings, SETTING_DENSITY_MULTIPLIER, 0.0001f);
+ mHazeHorizon = get_float(mLegacyHazeHorizon, settings, SETTING_HAZE_HORIZON, 0.19f);
+ mHazeDensity = get_float(mLegacyHazeDensity, settings, SETTING_HAZE_DENSITY, 0.7f);
+ mBlueHorizon = get_color(mLegacyBlueHorizon, settings, SETTING_BLUE_HORIZON, LLColor3(0.4954f, 0.4954f, 0.6399f));
+ mBlueDensity = get_color(mLegacyBlueDensity, settings, SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f));
+ mAmbientColor = get_color(mLegacyAmbientColor, settings, SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f));
+}
+
+void LLSettingsSky::saveValuesToLLSD()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
+
+ LLSettingsBase::saveValuesToLLSD();
+
+ LLSD& settings = getSettings();
+
+ if (mCanAutoAdjust)
+ {
+ settings.erase(SETTING_REFLECTION_PROBE_AMBIANCE);
+ }
+ else
+ {
+ settings[SETTING_REFLECTION_PROBE_AMBIANCE] = mReflectionProbeAmbiance;
+ }
+ settings[SETTING_SUN_TEXTUREID] = mSunTextureId;
+ settings[SETTING_MOON_TEXTUREID] = mMoonTextureId;
+ settings[SETTING_CLOUD_TEXTUREID] = mCloudTextureId;
+ settings[SETTING_HALO_TEXTUREID] = mHaloTextureId;
+ settings[SETTING_RAINBOW_TEXTUREID] = mRainbowTextureId;
+ settings[SETTING_BLOOM_TEXTUREID] = mBloomTextureId;
+
+ settings[SETTING_SUN_SCALE] = mSunScale;
+ settings[SETTING_SUN_ROTATION] = mSunRotation.getValue();
+ settings[SETTING_SUNLIGHT_COLOR] = mSunlightColor.getValue();
+ settings[SETTING_STAR_BRIGHTNESS] = mStarBrightness;
+ settings[SETTING_MOON_BRIGHTNESS] = mMoonBrightness;
+ settings[SETTING_MOON_SCALE] = mMoonScale;
+ settings[SETTING_MOON_ROTATION] = mMoonRotation.getValue();
+ settings[SETTING_MAX_Y] = mMaxY;
+ settings[SETTING_GLOW] = mGlow.getValue();
+ settings[SETTING_GAMMA] = mGamma;
+ settings[SETTING_CLOUD_VARIANCE] = mCloudVariance;
+ settings[SETTING_CLOUD_SHADOW] = mCloudShadow;
+ settings[SETTING_CLOUD_SCROLL_RATE] = mScrollRate.getValue();
+ settings[SETTING_CLOUD_SCALE] = mCloudScale;
+ settings[SETTING_CLOUD_POS_DENSITY1] = mCloudPosDensity1.getValue();
+ settings[SETTING_CLOUD_POS_DENSITY2] = mCloudPosDensity2.getValue();
+ settings[SETTING_CLOUD_COLOR] = mCloudColor.getValue();
+ settings[SETTING_ABSORPTION_CONFIG] = mAbsorptionConfigs;
+ settings[SETTING_MIE_CONFIG] = mMieConfigs;
+ settings[SETTING_RAYLEIGH_CONFIG] = mRayleighConfigs;
+ settings[SETTING_SUN_ARC_RADIANS] = mSunArcRadians;
+ settings[SETTING_SKY_TOP_RADIUS] = mSkyTopRadius;
+ settings[SETTING_SKY_BOTTOM_RADIUS] = mSkyBottomRadius;
+ settings[SETTING_SKY_MOISTURE_LEVEL] = mSkyMoistureLevel;
+ settings[SETTING_SKY_DROPLET_RADIUS] = mSkyDropletRadius;
+ settings[SETTING_SKY_ICE_LEVEL] = mSkyIceLevel;
+ settings[SETTING_PLANET_RADIUS] = mPlanetRadius;
+ LLSD& legacy = settings[SETTING_LEGACY_HAZE];
+ if (mLegacyDistanceMultiplier)
+ {
+ legacy[SETTING_DISTANCE_MULTIPLIER] = mDistanceMultiplier;
+ }
+ if (mLegacyDensityMultiplier)
+ {
+ legacy[SETTING_DENSITY_MULTIPLIER] = mDensityMultiplier;
+ }
+ if (mLegacyHazeHorizon)
+ {
+ legacy[SETTING_HAZE_HORIZON] = mHazeHorizon;
+ }
+ if (mLegacyHazeDensity)
+ {
+ legacy[SETTING_HAZE_DENSITY] = mHazeDensity;
+ }
+ if (mLegacyBlueHorizon)
+ {
+ legacy[SETTING_BLUE_HORIZON] = mBlueHorizon.getValue();
+ }
+ if (mLegacyBlueDensity)
+ {
+ legacy[SETTING_BLUE_DENSITY] = mBlueDensity.getValue();
+ }
+ if (mLegacyAmbientColor)
+ {
+ legacy[SETTING_AMBIENT] = mAmbientColor.getValue();
+ }
+}
+
F32 LLSettingsSky::getSunMoonGlowFactor() const
{
return getIsSunUp() ? 1.0f :
@@ -1024,37 +1205,40 @@ LLColor3 LLSettingsSky::getLightDiffuse() const
return LLColor3::white;
}
-LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default_value) const
+LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default_value)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
- if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key))
+ LLSD& settings = getSettings();
+ if (settings.has(SETTING_LEGACY_HAZE) && settings[SETTING_LEGACY_HAZE].has(key))
{
- return LLColor3(mSettings[SETTING_LEGACY_HAZE][key]);
+ return LLColor3(settings[SETTING_LEGACY_HAZE][key]);
}
- if (mSettings.has(key))
+ if (settings.has(key))
{
- return LLColor3(mSettings[key]);
+ return LLColor3(settings[key]);
}
return default_value;
}
-F32 LLSettingsSky::getFloat(const std::string& key, F32 default_value) const
+F32 LLSettingsSky::getFloat(const std::string& key, F32 default_value)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
- if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key))
+
+ LLSD& settings = getSettings();
+ if (settings.has(SETTING_LEGACY_HAZE) && settings[SETTING_LEGACY_HAZE].has(key))
{
- return (F32)mSettings[SETTING_LEGACY_HAZE][key].asReal();
+ return (F32)settings[SETTING_LEGACY_HAZE][key].asReal();
}
- if (mSettings.has(key))
+ if (settings.has(key))
{
- return (F32)mSettings[key].asReal();
+ return (F32)settings[key].asReal();
}
return default_value;
}
LLColor3 LLSettingsSky::getAmbientColor() const
{
- return getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f));
+ return mAmbientColor;
}
LLColor3 LLSettingsSky::getAmbientColorClamped() const
@@ -1072,118 +1256,135 @@ LLColor3 LLSettingsSky::getAmbientColorClamped() const
LLColor3 LLSettingsSky::getBlueDensity() const
{
- return getColor(SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f));
+ return mBlueDensity;
}
LLColor3 LLSettingsSky::getBlueHorizon() const
{
- return getColor(SETTING_BLUE_HORIZON, LLColor3(0.4954f, 0.4954f, 0.6399f));
+ return mBlueHorizon;
}
F32 LLSettingsSky::getHazeDensity() const
{
- return getFloat(SETTING_HAZE_DENSITY, 0.7f);
+ return mHazeDensity;
}
F32 LLSettingsSky::getHazeHorizon() const
{
- return getFloat(SETTING_HAZE_HORIZON, 0.19f);
+ return mHazeHorizon;
}
F32 LLSettingsSky::getDensityMultiplier() const
{
- return getFloat(SETTING_DENSITY_MULTIPLIER, 0.0001f);
+ return mDensityMultiplier;
}
F32 LLSettingsSky::getDistanceMultiplier() const
{
- return getFloat(SETTING_DISTANCE_MULTIPLIER, 0.8f);
+ return mDistanceMultiplier;
}
void LLSettingsSky::setPlanetRadius(F32 radius)
{
- mSettings[SETTING_PLANET_RADIUS] = radius;
+ mPlanetRadius = radius;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSkyBottomRadius(F32 radius)
{
- mSettings[SETTING_SKY_BOTTOM_RADIUS] = radius;
+ mSkyBottomRadius = radius;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSkyTopRadius(F32 radius)
{
- mSettings[SETTING_SKY_TOP_RADIUS] = radius;
+ mSkyTopRadius = radius;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSunArcRadians(F32 radians)
{
- mSettings[SETTING_SUN_ARC_RADIANS] = radians;
+ mSunArcRadians = radians;
+ setDirtyFlag(true);
}
void LLSettingsSky::setMieAnisotropy(F32 aniso_factor)
{
getMieConfig()[SETTING_MIE_ANISOTROPY_FACTOR] = aniso_factor;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSkyMoistureLevel(F32 moisture_level)
{
- setValue(SETTING_SKY_MOISTURE_LEVEL, moisture_level);
+ mSkyMoistureLevel = moisture_level;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSkyDropletRadius(F32 radius)
{
- setValue(SETTING_SKY_DROPLET_RADIUS,radius);
+ mSkyDropletRadius = radius;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSkyIceLevel(F32 ice_level)
{
- setValue(SETTING_SKY_ICE_LEVEL, ice_level);
+ mSkyIceLevel = ice_level;
+ setDirtyFlag(true);
}
void LLSettingsSky::setReflectionProbeAmbiance(F32 ambiance)
{
- setValue(SETTING_REFLECTION_PROBE_AMBIANCE, ambiance);
+ mReflectionProbeAmbiance = ambiance;
+ mCanAutoAdjust = false;
+ setLLSDDirty();
}
void LLSettingsSky::setAmbientColor(const LLColor3 &val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT] = val.getValue();
+ mAmbientColor = val;
+ mLegacyAmbientColor = true;
setDirtyFlag(true);
}
void LLSettingsSky::setBlueDensity(const LLColor3 &val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue();
+ mBlueDensity = val;
+ mLegacyBlueDensity = true;
setDirtyFlag(true);
}
void LLSettingsSky::setBlueHorizon(const LLColor3 &val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON] = val.getValue();
+ mBlueHorizon = val;
+ mLegacyBlueHorizon = true;
setDirtyFlag(true);
}
void LLSettingsSky::setDensityMultiplier(F32 val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER] = val;
+ mDensityMultiplier = val;
+ mLegacyDensityMultiplier = true;
setDirtyFlag(true);
}
void LLSettingsSky::setDistanceMultiplier(F32 val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER] = val;
+ mDistanceMultiplier = val;
+ mLegacyDistanceMultiplier = true;
setDirtyFlag(true);
}
void LLSettingsSky::setHazeDensity(F32 val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY] = val;
+ mHazeDensity = val;
+ mLegacyHazeDensity = true;
setDirtyFlag(true);
}
void LLSettingsSky::setHazeHorizon(F32 val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON] = val;
+ mHazeHorizon = val;
+ mLegacyHazeHorizon = true;
setDirtyFlag(true);
}
@@ -1299,7 +1500,7 @@ LLColor3 LLSettingsSky::getMoonlightColor() const
return getSunlightColor(); //moon and sun share light color
}
-void LLSettingsSky::clampColor(LLColor3& color, F32 gamma, F32 scale) const
+void LLSettingsSky::clampColor(LLColor3& color, F32 gamma, F32 scale)
{
F32 max_color = llmax(color.mV[0], color.mV[1], color.mV[2]);
if (max_color > scale)
@@ -1415,22 +1616,22 @@ LLUUID LLSettingsSky::GetDefaultHaloTextureId()
F32 LLSettingsSky::getPlanetRadius() const
{
- return (F32)mSettings[SETTING_PLANET_RADIUS].asReal();
+ return mPlanetRadius;
}
F32 LLSettingsSky::getSkyMoistureLevel() const
{
- return (F32)mSettings[SETTING_SKY_MOISTURE_LEVEL].asReal();
+ return mSkyMoistureLevel;
}
F32 LLSettingsSky::getSkyDropletRadius() const
{
- return (F32)mSettings[SETTING_SKY_DROPLET_RADIUS].asReal();
+ return mSkyDropletRadius;
}
F32 LLSettingsSky::getSkyIceLevel() const
{
- return (F32)mSettings[SETTING_SKY_ICE_LEVEL].asReal();
+ return mSkyIceLevel;
}
F32 LLSettingsSky::getReflectionProbeAmbiance(bool auto_adjust) const
@@ -1440,22 +1641,22 @@ F32 LLSettingsSky::getReflectionProbeAmbiance(bool auto_adjust) const
return sAutoAdjustProbeAmbiance;
}
- return (F32)mSettings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal();
+ return mReflectionProbeAmbiance;
}
F32 LLSettingsSky::getSkyBottomRadius() const
{
- return (F32)mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal();
+ return mSkyBottomRadius;
}
F32 LLSettingsSky::getSkyTopRadius() const
{
- return (F32)mSettings[SETTING_SKY_TOP_RADIUS].asReal();
+ return mSkyTopRadius;
}
F32 LLSettingsSky::getSunArcRadians() const
{
- return (F32)mSettings[SETTING_SUN_ARC_RADIANS].asReal();
+ return mSunArcRadians;
}
F32 LLSettingsSky::getMieAnisotropy() const
@@ -1465,158 +1666,169 @@ F32 LLSettingsSky::getMieAnisotropy() const
LLSD LLSettingsSky::getRayleighConfig() const
{
- LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray());
+ LLSD copy = *(mRayleighConfigs.beginArray());
return copy;
}
LLSD LLSettingsSky::getMieConfig() const
{
- LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray());
+ LLSD copy = *(mMieConfigs.beginArray());
return copy;
}
LLSD LLSettingsSky::getAbsorptionConfig() const
{
- LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray());
+ LLSD copy = *(mAbsorptionConfigs.beginArray());
return copy;
}
LLSD LLSettingsSky::getRayleighConfigs() const
{
- return mSettings[SETTING_RAYLEIGH_CONFIG];
+ return mRayleighConfigs;
}
LLSD LLSettingsSky::getMieConfigs() const
{
- return mSettings[SETTING_MIE_CONFIG];
+ return mMieConfigs;
}
LLSD LLSettingsSky::getAbsorptionConfigs() const
{
- return mSettings[SETTING_ABSORPTION_CONFIG];
+ return mAbsorptionConfigs;
}
void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig)
{
- mSettings[SETTING_RAYLEIGH_CONFIG] = rayleighConfig;
+ mRayleighConfigs = rayleighConfig;
+ setLLSDDirty();
}
void LLSettingsSky::setMieConfigs(const LLSD& mieConfig)
{
- mSettings[SETTING_MIE_CONFIG] = mieConfig;
+ mMieConfigs = mieConfig;
+ setLLSDDirty();
}
void LLSettingsSky::setAbsorptionConfigs(const LLSD& absorptionConfig)
{
- mSettings[SETTING_ABSORPTION_CONFIG] = absorptionConfig;
+ mAbsorptionConfigs = absorptionConfig;
+ setLLSDDirty();
}
LLUUID LLSettingsSky::getBloomTextureId() const
{
- return mSettings[SETTING_BLOOM_TEXTUREID].asUUID();
+ return mBloomTextureId;
}
LLUUID LLSettingsSky::getRainbowTextureId() const
{
- return mSettings[SETTING_RAINBOW_TEXTUREID].asUUID();
+ return mRainbowTextureId;
}
LLUUID LLSettingsSky::getHaloTextureId() const
{
- return mSettings[SETTING_HALO_TEXTUREID].asUUID();
+ return mHaloTextureId;
}
//---------------------------------------------------------------------
LLColor3 LLSettingsSky::getCloudColor() const
{
- return LLColor3(mSettings[SETTING_CLOUD_COLOR]);
+ return mCloudColor;
}
void LLSettingsSky::setCloudColor(const LLColor3 &val)
{
- setValue(SETTING_CLOUD_COLOR, val);
+ mCloudColor = val;
+ setLLSDDirty();
}
LLUUID LLSettingsSky::getCloudNoiseTextureId() const
{
- return mSettings[SETTING_CLOUD_TEXTUREID].asUUID();
+ return mCloudTextureId;
}
void LLSettingsSky::setCloudNoiseTextureId(const LLUUID &id)
{
- setValue(SETTING_CLOUD_TEXTUREID, id);
+ mCloudTextureId = id;
+ setLLSDDirty();
}
LLColor3 LLSettingsSky::getCloudPosDensity1() const
{
- return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]);
+ return mCloudPosDensity1;
}
void LLSettingsSky::setCloudPosDensity1(const LLColor3 &val)
{
- setValue(SETTING_CLOUD_POS_DENSITY1, val);
+ mCloudPosDensity1 = val;
+ setLLSDDirty();
}
LLColor3 LLSettingsSky::getCloudPosDensity2() const
{
- return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY2]);
+ return mCloudPosDensity2;
}
void LLSettingsSky::setCloudPosDensity2(const LLColor3 &val)
{
- setValue(SETTING_CLOUD_POS_DENSITY2, val);
+ mCloudPosDensity2 = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getCloudScale() const
{
- return (F32)mSettings[SETTING_CLOUD_SCALE].asReal();
+ return mCloudScale;
}
void LLSettingsSky::setCloudScale(F32 val)
{
- setValue(SETTING_CLOUD_SCALE, val);
+ mCloudScale = val;
+ setLLSDDirty();
}
LLVector2 LLSettingsSky::getCloudScrollRate() const
{
- return LLVector2(mSettings[SETTING_CLOUD_SCROLL_RATE]);
+ return mScrollRate;
}
void LLSettingsSky::setCloudScrollRate(const LLVector2 &val)
{
- setValue(SETTING_CLOUD_SCROLL_RATE, val);
+ mScrollRate = val;
+ setLLSDDirty();
}
void LLSettingsSky::setCloudScrollRateX(F32 val)
{
- mSettings[SETTING_CLOUD_SCROLL_RATE][0] = val;
- setDirtyFlag(true);
+ mScrollRate.mV[0] = val;
+ setLLSDDirty();
}
void LLSettingsSky::setCloudScrollRateY(F32 val)
{
- mSettings[SETTING_CLOUD_SCROLL_RATE][1] = val;
- setDirtyFlag(true);
+ mScrollRate.mV[1] = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getCloudShadow() const
{
- return (F32)mSettings[SETTING_CLOUD_SHADOW].asReal();
+ return mCloudShadow;
}
void LLSettingsSky::setCloudShadow(F32 val)
{
- setValue(SETTING_CLOUD_SHADOW, val);
+ mCloudShadow = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getCloudVariance() const
{
- return (F32)mSettings[SETTING_CLOUD_VARIANCE].asReal();
+ return mCloudVariance;
}
void LLSettingsSky::setCloudVariance(F32 val)
{
- setValue(SETTING_CLOUD_VARIANCE, val);
+ mCloudVariance = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getDomeOffset() const
@@ -1633,88 +1845,94 @@ F32 LLSettingsSky::getDomeRadius() const
F32 LLSettingsSky::getGamma() const
{
- return (F32)mSettings[SETTING_GAMMA].asReal();
+ return mGamma;
}
void LLSettingsSky::setGamma(F32 val)
{
- mSettings[SETTING_GAMMA] = LLSD::Real(val);
- setDirtyFlag(true);
+ mGamma = val;
+ setLLSDDirty();
}
-
LLColor3 LLSettingsSky::getGlow() const
{
- return LLColor3(mSettings[SETTING_GLOW]);
+ return mGlow;
}
void LLSettingsSky::setGlow(const LLColor3 &val)
{
- setValue(SETTING_GLOW, val);
+ mGlow = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getMaxY() const
{
- return (F32)mSettings[SETTING_MAX_Y].asReal();
+ return mMaxY;
}
void LLSettingsSky::setMaxY(F32 val)
{
- setValue(SETTING_MAX_Y, val);
+ mMaxY = val;
+ setLLSDDirty();
}
LLQuaternion LLSettingsSky::getMoonRotation() const
{
- return LLQuaternion(mSettings[SETTING_MOON_ROTATION]);
+ return mMoonRotation;
}
void LLSettingsSky::setMoonRotation(const LLQuaternion &val)
{
- setValue(SETTING_MOON_ROTATION, val);
+ mMoonRotation = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getMoonScale() const
{
- return (F32)mSettings[SETTING_MOON_SCALE].asReal();
+ return mMoonScale;
}
void LLSettingsSky::setMoonScale(F32 val)
{
- setValue(SETTING_MOON_SCALE, val);
+ mMoonScale = val;
+ setLLSDDirty();
}
LLUUID LLSettingsSky::getMoonTextureId() const
{
- return mSettings[SETTING_MOON_TEXTUREID].asUUID();
+ return mMoonTextureId;
}
void LLSettingsSky::setMoonTextureId(LLUUID id)
{
- setValue(SETTING_MOON_TEXTUREID, id);
+ mMoonTextureId = id;
+ setLLSDDirty();
}
F32 LLSettingsSky::getMoonBrightness() const
{
- return (F32)mSettings[SETTING_MOON_BRIGHTNESS].asReal();
+ return mMoonBrightness;
}
void LLSettingsSky::setMoonBrightness(F32 brightness_factor)
{
- setValue(SETTING_MOON_BRIGHTNESS, brightness_factor);
+ mMoonBrightness = brightness_factor;
+ setLLSDDirty();
}
F32 LLSettingsSky::getStarBrightness() const
{
- return (F32)mSettings[SETTING_STAR_BRIGHTNESS].asReal();
+ return mStarBrightness;
}
void LLSettingsSky::setStarBrightness(F32 val)
{
- setValue(SETTING_STAR_BRIGHTNESS, val);
+ mStarBrightness = val;
+ setLLSDDirty();
}
LLColor3 LLSettingsSky::getSunlightColor() const
{
- return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]);
+ return mSunlightColor;
}
LLColor3 LLSettingsSky::getSunlightColorClamped() const
@@ -1733,38 +1951,41 @@ LLColor3 LLSettingsSky::getSunlightColorClamped() const
void LLSettingsSky::setSunlightColor(const LLColor3 &val)
{
- setValue(SETTING_SUNLIGHT_COLOR, val);
+ mSunlightColor = val;
+ setLLSDDirty();
}
LLQuaternion LLSettingsSky::getSunRotation() const
{
- return LLQuaternion(mSettings[SETTING_SUN_ROTATION]);
+ return mSunRotation;
}
void LLSettingsSky::setSunRotation(const LLQuaternion &val)
{
- setValue(SETTING_SUN_ROTATION, val);
+ mSunRotation = val;
+ setLLSDDirty();
}
-
F32 LLSettingsSky::getSunScale() const
{
- return (F32)mSettings[SETTING_SUN_SCALE].asReal();
+ return mSunScale;
}
void LLSettingsSky::setSunScale(F32 val)
{
- setValue(SETTING_SUN_SCALE, val);
+ mSunScale = val;
+ setLLSDDirty();
}
LLUUID LLSettingsSky::getSunTextureId() const
{
- return mSettings[SETTING_SUN_TEXTUREID].asUUID();
+ return mSunTextureId;
}
void LLSettingsSky::setSunTextureId(LLUUID id)
{
- setValue(SETTING_SUN_TEXTUREID, id);
+ mSunTextureId = id;
+ setLLSDDirty();
}
LLUUID LLSettingsSky::getNextSunTextureId() const
@@ -1790,5 +2011,5 @@ LLUUID LLSettingsSky::getNextBloomTextureId() const
// if true, this sky is a candidate for auto-adjustment
bool LLSettingsSky::canAutoAdjust() const
{
- return !mSettings.has(SETTING_REFLECTION_PROBE_AMBIANCE);
+ return mCanAutoAdjust;
}
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 40bb337a48..dc8e620f47 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -111,20 +111,23 @@ public:
LLSettingsSky(const LLSD &data);
virtual ~LLSettingsSky() { };
- virtual ptr_t buildClone() const = 0;
+ virtual ptr_t buildClone() = 0;
//---------------------------------------------------------------------
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("sky"); }
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_SKY; }
// Settings status
- virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
+ virtual void blend(LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE;
void replaceWithSky(LLSettingsSky::ptr_t pother);
static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f);
+ void loadValuesFromLLSD() override;
+ void saveValuesToLLSD() override;
+
F32 getPlanetRadius() const;
F32 getSkyBottomRadius() const;
F32 getSkyTopRadius() const;
@@ -306,7 +309,7 @@ public:
LLColor3 getSunlightColorClamped() const;
LLColor3 getAmbientColorClamped() const;
- virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
+ virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
static LLUUID GetDefaultAssetId();
static LLUUID GetDefaultSunTextureId();
@@ -348,6 +351,12 @@ protected:
virtual stringset_t getSlerpKeys() const SETTINGS_OVERRIDE;
virtual stringset_t getSkipInterpolateKeys() const SETTINGS_OVERRIDE;
+ LLUUID mSunTextureId;
+ LLUUID mMoonTextureId;
+ LLUUID mCloudTextureId;
+ LLUUID mBloomTextureId;
+ LLUUID mRainbowTextureId;
+ LLUUID mHaloTextureId;
LLUUID mNextSunTextureId;
LLUUID mNextMoonTextureId;
LLUUID mNextCloudTextureId;
@@ -355,17 +364,63 @@ protected:
LLUUID mNextRainbowTextureId;
LLUUID mNextHaloTextureId;
+ bool mCanAutoAdjust;
+ F32 mReflectionProbeAmbiance;
+ F32 mSunScale;
+ LLQuaternion mSunRotation;
+ LLColor3 mSunlightColor;
+ F32 mStarBrightness;
+ F32 mMoonBrightness;
+ F32 mMoonScale;
+ LLQuaternion mMoonRotation;
+ F32 mMaxY;
+ LLColor3 mGlow;
+ F32 mGamma;
+ F32 mCloudVariance;
+ F32 mCloudShadow;
+ LLVector2 mScrollRate;
+ F32 mCloudScale;
+ LLColor3 mCloudPosDensity1;
+ LLColor3 mCloudPosDensity2;
+ LLColor3 mCloudColor;
+ LLSD mAbsorptionConfigs;
+ LLSD mMieConfigs;
+ LLSD mRayleighConfigs;
+ F32 mSunArcRadians;
+ F32 mSkyTopRadius;
+ F32 mSkyBottomRadius;
+ F32 mSkyMoistureLevel;
+ F32 mSkyDropletRadius;
+ F32 mSkyIceLevel;
+ F32 mPlanetRadius;
+
+ F32 mHazeHorizon;
+ F32 mHazeDensity;
+ F32 mDistanceMultiplier;
+ F32 mDensityMultiplier;
+ LLColor3 mBlueHorizon;
+ LLColor3 mBlueDensity;
+ LLColor3 mAmbientColor;
+
+ bool mLegacyHazeHorizon;
+ bool mLegacyHazeDensity;
+ bool mLegacyDistanceMultiplier;
+ bool mLegacyDensityMultiplier;
+ bool mLegacyBlueHorizon;
+ bool mLegacyBlueDensity;
+ bool mLegacyAmbientColor;
+
private:
static LLSD rayleighConfigDefault();
static LLSD absorptionConfigDefault();
static LLSD mieConfigDefault();
- LLColor3 getColor(const std::string& key, const LLColor3& default_value) const;
- F32 getFloat(const std::string& key, F32 default_value) const;
+ LLColor3 getColor(const std::string& key, const LLColor3& default_value);
+ F32 getFloat(const std::string& key, F32 default_value);
void calculateHeavenlyBodyPositions() const;
void calculateLightSettings() const;
- void clampColor(LLColor3& color, F32 gamma, const F32 scale = 1.0f) const;
+ static void clampColor(LLColor3& color, F32 gamma, const F32 scale = 1.0f);
mutable LLVector3 mSunDirection;
mutable LLVector3 mMoonDirection;
diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp
index 161b8cda25..6127a523ae 100644
--- a/indra/llinventory/llsettingswater.cpp
+++ b/indra/llinventory/llsettingswater.cpp
@@ -109,6 +109,53 @@ LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position)
return dfltsetting;
}
+void LLSettingsWater::loadValuesFromLLSD()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
+
+ LLSettingsBase::loadValuesFromLLSD();
+
+ LLSD& settings = getSettings();
+
+ mBlurMultiplier = (F32)settings[SETTING_BLUR_MULTIPLIER].asReal();
+ mWaterFogColor = LLColor3(settings[SETTING_FOG_COLOR]);
+ mWaterFogDensity = (F32)settings[SETTING_FOG_DENSITY].asReal();
+ mFogMod = (F32)settings[SETTING_FOG_MOD].asReal();
+ mFresnelOffset = (F32)settings[SETTING_FRESNEL_OFFSET].asReal();
+ mFresnelScale = (F32)settings[SETTING_FRESNEL_SCALE].asReal();
+ mNormalScale = LLVector3(settings[SETTING_NORMAL_SCALE]);
+ mScaleAbove = (F32)settings[SETTING_SCALE_ABOVE].asReal();
+ mScaleBelow = (F32)settings[SETTING_SCALE_BELOW].asReal();
+ mWave1Dir = LLVector2(settings[SETTING_WAVE1_DIR]);
+ mWave2Dir = LLVector2(settings[SETTING_WAVE2_DIR]);
+
+ mNormalMapID = getNormalMapID();
+ mTransparentTextureID = getTransparentTextureID();
+}
+
+void LLSettingsWater::saveValuesToLLSD()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
+
+ LLSettingsBase::saveValuesToLLSD();
+
+ LLSD & settings = getSettings();
+ settings[SETTING_BLUR_MULTIPLIER] = LLSD::Real(mBlurMultiplier);
+ settings[SETTING_FOG_COLOR] = mWaterFogColor.getValue();
+ settings[SETTING_FOG_DENSITY] = LLSD::Real(mWaterFogDensity);
+ settings[SETTING_FOG_MOD] = LLSD::Real(mFogMod);
+ settings[SETTING_FRESNEL_OFFSET] = LLSD::Real(mFresnelOffset);
+ settings[SETTING_FRESNEL_SCALE] = LLSD::Real(mFresnelScale);
+ settings[SETTING_NORMAL_SCALE] = mNormalScale.getValue();
+ settings[SETTING_SCALE_ABOVE] = LLSD::Real(mScaleAbove);
+ settings[SETTING_SCALE_BELOW] = LLSD::Real(mScaleBelow);
+ settings[SETTING_WAVE1_DIR] = mWave1Dir.getValue();
+ settings[SETTING_WAVE2_DIR] = mWave2Dir.getValue();
+
+ settings[SETTING_NORMAL_MAP] = mNormalMapID;
+ settings[SETTING_TRANSPARENT_TEXTURE] = mTransparentTextureID;
+}
+
LLSD LLSettingsWater::translateLegacySettings(LLSD legacy)
{
bool converted_something(false);
@@ -180,12 +227,14 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy)
return newsettings;
}
-void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
+void LLSettingsWater::blend(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, other->getParameterMap(), blendf);
+ stringset_t skip = getSkipInterpolateKeys();
+ stringset_t slerps = getSlerpKeys();
+ LLSD blenddata = interpolateSDMap(getSettings(), other->getSettings(), other->getParameterMap(), blendf, skip, slerps);
replaceSettings(blenddata);
mNextNormalMapID = other->getNormalMapID();
mNextTransparentTextureID = other->getTransparentTextureID();
diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h
index 9e7ff61272..0f2a62bba2 100644
--- a/indra/llinventory/llsettingswater.h
+++ b/indra/llinventory/llsettingswater.h
@@ -55,151 +55,167 @@ public:
LLSettingsWater(const LLSD &data);
virtual ~LLSettingsWater() { };
- virtual ptr_t buildClone() const = 0;
+ virtual ptr_t buildClone() = 0;
//---------------------------------------------------------------------
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("water"); }
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_WATER; }
// Settings status
- virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
+ virtual void blend(LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE;
void replaceWithWater(LLSettingsWater::ptr_t other);
static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f);
+ void loadValuesFromLLSD() override;
+ void saveValuesToLLSD() override;
+
//---------------------------------------------------------------------
F32 getBlurMultiplier() const
{
- return (F32)mSettings[SETTING_BLUR_MULTIPLIER].asReal();
+ return mBlurMultiplier;
}
void setBlurMultiplier(F32 val)
{
- setValue(SETTING_BLUR_MULTIPLIER, val);
+ mBlurMultiplier = val;
+ setLLSDDirty();
}
LLColor3 getWaterFogColor() const
{
- return LLColor3(mSettings[SETTING_FOG_COLOR]);
+ return mWaterFogColor;
}
void setWaterFogColor(LLColor3 val)
{
- setValue(SETTING_FOG_COLOR, val);
+ mWaterFogColor = val;
+ setLLSDDirty();
}
F32 getWaterFogDensity() const
{
- return (F32)mSettings[SETTING_FOG_DENSITY].asReal();
+ return mWaterFogDensity;
}
F32 getModifiedWaterFogDensity(bool underwater) const;
void setWaterFogDensity(F32 val)
{
- setValue(SETTING_FOG_DENSITY, val);
+ mWaterFogDensity = val;
+ setLLSDDirty();
}
F32 getFogMod() const
{
- return (F32)mSettings[SETTING_FOG_MOD].asReal();
+ return mFogMod;
}
void setFogMod(F32 val)
{
- setValue(SETTING_FOG_MOD, val);
+ mFogMod = val;
+ setLLSDDirty();
}
F32 getFresnelOffset() const
{
- return (F32)mSettings[SETTING_FRESNEL_OFFSET].asReal();
+ return mFresnelOffset;
}
void setFresnelOffset(F32 val)
{
- setValue(SETTING_FRESNEL_OFFSET, val);
+ mFresnelOffset = val;
+ setLLSDDirty();
}
F32 getFresnelScale() const
{
- return (F32)mSettings[SETTING_FRESNEL_SCALE].asReal();
+ return mFresnelScale;
}
void setFresnelScale(F32 val)
{
- setValue(SETTING_FRESNEL_SCALE, val);
+ mFresnelScale = val;
+ setLLSDDirty();
}
LLUUID getTransparentTextureID() const
{
- return mSettings[SETTING_TRANSPARENT_TEXTURE].asUUID();
+ return mTransparentTextureID;
}
void setTransparentTextureID(LLUUID val)
{
- setValue(SETTING_TRANSPARENT_TEXTURE, val);
+ mTransparentTextureID = val;
+ setLLSDDirty();
}
LLUUID getNormalMapID() const
{
- return mSettings[SETTING_NORMAL_MAP].asUUID();
+ return mNormalMapID;
}
void setNormalMapID(LLUUID val)
{
- setValue(SETTING_NORMAL_MAP, val);
+ mNormalMapID = val;
+ setLLSDDirty();
}
LLVector3 getNormalScale() const
{
- return LLVector3(mSettings[SETTING_NORMAL_SCALE]);
+ return mNormalScale;
}
void setNormalScale(LLVector3 val)
{
- setValue(SETTING_NORMAL_SCALE, val);
+ mNormalScale = val;
+ setLLSDDirty();
}
F32 getScaleAbove() const
{
- return (F32)mSettings[SETTING_SCALE_ABOVE].asReal();
+ return mScaleAbove;
}
void setScaleAbove(F32 val)
{
- setValue(SETTING_SCALE_ABOVE, val);
+ mScaleAbove = val;
+ setLLSDDirty();
}
F32 getScaleBelow() const
{
- return (F32)mSettings[SETTING_SCALE_BELOW].asReal();
+ return mScaleBelow;
}
void setScaleBelow(F32 val)
{
- setValue(SETTING_SCALE_BELOW, val);
+ mScaleBelow = val;
+ setLLSDDirty();
}
LLVector2 getWave1Dir() const
{
- return LLVector2(mSettings[SETTING_WAVE1_DIR]);
+ return mWave1Dir;
}
void setWave1Dir(LLVector2 val)
{
- setValue(SETTING_WAVE1_DIR, val);
+ mWave1Dir = val;
+ setLLSDDirty();
}
LLVector2 getWave2Dir() const
{
- return LLVector2(mSettings[SETTING_WAVE2_DIR]);
+ return mWave2Dir;
}
void setWave2Dir(LLVector2 val)
{
- setValue(SETTING_WAVE2_DIR, val);
+ mWave2Dir = val;
+ setLLSDDirty();
}
//-------------------------------------------
@@ -218,7 +234,7 @@ public:
static LLSD translateLegacySettings(LLSD legacy);
- virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
+ virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
static LLUUID GetDefaultAssetId();
static LLUUID GetDefaultWaterNormalAssetId();
@@ -241,9 +257,22 @@ protected:
LLSettingsWater();
+ LLUUID mTransparentTextureID;
+ LLUUID mNormalMapID;
LLUUID mNextTransparentTextureID;
LLUUID mNextNormalMapID;
+ F32 mBlurMultiplier;
+ LLColor3 mWaterFogColor;
+ F32 mWaterFogDensity;
+ F32 mFogMod;
+ F32 mFresnelOffset;
+ F32 mFresnelScale;
+ LLVector3 mNormalScale;
+ F32 mScaleAbove;
+ F32 mScaleBelow;
+ LLVector2 mWave1Dir;
+ LLVector2 mWave2Dir;
};
#endif
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 0b4630dfc3..05bd704556 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -453,11 +453,11 @@ namespace
void applyInjections(LLSettingsBase::Seconds delta)
{
- this->mSettings = this->mSource->getSettings();
+ LLSD settings = this->mSource->cloneSettings();
for (auto ito = mOverrideValues.beginMap(); ito != mOverrideValues.endMap(); ++ito)
{
- this->mSettings[(*ito).first] = (*ito).second;
+ settings[(*ito).first] = (*ito).second;
}
const LLSettingsBase::stringset_t &slerps = this->getSlerpKeys();
@@ -469,7 +469,7 @@ namespace
{
std::string key_name = (*it)->mKeyName;
- LLSD value = this->mSettings[key_name];
+ LLSD value = settings[key_name];
LLSD target = (*it)->mValue;
if ((*it)->mFirstTime)
@@ -485,11 +485,11 @@ namespace
{
mOverrideValues[key_name] = target;
mOverrideExps[key_name] = (*it)->mExperience;
- this->mSettings[key_name] = target;
+ settings[key_name] = target;
}
else
{
- this->mSettings.erase(key_name);
+ settings.erase(key_name);
}
}
else if (specials.find(key_name) != specials.end())
@@ -500,8 +500,8 @@ namespace
{
if (!(*it)->mBlendIn)
mix = 1.0 - mix;
- (*it)->mLastValue = this->interpolateSDValue(key_name, value, target, this->getParameterMap(), mix, slerps);
- this->mSettings[key_name] = (*it)->mLastValue;
+ (*it)->mLastValue = this->interpolateSDValue(key_name, value, target, this->getParameterMap(), mix, skips, slerps);
+ settings[key_name] = (*it)->mLastValue;
}
}
@@ -520,7 +520,7 @@ namespace
{
mInjections.erase(mInjections.begin(), mInjections.end());
}
-
+ this->setSettings(settings);
}
bool hasInjections() const
@@ -685,7 +685,8 @@ namespace
if (!injection->mBlendIn)
mix = 1.0 - mix;
stringset_t dummy;
- F64 value = this->mSettings[injection->mKeyName].asReal();
+ LLSD settings = this->cloneSettings();
+ F64 value = settings[injection->mKeyName].asReal();
if (this->getCloudNoiseTextureId().isNull())
{
value = 0; // there was no texture so start from zero coverage
@@ -695,7 +696,8 @@ namespace
// with different transitions, don't ignore it
F64 result = lerp((F32)value, (F32)injection->mValue.asReal(), (F32)mix);
injection->mLastValue = LLSD::Real(result);
- this->mSettings[injection->mKeyName] = injection->mLastValue;
+ settings[injection->mKeyName] = injection->mLastValue;
+ this->setSettings(settings);
}
// Unfortunately I don't have a per texture blend factor. We'll just pick the one that is furthest along.
@@ -1740,90 +1742,9 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con
{
uniforms[i].clear();
}
-
- LLShaderUniforms* shader = &uniforms[LLGLSLShader::SG_ANY];
- //_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
- LLSettingsBase::parammapping_t params = psetting->getParameterMap();
- for (auto &it: params)
- {
- LLSD value;
- // 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->mSettings.has(it.first))
- {
- value = psetting->mSettings[it.first];
- }
- else
- {
- // We need to reset shaders, use defaults
- value = it.second.getDefaultValue();
- }
-
- LLSD::Type setting_type = value.type();
- stop_glerror();
- switch (setting_type)
- {
- case LLSD::TypeInteger:
- shader->uniform1i(it.second.getShaderKey(), value.asInteger());
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
- case LLSD::TypeReal:
- shader->uniform1f(it.second.getShaderKey(), (F32)value.asReal());
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
-
- case LLSD::TypeBoolean:
- shader->uniform1i(it.second.getShaderKey(), value.asBoolean() ? 1 : 0);
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
-
- case LLSD::TypeArray:
- {
- LLVector4 vect4(value);
- // always identify as a radiance pass if desaturating irradiance is disabled
- static LLCachedControl<bool> desaturate_irradiance(gSavedSettings, "RenderDesaturateIrradiance", true);
-
- if (desaturate_irradiance && gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass())
- { // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color
- auto max_vec = [](LLVector4 col)
- {
- LLColor3 color(col);
- F32 h, s, l;
- color.calcHSL(&h, &s, &l);
-
- col.mV[0] = col.mV[1] = col.mV[2] = l;
- return col;
- };
-
- switch (it.second.getShaderKey())
- {
- case LLShaderMgr::BLUE_HORIZON:
- case LLShaderMgr::BLUE_DENSITY:
- vect4 = max_vec(vect4);
- break;
- }
- }
-
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL;
- shader->uniform3fv(it.second.getShaderKey(), LLVector3(vect4.mV) );
- break;
- }
-
- // case LLSD::TypeMap:
- // case LLSD::TypeString:
- // case LLSD::TypeUUID:
- // case LLSD::TypeURI:
- // case LLSD::TypeBinary:
- // case LLSD::TypeDate:
- default:
- break;
- }
- }
//_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
+ psetting->applyToUniforms(uniforms);
psetting->applySpecial(uniforms);
}
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index e05b6f3736..be891213a7 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -549,7 +549,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky()
return skyp;
}
-LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() const
+LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
{
LLSD settings = cloneSettings();
U32 flags = getFlags();
@@ -684,6 +684,68 @@ void LLSettingsVOSky::updateSettings()
gSky.setMoonScale(getMoonScale());
}
+void draw_color(LLShaderUniforms* shader, const LLColor3& col, S32 shader_key)
+{
+ // always identify as a radiance pass if desaturating irradiance is disabled
+ static LLCachedControl<bool> desaturate_irradiance(gSavedSettings, "RenderDesaturateIrradiance", true);
+
+ LLVector4 vect4(col.mV[0], col.mV[1], col.mV[2]);
+
+ if (desaturate_irradiance && gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass())
+ { // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color
+ auto max_vec = [](LLVector4 col)
+ {
+ LLColor3 color(col);
+ F32 h, s, l;
+ color.calcHSL(&h, &s, &l);
+
+ col.mV[0] = col.mV[1] = col.mV[2] = l;
+ return col;
+ };
+
+ switch (shader_key)
+ {
+ case LLShaderMgr::BLUE_HORIZON:
+ case LLShaderMgr::BLUE_DENSITY:
+ vect4 = max_vec(vect4);
+ break;
+ }
+ }
+
+ //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL;
+ shader->uniform3fv(shader_key, LLVector3(vect4.mV));
+}
+
+inline void draw_real(LLShaderUniforms* shader, F32 value, S32 shader_key)
+{
+ shader->uniform1f(shader_key, value);
+}
+
+void LLSettingsVOSky::applyToUniforms(void* ptarget)
+{
+ LLShaderUniforms* shader = &((LLShaderUniforms*)ptarget)[LLGLSLShader::SG_ANY];
+ LLSD &settings = getSettings();
+
+ draw_color(shader, getAmbientColor(), LLShaderMgr::AMBIENT);
+ draw_color(shader, getBlueDensity(), LLShaderMgr::BLUE_DENSITY);
+ draw_color(shader, getBlueHorizon(), LLShaderMgr::BLUE_HORIZON);
+ draw_real(shader, getHazeDensity(), LLShaderMgr::HAZE_DENSITY);
+ draw_real(shader, getHazeHorizon(), LLShaderMgr::HAZE_HORIZON);
+ draw_real(shader, getDensityMultiplier(), LLShaderMgr::DENSITY_MULTIPLIER);
+ draw_real(shader, getDistanceMultiplier(), LLShaderMgr::DISTANCE_MULTIPLIER);
+ draw_color(shader, getCloudPosDensity2(), LLShaderMgr::CLOUD_POS_DENSITY2);
+ draw_real(shader, getCloudScale(), LLShaderMgr::CLOUD_SCALE);
+ draw_real(shader, getCloudShadow(), LLShaderMgr::CLOUD_SHADOW);
+ draw_real(shader, getCloudVariance(), LLShaderMgr::CLOUD_VARIANCE);
+ draw_color(shader, getGlow(), LLShaderMgr::GLOW);
+ draw_real(shader, getMaxY(), LLShaderMgr::MAX_Y);
+ draw_real(shader, getMoonBrightness(), LLShaderMgr::MOON_BRIGHTNESS);
+ draw_real(shader, getSkyMoistureLevel(), LLShaderMgr::MOISTURE_LEVEL);
+ draw_real(shader, getSkyDropletRadius(), LLShaderMgr::DROPLET_RADIUS);
+ draw_real(shader, getSkyIceLevel(), LLShaderMgr::ICE_LEVEL);
+ draw_real(shader, getReflectionProbeAmbiance(), LLShaderMgr::REFLECTION_PROBE_AMBIANCE);
+}
+
void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
@@ -702,7 +764,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, light_direction);
// Legacy? SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate")
- LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]);
+ LLVector4 vect_c_p_d1(mCloudPosDensity1.mV[0], mCloudPosDensity1.mV[1], mCloudPosDensity1.mV[2]);
LLVector4 cloud_scroll( LLEnvironment::instance().getCloudScrollDelta() );
// SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
@@ -935,7 +997,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater()
return waterp;
}
-LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() const
+LLSettingsWater::ptr_t LLSettingsVOWater::buildClone()
{
LLSD settings = cloneSettings();
U32 flags = getFlags();
@@ -974,6 +1036,12 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater)
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
+
+void LLSettingsVOWater::applyToUniforms(void*)
+{
+
+}
+
void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
@@ -1373,7 +1441,7 @@ void LLSettingsVODay::combineIntoDayCycle(LLSettingsDay::ptr_t pday, LLSettingsB
}
-LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
+LLSettingsDay::ptr_t LLSettingsVODay::buildClone()
{
LLSD settings = cloneSettings();
@@ -1398,10 +1466,10 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
return dayp;
}
-LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const
+LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress()
{
// no need for SETTING_TRACKS or SETTING_FRAMES, so take base LLSD
- LLSD settings = llsd_clone(mSettings);
+ LLSD settings = llsd_clone(getSettings());
U32 flags = getFlags();
LLSettingsDay::ptr_t day_clone = std::make_shared<LLSettingsVODay>(settings);
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index c55b3f82b9..92cb8d0704 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -94,7 +94,7 @@ public:
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages);
static ptr_t buildDefaultSky();
- virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() SETTINGS_OVERRIDE;
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
@@ -110,6 +110,7 @@ protected:
virtual void updateSettings() override;
+ virtual void applyToUniforms(void*) override;
virtual void applySpecial(void *, bool) override;
virtual parammapping_t getParameterMap() const override;
@@ -128,7 +129,7 @@ public:
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages);
static ptr_t buildDefaultWater();
- virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() SETTINGS_OVERRIDE;
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
@@ -138,6 +139,7 @@ protected:
LLSettingsVOWater();
virtual void updateSettings() override;
+ virtual void applyToUniforms(void*) override;
virtual void applySpecial(void *, bool) override;
virtual parammapping_t getParameterMap() const override;
@@ -167,8 +169,8 @@ public:
static ptr_t buildDefaultDayCycle();
static ptr_t buildFromEnvironmentMessage(LLSD settings);
static void buildFromOtherSetting(LLSettingsBase::ptr_t settings, asset_built_fn cb);
- virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
- virtual ptr_t buildDeepCloneAndUncompress() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() SETTINGS_OVERRIDE;
+ virtual ptr_t buildDeepCloneAndUncompress() SETTINGS_OVERRIDE;
static LLSD convertToLegacy(const ptr_t &);