From c04ceedbc3e462098eceaa233cd26f6bed79b773 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 19 Sep 2017 15:50:30 -0700 Subject: Baseline for settings changes --- indra/llinventory/llfoldertype.cpp | 2 +- indra/llinventory/llinventorydefines.h | 4 ++++ indra/llinventory/llinventorytype.cpp | 10 ++++++++++ indra/llinventory/llinventorytype.h | 6 +++++- 4 files changed, 20 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp index b0daf639fa..2c8c82a62b 100644 --- a/indra/llinventory/llfoldertype.cpp +++ b/indra/llinventory/llfoldertype.cpp @@ -147,7 +147,7 @@ bool LLFolderType::lookupIsEnsembleType(EType folder_type) // static LLAssetType::EType LLFolderType::folderTypeToAssetType(LLFolderType::EType folder_type) { - if (LLAssetType::lookup(LLAssetType::EType(folder_type)) == LLAssetType::badLookup()) + if (LLAssetType::lookup(LLAssetType::EType(folder_type)) == LLAssetType::BADLOOKUP) { LL_WARNS() << "Converting to unknown asset type " << folder_type << LL_ENDL; } diff --git a/indra/llinventory/llinventorydefines.h b/indra/llinventory/llinventorydefines.h index 3881fb1fd7..b420e98ecb 100644 --- a/indra/llinventory/llinventorydefines.h +++ b/indra/llinventory/llinventorydefines.h @@ -84,6 +84,10 @@ public: II_FLAGS_WEARABLES_MASK = 0xff, // Wearables use the low order byte of flags to store the // LLWearableType::EType enumeration found in newview/llwearable.h + // + II_FLAGS_SETTINGS_MASK = 0x0000ff, + // Settings (like wearables) use the low order byte of flags to store + // the settings type II_FLAGS_PERM_OVERWRITE_MASK = (II_FLAGS_OBJECT_SLAM_PERM | II_FLAGS_OBJECT_SLAM_SALE | diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index d1e6807f52..20c0a12d9e 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -85,6 +85,7 @@ LLInventoryDictionary::LLInventoryDictionary() addEntry(LLInventoryType::IT_MESH, new InventoryEntry("mesh", "mesh", 1, LLAssetType::AT_MESH)); addEntry(LLInventoryType::IT_WIDGET, new InventoryEntry("widget", "widget", 1, LLAssetType::AT_WIDGET)); addEntry(LLInventoryType::IT_PERSON, new InventoryEntry("person", "person", 1, LLAssetType::AT_PERSON)); + addEntry(LLInventoryType::IT_SETTINGS, new InventoryEntry("settings", "settings", 1, LLAssetType::AT_SETTINGS)); } @@ -145,6 +146,14 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] = LLInventoryType::IT_NONE, // 47 AT_NONE LLInventoryType::IT_NONE, // 48 AT_NONE LLInventoryType::IT_MESH, // 49 AT_MESH + + LLInventoryType::IT_NONE, // 50 AT_RESERVED_1 + LLInventoryType::IT_NONE, // 51 AT_RESERVED_2 + LLInventoryType::IT_NONE, // 52 AT_RESERVED_3 + LLInventoryType::IT_NONE, // 53 AT_RESERVED_4 + LLInventoryType::IT_NONE, // 54 AT_RESERVED_5 + + LLInventoryType::IT_SETTINGS, // 55 AT_SETTINGS }; // static @@ -194,6 +203,7 @@ bool LLInventoryType::cannotRestrictPermissions(LLInventoryType::EType type) { case IT_CALLINGCARD: case IT_LANDMARK: + case IT_SETTINGS: return true; default: return false; diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index fc3c78cf50..a45bcc364e 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -64,7 +64,8 @@ public: IT_MESH = 22, IT_WIDGET = 23, IT_PERSON = 24, - IT_COUNT = 25, + IT_SETTINGS = 25, + IT_COUNT = 26, IT_NONE = -1 }; @@ -110,6 +111,9 @@ public: ICONNAME_LINKFOLDER, ICONNAME_MESH, + ICONNAME_SETTINGS_SKY, + ICONNAME_SETTINGS_WATER, + ICONNAME_INVALID, ICONNAME_COUNT, ICONNAME_NONE = -1 -- cgit v1.2.3 From d7dd10b88bc3fda88f6528ecc5936e4889f019f3 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 30 Nov 2017 11:32:22 -0800 Subject: Split for viewer/simhost sync LLSD with simhost. --- indra/llinventory/CMakeLists.txt | 8 + indra/llinventory/llsettingsbase.cpp | 581 +++++++++++++++++++++++++++++++ indra/llinventory/llsettingsbase.h | 306 ++++++++++++++++ indra/llinventory/llsettingsdaycycle.cpp | 545 +++++++++++++++++++++++++++++ indra/llinventory/llsettingsdaycycle.h | 156 +++++++++ indra/llinventory/llsettingssky.cpp | 561 +++++++++++++++++++++++++++++ indra/llinventory/llsettingssky.h | 455 ++++++++++++++++++++++++ indra/llinventory/llsettingswater.cpp | 215 ++++++++++++ indra/llinventory/llsettingswater.h | 227 ++++++++++++ 9 files changed, 3054 insertions(+) create mode 100644 indra/llinventory/llsettingsbase.cpp create mode 100644 indra/llinventory/llsettingsbase.h create mode 100644 indra/llinventory/llsettingsdaycycle.cpp create mode 100644 indra/llinventory/llsettingsdaycycle.h create mode 100644 indra/llinventory/llsettingssky.cpp create mode 100644 indra/llinventory/llsettingssky.h create mode 100644 indra/llinventory/llsettingswater.cpp create mode 100644 indra/llinventory/llsettingswater.h (limited to 'indra/llinventory') diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index 68dd00d880..3eba746614 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -29,6 +29,10 @@ set(llinventory_SOURCE_FILES llparcel.cpp llpermissions.cpp llsaleinfo.cpp + llsettingsbase.cpp + llsettingsdaycycle.cpp + llsettingssky.cpp + llsettingswater.cpp lltransactionflags.cpp lluserrelations.cpp ) @@ -49,6 +53,10 @@ set(llinventory_HEADER_FILES llpermissions.h llpermissionsflags.h llsaleinfo.h + llsettingsbase.h + llsettingsdaycycle.h + llsettingssky.h + llsettingswater.h lltransactionflags.h lltransactiontypes.h lluserrelations.h diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp new file mode 100644 index 0000000000..e4291d8080 --- /dev/null +++ b/indra/llinventory/llsettingsbase.cpp @@ -0,0 +1,581 @@ +/** +* @file llsettingsbase.cpp +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llsettingsbase.h" + +#include "llmath.h" +#include + +#include "llsdserialize.h" + +//========================================================================= +namespace +{ + const F32 BREAK_POINT = 0.5; +} + +//========================================================================= +const std::string LLSettingsBase::SETTING_ID("id"); +const std::string LLSettingsBase::SETTING_NAME("name"); +const std::string LLSettingsBase::SETTING_HASH("hash"); +const std::string LLSettingsBase::SETTING_TYPE("type"); + +const F32Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); + +//========================================================================= +LLSettingsBase::LLSettingsBase(): + mSettings(LLSD::emptyMap()), + mDirty(true) +{ +} + +LLSettingsBase::LLSettingsBase(const LLSD setting) : + mSettings(setting), + mDirty(true) +{ +} + +//========================================================================= +void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F32 mix) +{ + mSettings = interpolateSDMap(mSettings, other.mSettings, mix); + setDirtyFlag(true); +} + +LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) const +{ + LLSD newSettings; + + for (LLSD::map_const_iterator it = settings.beginMap(); it != settings.endMap(); ++it) + { + std::string key_name = (*it).first; + LLSD value = (*it).second; + + LLSD::Type setting_type = value.type(); + switch (setting_type) + { + case LLSD::TypeMap: + newSettings[key_name] = combineSDMaps(value, LLSD()); + break; + case LLSD::TypeArray: + newSettings[key_name] = LLSD::emptyArray(); + for (LLSD::array_const_iterator ita = value.beginArray(); ita != value.endArray(); ++ita) + { + newSettings[key_name].append(*ita); + } + break; + //case LLSD::TypeInteger: + //case LLSD::TypeReal: + //case LLSD::TypeBoolean: + //case LLSD::TypeString: + //case LLSD::TypeUUID: + //case LLSD::TypeURI: + //case LLSD::TypeDate: + //case LLSD::TypeBinary: + default: + newSettings[key_name] = value; + break; + } + } + + if (!other.isUndefined()) + { + for (LLSD::map_const_iterator it = other.beginMap(); it != other.endMap(); ++it) + { + std::string key_name = (*it).first; + LLSD value = (*it).second; + + LLSD::Type setting_type = value.type(); + switch (setting_type) + { + case LLSD::TypeMap: + newSettings[key_name] = combineSDMaps(value, LLSD()); + break; + case LLSD::TypeArray: + newSettings[key_name] = LLSD::emptyArray(); + for (LLSD::array_const_iterator ita = value.beginArray(); ita != value.endArray(); ++ita) + { + newSettings[key_name].append(*ita); + } + break; + //case LLSD::TypeInteger: + //case LLSD::TypeReal: + //case LLSD::TypeBoolean: + //case LLSD::TypeString: + //case LLSD::TypeUUID: + //case LLSD::TypeURI: + //case LLSD::TypeDate: + //case LLSD::TypeBinary: + default: + newSettings[key_name] = value; + break; + } + } + } + + return newSettings; +} + +LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F32 mix) const +{ + LLSD newSettings; + + stringset_t skip = getSkipInterpolateKeys(); + stringset_t slerps = getSlerpKeys(); + + for (LLSD::map_const_iterator it = settings.beginMap(); it != settings.endMap(); ++it) + { + std::string key_name = (*it).first; + LLSD value = (*it).second; + + 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; + } + + switch (setting_type) + { + 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: + { + LLSD newvalue(LLSD::emptyArray()); + + if (slerps.find(key_name) != slerps.end()) + { + LLQuaternion q = slerp(mix, LLQuaternion(value), LLQuaternion(other_value)); + 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; + } + + break; + +// case LLSD::TypeBoolean: +// case LLSD::TypeString: +// case LLSD::TypeUUID: +// case LLSD::TypeURI: +// case LLSD::TypeBinary: +// case LLSD::TypeDate: + default: + /* TODO: If the UUID points to an image ID, blend the images. */ + // 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; + } + } + + // Now add anything that is in other but not in the settings + 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; + + if (!settings.has((*it).first)) + continue; + + newSettings[(*it).first] = (*it).second; + } + + return newSettings; +} + +LLSD LLSettingsBase::getSettings() const +{ + return mSettings; +} + +LLSD LLSettingsBase::cloneSettings() const +{ + return combineSDMaps(mSettings, LLSD()); +} + +size_t LLSettingsBase::getHash() const +{ // 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)); + + return boost::hash{}(hash_settings); +} + +#ifdef VALIDATION_DEBUG +namespace +{ + bool compare_llsd(LLSD valA, LLSD valB) + { + if (valA.type() != valB.type()) + return false; + + switch (valA.type()) + { + // case LLSD::TypeMap: + // newSettings[key_name] = combineSDMaps(value, LLSD()); + // break; + case LLSD::TypeArray: + if (valA.size() != valB.size()) + return false; + + for (S32 idx = 0; idx < valA.size(); ++idx) + { + if (!compare_llsd(valA[idx], valB[idx])) + return false; + } + return true; + + case LLSD::TypeInteger: + return valA.asInteger() == valB.asInteger(); + + case LLSD::TypeReal: + return is_approx_equal(valA.asReal(), valB.asReal()); + + case LLSD::TypeBoolean: + return valA.asBoolean() == valB.asBoolean(); + + case LLSD::TypeString: + return valA.asString() == valB.asString(); + + case LLSD::TypeUUID: + return valA.asUUID() == valB.asUUID(); + + case LLSD::TypeURI: + return valA.asString() == valB.asString(); + + case LLSD::TypeDate: + return valA.asDate() == valB.asDate(); + } + + return true; + } +} +#endif + +bool LLSettingsBase::validate() +{ + static Validator validateName(SETTING_NAME, false, LLSD::TypeString); + static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); + static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); + static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); + validation_list_t validations = getValidationList(); + stringset_t validated; + stringset_t strip; + + if (!mSettings.has(SETTING_TYPE)) + { + mSettings[SETTING_TYPE] = getSettingType(); + } + + // Fields common to all settings. + if (!validateName.verify(mSettings)) + { + LL_WARNS("SETTINGS") << "Unable to validate Name." << LL_ENDL; + mIsValid = false; + return false; + } + validated.insert(validateName.getName()); + + if (!validateId.verify(mSettings)) + { + LL_WARNS("SETTINGS") << "Unable to validate Id." << LL_ENDL; + mIsValid = false; + return false; + } + validated.insert(validateId.getName()); + + if (!validateHash.verify(mSettings)) + { + LL_WARNS("SETTINGS") << "Unable to validate Hash." << LL_ENDL; + mIsValid = false; + return false; + } + validated.insert(validateHash.getName()); + + if (!validateType.verify(mSettings)) + { + LL_WARNS("SETTINGS") << "Unable to validate Type." << LL_ENDL; + mIsValid = false; + return false; + } + validated.insert(validateType.getName()); + + // Fields for specific settings. + for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) + { +#ifdef VALIDATION_DEBUG + LLSD oldvalue; + if (mSettings.has((*itv).getName())) + { + oldvalue = llsd_clone(mSettings[(*itv).getName()]); + } +#endif + + if (!(*itv).verify(mSettings)) + { + LL_WARNS("SETTINGS") << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!" << LL_ENDL; + mIsValid = false; + return false; + } + validated.insert((*itv).getName()); + +#ifdef VALIDATION_DEBUG + if (!oldvalue.isUndefined()) + { + if (!compare_llsd(mSettings[(*itv).getName()], oldvalue)) + { + LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << mSettings[(*itv).getName()] << LL_ENDL; + } + } +#endif + } + + // strip extra entries + for (LLSD::map_iterator itm = mSettings.beginMap(); itm != mSettings.endMap(); ++itm) + { + if (validated.find((*itm).first) == validated.end()) + { + LL_WARNS("SETTINGS") << "Stripping setting '" << (*itm).first << "'" << LL_ENDL; + strip.insert((*itm).first); + } + } + + for (stringset_t::iterator its = strip.begin(); its != strip.end(); ++its) + { + mSettings.erase(*its); + } + + return true; +} + +//========================================================================= +bool LLSettingsBase::Validator::verify(LLSD &data) +{ + if (!data.has(mName) || (data.has(mName) && data[mName].isUndefined())) + { + if (mRequired) + LL_WARNS("SETTINGS") << "Missing required setting '" << mName << "'" << LL_ENDL; + return !mRequired; + } + + if (data[mName].type() != mType) + { + LL_WARNS("SETTINGS") << "Setting '" << mName << "' is incorrect type." << LL_ENDL; + return false; + } + + if (!mVerify.empty() && !mVerify(data[mName])) + { + LL_WARNS("SETTINGS") << "Setting '" << mName << "' fails validation." << LL_ENDL; + return false; + } + + return true; +} + +bool LLSettingsBase::Validator::verifyColor(LLSD &value) +{ + return (value.size() == 3 || value.size() == 4); +} + +bool LLSettingsBase::Validator::verifyVector(LLSD &value, S32 length) +{ + return (value.size() == length); +} + +bool LLSettingsBase::Validator::verifyVectorNormalized(LLSD &value, S32 length) +{ + if (value.size() != length) + return false; + + LLSD newvector; + + switch (length) + { + case 2: + { + LLVector2 vect(value); + + if (is_approx_equal(vect.normalize(), 1.0f)) + return true; + newvector = vect.getValue(); + break; + } + case 3: + { + LLVector3 vect(value); + + if (is_approx_equal(vect.normalize(), 1.0f)) + return true; + newvector = vect.getValue(); + break; + } + case 4: + { + LLVector4 vect(value); + + if (is_approx_equal(vect.normalize(), 1.0f)) + return true; + newvector = vect.getValue(); + break; + } + default: + return false; + } + + return true; +} + +bool LLSettingsBase::Validator::verifyVectorMinMax(LLSD &value, LLSD minvals, LLSD maxvals) +{ + for (S32 index = 0; index < value.size(); ++index) + { + if (minvals[index].asString() != "*") + { + if (minvals[index].asReal() > value[index].asReal()) + { + value[index] = minvals[index].asReal(); + } + } + if (maxvals[index].asString() != "*") + { + if (maxvals[index].asReal() < value[index].asReal()) + { + value[index] = maxvals[index].asReal(); + } + } + } + + return true; +} + +bool LLSettingsBase::Validator::verifyQuaternion(LLSD &value) +{ + return (value.size() == 4); +} + +bool LLSettingsBase::Validator::verifyQuaternionNormal(LLSD &value) +{ + if (value.size() != 4) + return false; + + LLQuaternion quat(value); + + if (is_approx_equal(quat.normalize(), 1.0f)) + return true; + + LLSD newquat = quat.getValue(); + for (S32 index = 0; index < 4; ++index) + { + value[index] = newquat[index]; + } + return true; +} + +bool LLSettingsBase::Validator::verifyFloatRange(LLSD &value, LLSD range) +{ + F32 real = value.asReal(); + + F32 clampedval = llclamp(LLSD::Real(real), range[0].asReal(), range[1].asReal()); + + if (is_approx_equal(clampedval, real)) + return true; + + value = LLSD::Real(clampedval); + return true; +} + +bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) +{ + S32 ival = value.asInteger(); + + S32 clampedval = llclamp(LLSD::Integer(ival), range[0].asInteger(), range[1].asInteger()); + + if (clampedval == ival) + return true; + + value = LLSD::Integer(clampedval); + return true; +} + +//========================================================================= + +void LLSettingsBlender::update(F32Seconds timedelta) +{ + mTimeSpent += timedelta; + + if (mTimeSpent >= mSeconds) + { + LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon + mOnFinished(shared_from_this()); + mOnFinished.disconnect_all_slots(); // prevent from firing more than once. + return; + } + + F32 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); + + mTarget->replaceSettings(mInitial->getSettings()); + mTarget->blend(mFinal, blendf); +} + diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h new file mode 100644 index 0000000000..2b59a103ad --- /dev/null +++ b/indra/llinventory/llsettingsbase.h @@ -0,0 +1,306 @@ +/** +* @file llsettingsbase.h +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef LL_SETTINGS_BASE_H +#define LL_SETTINGS_BASE_H + +#include +#include +#include +#include +#include + +#include "llsd.h" +#include "llsdutil.h" +#include "v2math.h" +#include "v3math.h" +#include "v4math.h" +#include "llquaternion.h" +#include "v4color.h" +#include "v3color.h" + +class LLSettingsBase : + public boost::enable_shared_from_this, + private boost::noncopyable +{ + friend class LLEnvironment; + friend class LLSettingsDay; + +public: + static const std::string SETTING_ID; + static const std::string SETTING_NAME; + static const std::string SETTING_HASH; + static const std::string SETTING_TYPE; + + typedef std::map parammapping_t; + + typedef boost::shared_ptr ptr_t; + + virtual ~LLSettingsBase() { }; + + //--------------------------------------------------------------------- + virtual std::string getSettingType() const = 0; + + //--------------------------------------------------------------------- + // Settings status + inline bool hasSetting(const std::string ¶m) const { return mSettings.has(param); } + inline bool isDirty() const { return mDirty; } + inline void setDirtyFlag(bool dirty) { mDirty = dirty; } + + size_t getHash() const; // Hash will not include Name, ID or a previously stored Hash + + inline LLUUID getId() const + { + return getValue(SETTING_ID).asUUID(); + } + + inline std::string getName() const + { + return getValue(SETTING_NAME).asString(); + } + + inline void setName(std::string val) + { + setValue(SETTING_NAME, val); + } + + inline void replaceSettings(LLSD settings) + { + mSettings = settings; + setDirtyFlag(true); + } + + virtual LLSD getSettings() const; + + //--------------------------------------------------------------------- + // + inline void setValue(const std::string &name, const LLSD &value) + { + mSettings[name] = value; + mDirty = true; + } + + inline LLSD getValue(const std::string &name, const LLSD &deflt = LLSD()) const + { + if (!mSettings.has(name)) + return deflt; + return mSettings[name]; + } + + inline void setValue(const std::string &name, const LLVector2 &value) + { + setValue(name, value.getValue()); + } + + inline void setValue(const std::string &name, const LLVector3 &value) + { + setValue(name, value.getValue()); + } + + inline void setValue(const std::string &name, const LLVector4 &value) + { + setValue(name, value.getValue()); + } + + inline void setValue(const std::string &name, const LLQuaternion &value) + { + setValue(name, value.getValue()); + } + + inline void setValue(const std::string &name, const LLColor3 &value) + { + setValue(name, value.getValue()); + } + + inline void setValue(const std::string &name, const LLColor4 &value) + { + setValue(name, value.getValue()); + } + + // Note this method is marked const but may modify the settings object. + // (note the internal const cast). This is so that it may be called without + // special consideration from getters. + inline void update() const + { + if (!mDirty) + return; + (const_cast(this))->updateSettings(); + } + + virtual void blend(const ptr_t &end, F32 blendf) = 0; + + virtual bool validate(); + +protected: + class Validator + { + public: + typedef boost::function verify_pr; + + Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr()) : + mName(name), + mRequired(required), + mType(type), + mVerify(verify) + { } + + std::string getName() const { return mName; } + bool isRequired() const { return mRequired; } + LLSD::Type getType() const { return mType; } + + bool verify(LLSD &data); + + // Some basic verifications + static bool verifyColor(LLSD &value); + static bool verifyVector(LLSD &value, S32 length); + static bool verifyVectorMinMax(LLSD &value, LLSD minvals, LLSD maxvals); + static bool verifyVectorNormalized(LLSD &value, S32 length); + static bool verifyQuaternion(LLSD &value); + static bool verifyQuaternionNormal(LLSD &value); + static bool verifyFloatRange(LLSD &value, LLSD range); + static bool verifyIntegerRange(LLSD &value, LLSD range); + + private: + std::string mName; + bool mRequired; + LLSD::Type mType; + verify_pr mVerify; + }; + typedef std::vector validation_list_t; + + LLSettingsBase(); + LLSettingsBase(const LLSD setting); + + typedef std::set stringset_t; + + // combining settings objects. Customize for specific setting types + virtual void lerpSettings(const LLSettingsBase &other, F32 mix); + LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, F32 mix) const; + + /// when lerping between settings, some may require special handling. + /// Get a list of these key to be skipped by the default settings lerp. + /// (handling should be performed in the override of lerpSettings. + virtual stringset_t getSkipInterpolateKeys() const { return stringset_t(); } + + // A list of settings that represent quaternions and should be slerped + // rather than lerped. + virtual stringset_t getSlerpKeys() const { return stringset_t(); } + + // Calculate any custom settings that may need to be cached. + virtual void updateSettings() { mDirty = false; }; + + virtual validation_list_t getValidationList() const = 0; + + // Apply any settings that need special handling. + virtual void applySpecial(void *) { }; + + virtual parammapping_t getParameterMap() const { return parammapping_t(); } + + LLSD mSettings; + bool mIsValid; + + LLSD cloneSettings() const; + +private: + bool mDirty; + + LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; + +}; + + +class LLSettingsBlender : public boost::enable_shared_from_this +{ +public: + typedef boost::shared_ptr ptr_t; + typedef boost::signals2::signal finish_signal_t; + typedef boost::signals2::connection connection_t; + + static const F32Seconds DEFAULT_THRESHOLD; + + LLSettingsBlender(const LLSettingsBase::ptr_t &target, + const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F32Seconds seconds) : + mTarget(target), + mInitial(initsetting), + mFinal(endsetting), + mSeconds(seconds), + mOnFinished(), + mBlendThreshold(DEFAULT_THRESHOLD), + mLastUpdate(0.0f), + mTimeSpent(0.0f) + { + mTarget->replaceSettings(mInitial->getSettings()); + mTimeStart = F32Seconds(LLDate::now().secondsSinceEpoch()); + mLastUpdate = mTimeStart; + } + + ~LLSettingsBlender() {} + + connection_t setOnFinished(const finish_signal_t::slot_type &onfinished) + { + return mOnFinished.connect(onfinished); + } + + void setUpdateThreshold(F32Seconds threshold) + { + mBlendThreshold = threshold; + } + + F32Seconds getUpdateThreshold() const + { + return mBlendThreshold; + } + + LLSettingsBase::ptr_t getTarget() const + { + return mTarget; + } + + LLSettingsBase::ptr_t getInitial() const + { + return mInitial; + } + + LLSettingsBase::ptr_t getFinal() const + { + return mFinal; + } + + void update(F32Seconds time); +private: + LLSettingsBase::ptr_t mTarget; + LLSettingsBase::ptr_t mInitial; + LLSettingsBase::ptr_t mFinal; + F32Seconds mSeconds; + finish_signal_t mOnFinished; + F32Seconds mBlendThreshold; + F32Seconds mLastUpdate; + F32Seconds mTimeSpent; + F32Seconds mTimeStart; +}; + +#endif diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp new file mode 100644 index 0000000000..687210e127 --- /dev/null +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -0,0 +1,545 @@ +/** +* @file llsettingsdaycycle.cpp +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llsettingsdaycycle.h" +#include +#include +#include "lltrace.h" +#include "llfasttimer.h" +#include "v3colorutil.h" + +#include "llsettingssky.h" +#include "llsettingswater.h" + +#include "llframetimer.h" +//========================================================================= +namespace +{ + LLTrace::BlockTimerStatHandle FTM_BLEND_WATERVALUES("Blending Water Environment"); + LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERVALUES("Update Water Environment"); + + inline F32 get_wrapping_distance(F32 begin, F32 end) + { + if (begin < end) + { + return end - begin; + } + else if (begin > end) + { + return 1.0 - (begin - end); + } + + return 0; + } + + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, F32 key) + { + if (collection.empty()) + return collection.end(); + + LLSettingsDay::CycleTrack_t::iterator it = collection.upper_bound(key); + + if (it == collection.end()) + { // wrap around + it = collection.begin(); + } + + return it; + } + + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atbefore(LLSettingsDay::CycleTrack_t &collection, F32 key) + { + if (collection.empty()) + return collection.end(); + + LLSettingsDay::CycleTrack_t::iterator it = collection.lower_bound(key); + + if (it == collection.end()) + { // all keyframes are lower, take the last one. + --it; // we know the range is not empty + } + else if ((*it).first > key) + { // the keyframe we are interested in is smaller than the found. + if (it == collection.begin()) + it = collection.end(); + --it; + } + + return it; + } + + +} + +//========================================================================= +const std::string LLSettingsDay::SETTING_DAYLENGTH("day_length"); +const std::string LLSettingsDay::SETTING_KEYID("key_id"); +const std::string LLSettingsDay::SETTING_KEYNAME("key_name"); +const std::string LLSettingsDay::SETTING_KEYKFRAME("key_keyframe"); +const std::string LLSettingsDay::SETTING_KEYHASH("key_hash"); +const std::string LLSettingsDay::SETTING_TRACKS("tracks"); +const std::string LLSettingsDay::SETTING_FRAMES("frames"); + +const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 300); // 5 mins + +//const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 14400); // 4 hours +const S64 LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days + +const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 +const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water +const S32 LLSettingsDay::FRAME_MAX(56); + +//========================================================================= +LLSettingsDay::LLSettingsDay(const LLSD &data) : + LLSettingsBase(data), + mInitialized(false) +{ + mDayTracks.resize(TRACK_MAX); +} + +LLSettingsDay::LLSettingsDay() : + LLSettingsBase(), + mInitialized(false) +{ + mDayTracks.resize(TRACK_MAX); +} + +//========================================================================= +LLSD LLSettingsDay::getSettings() const +{ + LLSD settings(LLSD::emptyMap()); + + if (mSettings.has(SETTING_NAME)) + settings[SETTING_NAME] = mSettings[SETTING_NAME]; + + if (mSettings.has(SETTING_ID)) + settings[SETTING_ID] = mSettings[SETTING_ID]; + + std::map in_use; + + LLSD tracks(LLSD::emptyArray()); + + for (CycleList_t::const_iterator itTrack = mDayTracks.begin(); itTrack != mDayTracks.end(); ++itTrack) + { + LLSD trackout(LLSD::emptyArray()); + + for (CycleTrack_t::const_iterator itFrame = (*itTrack).begin(); itFrame != (*itTrack).end(); ++itFrame) + { + F32 frame = (*itFrame).first; + LLSettingsBase::ptr_t data = (*itFrame).second; + size_t datahash = data->getHash(); + + std::stringstream keyname; + keyname << datahash; + + trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame))(SETTING_KEYNAME, keyname.str()))); + in_use[keyname.str()] = data; + } + tracks.append(trackout); + } + settings[SETTING_TRACKS] = tracks; + + LLSD frames(LLSD::emptyMap()); + for (std::map::iterator itFrame = in_use.begin(); itFrame != in_use.end(); ++itFrame) + { + LLSD framesettings = llsd_clone((*itFrame).second->getSettings(), + LLSDMap("*", true)(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)); + + frames[(*itFrame).first] = framesettings; + } + settings[SETTING_FRAMES] = frames; + + return settings; +} + +void LLSettingsDay::initialize() +{ + LLSD tracks = mSettings[SETTING_TRACKS]; + LLSD frames = mSettings[SETTING_FRAMES]; + + std::map used; + + for (LLSD::map_const_iterator itFrame = frames.beginMap(); itFrame != frames.endMap(); ++itFrame) + { + std::string name = (*itFrame).first; + LLSD data = (*itFrame).second; + + if (data[SETTING_TYPE].asString() == "sky") + { + used[name] = buildSky(data); + } + else if (data[SETTING_TYPE].asString() == "water") + { + used[name] = buildWater(data); + } + else + { + LL_WARNS("DAYCYCLE") << "Unknown child setting type '" << data[SETTING_TYPE].asString() << "' named '" << name << "'" << LL_ENDL; + } + } + + for (S32 i = 0; (i < tracks.size()) && (i < TRACK_MAX); ++i) + { + mDayTracks[i].clear(); + LLSD curtrack = tracks[i]; + for (LLSD::array_const_iterator it = curtrack.beginArray(); it != curtrack.endArray(); ++it) + { + F32 keyframe = (*it)[SETTING_KEYKFRAME].asReal(); + keyframe = llclamp(keyframe, 0.0f, 1.0f); + LLSettingsBase::ptr_t setting; + + if ((*it).has(SETTING_KEYNAME)) + { + if (i == TRACK_WATER) + { + setting = used[(*it)[SETTING_KEYNAME]]; + if (!setting) + setting = getNamedWater((*it)[SETTING_KEYNAME]); + if (setting && setting->getSettingType() != "water") + { + LL_WARNS("DAYCYCLE") << "Water track referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; + setting.reset(); + } + } + else + { + setting = used[(*it)[SETTING_KEYNAME]]; + if (!setting) + setting = getNamedSky((*it)[SETTING_KEYNAME]); + if (setting && setting->getSettingType() != "sky") + { + LL_WARNS("DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; + setting.reset(); + } + } + } + + if (setting) + mDayTracks[i][keyframe] = setting; + } + } + + // these are no longer needed and just take up space now. + mSettings.erase(SETTING_TRACKS); + mSettings.erase(SETTING_FRAMES); + + mInitialized = true; +} + + +//========================================================================= +LLSD LLSettingsDay::defaults() +{ + LLSD dfltsetting; + + dfltsetting[SETTING_NAME] = "_default_"; + dfltsetting[SETTING_DAYLENGTH] = static_cast(MINIMUM_DAYLENGTH); + dfltsetting[SETTING_TRACKS] = LLSDArray( + LLSDArray(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_")) + (LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_"))); + dfltsetting[SETTING_FRAMES] = LLSD::emptyMap(); + + return dfltsetting; +} + +void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F32 mix) +{ + LL_ERRS("DAYCYCLE") << "Day cycles are not blendable!" << LL_ENDL; +} + +namespace +{ + bool validateDayCycleTrack(LLSD &value) + { + // Trim extra tracks. + while (value.size() > LLSettingsDay::TRACK_MAX) + { + value.erase(value.size() - 1); + } + + for (LLSD::array_iterator track = value.beginArray(); track != value.endArray(); ++track) + { + S32 index = 0; + while (index < (*track).size()) + { + if (index >= LLSettingsDay::FRAME_MAX) + { + (*track).erase(index); + continue; + } + + if (!(*track)[index].has(LLSettingsDay::SETTING_KEYKFRAME) || + !(*track)[index][LLSettingsDay::SETTING_KEYKFRAME].isReal()) + { + (*track).erase(index); + continue; + } + + if (!(*track)[index].has(LLSettingsDay::SETTING_KEYNAME) && + !(*track)[index].has(LLSettingsDay::SETTING_KEYID)) + { + (*track).erase(index); + continue; + } + + F32 frame = (*track)[index][LLSettingsDay::SETTING_KEYKFRAME].asReal(); + if ((frame < 0.0) || (frame > 1.0)) + { + frame = llclamp(frame, 0.0f, 1.0f); + (*track)[index][LLSettingsDay::SETTING_KEYKFRAME] = frame; + } + ++index; + } + + } + return true; + } +} + +LLSettingsDay::validation_list_t LLSettingsDay::getValidationList() const +{ + static validation_list_t validation; + + if (validation.empty()) + { + validation.push_back(Validator(SETTING_TRACKS, false, LLSD::TypeArray, + &validateDayCycleTrack)); + validation.push_back(Validator(SETTING_FRAMES, false, LLSD::TypeMap)); + validation.push_back(Validator(SETTING_DAYLENGTH, false, LLSD::TypeInteger, + boost::bind(&Validator::verifyIntegerRange, _1, + LLSD(LLSDArray(LLSD::Integer(MINIMUM_DAYLENGTH))(LLSD::Integer(MAXIMUM_DAYLENGTH)))))); + } + + return validation; +} + +//========================================================================= +F32 LLSettingsDay::secondsToKeyframe(S64Seconds seconds) +{ + S64Seconds daylength = getDayLength(); + + return llclamp(static_cast(seconds.value() % daylength.value()) / static_cast(daylength.value()), 0.0f, 1.0f); +} + +F64Seconds LLSettingsDay::keyframeToSeconds(F32 keyframe) +{ + S64Seconds daylength = getDayLength(); + + return F64Seconds(static_cast(keyframe * static_cast(daylength.value()))); +} + +//========================================================================= +void LLSettingsDay::startDayCycle() +{ + F64Seconds now(LLDate::now().secondsSinceEpoch()); + + if (!mInitialized) + { + LL_WARNS("DAYCYCLE") << "Attempt to start day cycle on uninitialized object." << LL_ENDL; + return; + } + + // water + if (mDayTracks[0].empty()) + { + mBlendedWater.reset(); + mWaterBlender.reset(); + } + else if (mDayTracks[0].size() == 1) + { + mBlendedWater = boost::static_pointer_cast((*(mDayTracks[0].begin())).second); + mWaterBlender.reset(); + } + else + { + TrackBound_t bounds = getBoundingEntries(mDayTracks[0], now); + + F64Seconds timespan = F64Seconds( getDayLength() * get_wrapping_distance((*bounds.first).first, (*bounds.second).first)); + + mBlendedWater = getDefaultWater(); + mWaterBlender = boost::make_shared(mBlendedWater, + (*bounds.first).second, (*bounds.second).second, timespan); + mWaterBlender->setOnFinished(boost::bind(&LLSettingsDay::onWaterTransitionDone, this, _1)); + } + + // sky + if (mDayTracks[1].empty()) + { + mBlendedSky.reset(); + mSkyBlender.reset(); + } + else if (mDayTracks[1].size() == 1) + { + mBlendedSky = boost::static_pointer_cast( (*(mDayTracks[1].begin())).second); + mSkyBlender.reset(); + } + else + { + TrackBound_t bounds = getBoundingEntries(mDayTracks[1], now); + F64Seconds timespan = F64Seconds(getDayLength() * get_wrapping_distance((*bounds.first).first, (*bounds.second).first)); + + mBlendedSky = getDefaultSky(); + mSkyBlender = boost::make_shared(mBlendedSky, + (*bounds.first).second, (*bounds.second).second, timespan); + mSkyBlender->setOnFinished(boost::bind(&LLSettingsDay::onSkyTransitionDone, this, 1, _1)); + } +} + + +void LLSettingsDay::updateSettings() +{ + static LLFrameTimer timer; + + + F64Seconds delta(timer.getElapsedTimeAndResetF32()); + + if (mSkyBlender) + mSkyBlender->update(delta); + if (mWaterBlender) + mWaterBlender->update(delta); +} + +//========================================================================= +void LLSettingsDay::setDayLength(S64Seconds seconds) +{ + S32 val = llclamp(seconds.value(), MINIMUM_DAYLENGTH, MAXIMUM_DAYLENGTH); + + setValue(SETTING_DAYLENGTH, val); +} + +LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) +{ + if ((trackno < 1) || (trackno >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt get track (#" << trackno << ") out of range!" << LL_ENDL; + return KeyframeList_t(); + } + + KeyframeList_t keyframes; + CycleTrack_t &track = mDayTracks[trackno]; + + keyframes.reserve(track.size()); + + for (CycleTrack_t::iterator it = track.begin(); it != track.end(); ++it) + { + keyframes.push_back((*it).first); + } + + return keyframes; +} + +LLSettingsDay::TimeList_t LLSettingsDay::getTrackTimes(S32 trackno) +{ + KeyframeList_t keyframes = getTrackKeyframes(trackno); + + if (keyframes.empty()) + return TimeList_t(); + + TimeList_t times; + + times.reserve(keyframes.size()); + for (KeyframeList_t::iterator it = keyframes.begin(); it != keyframes.end(); ++it) + { + times.push_back(keyframeToSeconds(*it)); + } + + return times; +} + +void LLSettingsDay::setWaterAtTime(const LLSettingsWaterPtr_t &water, S64Seconds seconds) +{ + F32 keyframe = secondsToKeyframe(seconds); + setWaterAtKeyframe(water, keyframe); +} + +void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe) +{ + mDayTracks[TRACK_WATER][llclamp(keyframe, 0.0f, 1.0f)] = water; + setDirtyFlag(true); +} + + +void LLSettingsDay::setSkyAtTime(const LLSettingsSkyPtr_t &sky, S64Seconds seconds, S32 track) +{ + F32 keyframe = secondsToKeyframe(seconds); + setSkyAtKeyframe(sky, keyframe, track); +} + +void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track) +{ + if ((track < 1) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL; + return; + } + + mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = sky; + setDirtyFlag(true); +} + +LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F32 keyframe) +{ + return TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); +} + +LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F64Seconds time) +{ + F32 frame = secondsToKeyframe(time); + + return getBoundingEntries(track, frame); +} + +//========================================================================= +void LLSettingsDay::onSkyTransitionDone(S32 track, const LLSettingsBlender::ptr_t &blender) +{ + F64Seconds now(LLDate::now().secondsSinceEpoch()); + TrackBound_t bounds = getBoundingEntries(mDayTracks[track], now); + + F32 distance = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); + F64Seconds timespan = F64Seconds(distance * getDayLength()); + + LL_DEBUGS("DAYCYCLE") << "New sky blender. now=" << now << + " start=" << (*bounds.first).first << " end=" << (*bounds.second).first << + " span=" << timespan << LL_ENDL; + + mSkyBlender = boost::make_shared(mBlendedSky, + (*bounds.first).second, (*bounds.second).second, timespan); + mSkyBlender->setOnFinished(boost::bind(&LLSettingsDay::onSkyTransitionDone, this, track, _1)); +} + +void LLSettingsDay::onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender) +{ + F64Seconds now(LLDate::now().secondsSinceEpoch()); + TrackBound_t bounds = getBoundingEntries(mDayTracks[0], now); + + F32 distance = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); + F64Seconds timespan = F64Seconds(distance * getDayLength()); + + mWaterBlender = boost::make_shared(mBlendedWater, + (*bounds.first).second, (*bounds.second).second, timespan); + mWaterBlender->setOnFinished(boost::bind(&LLSettingsDay::onWaterTransitionDone, this, _1)); +} diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h new file mode 100644 index 0000000000..3b24ce9f97 --- /dev/null +++ b/indra/llinventory/llsettingsdaycycle.h @@ -0,0 +1,156 @@ +/** +* @file llsettingsdaycycle.h +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef LL_SETTINGS_DAYCYCLE_H +#define LL_SETTINGS_DAYCYCLE_H + +#include "llsettingsbase.h" + +class LLSettingsWater; +class LLSettingsSky; + +typedef boost::shared_ptr LLSettingsWaterPtr_t; +typedef boost::shared_ptr LLSettingsSkyPtr_t; + +class LLSettingsDay : public LLSettingsBase +{ +public: + static const std::string SETTING_DAYLENGTH; + static const std::string SETTING_KEYID; + static const std::string SETTING_KEYNAME; + static const std::string SETTING_KEYKFRAME; + static const std::string SETTING_KEYHASH; + static const std::string SETTING_TRACKS; + static const std::string SETTING_FRAMES; + + static const S64 MINIMUM_DAYLENGTH; + static const S64 MAXIMUM_DAYLENGTH; + + static const S32 TRACK_WATER; + static const S32 TRACK_MAX; + static const S32 FRAME_MAX; + + typedef std::map CycleTrack_t; + typedef std::vector CycleList_t; + typedef boost::shared_ptr ptr_t; + typedef std::vector TimeList_t; + typedef std::vector KeyframeList_t; + typedef std::pair TrackBound_t; + + //--------------------------------------------------------------------- + LLSettingsDay(const LLSD &data); + virtual ~LLSettingsDay() { }; + + void initialize(); + + virtual ptr_t buildClone() = 0; + virtual LLSD getSettings() const; + + //--------------------------------------------------------------------- + virtual std::string getSettingType() const { return std::string("daycycle"); } + + // Settings status + virtual void blend(const LLSettingsBase::ptr_t &other, F32 mix); + + static LLSD defaults(); + + //--------------------------------------------------------------------- + S64Seconds getDayLength() const + { + return S64Seconds(mSettings[SETTING_DAYLENGTH].asInteger()); + } + + void setDayLength(S64Seconds seconds); + + KeyframeList_t getTrackKeyframes(S32 track); + TimeList_t getTrackTimes(S32 track); + + void setWaterAtTime(const LLSettingsWaterPtr_t &water, S64Seconds seconds); + void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe); + + void setSkyAtTime(const LLSettingsSkyPtr_t &sky, S64Seconds seconds, S32 track); + void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track); + //--------------------------------------------------------------------- + void startDayCycle(); + + LLSettingsSkyPtr_t getCurrentSky() const + { + return mBlendedSky; + } + + LLSettingsWaterPtr_t getCurrentWater() const + { + return mBlendedWater; + } + + virtual LLSettingsSkyPtr_t getDefaultSky() const = 0; + virtual LLSettingsWaterPtr_t getDefaultWater() const = 0; + + virtual LLSettingsSkyPtr_t buildSky(LLSD) const = 0; + virtual LLSettingsWaterPtr_t buildWater(LLSD) const = 0; + + virtual LLSettingsSkyPtr_t getNamedSky(const std::string &) const = 0; + virtual LLSettingsWaterPtr_t getNamedWater(const std::string &) const = 0; + + void setInitialized(bool value = true) { mInitialized = value; } +protected: + LLSettingsDay(); + + virtual void updateSettings(); + + virtual validation_list_t getValidationList() const; + + bool mInitialized; + +private: + LLSettingsBlender::ptr_t mSkyBlender; // convert to [] for altitudes + LLSettingsBlender::ptr_t mWaterBlender; + + LLSettingsSkyPtr_t mBlendedSky; + LLSettingsWaterPtr_t mBlendedWater; + + CycleList_t mDayTracks; + + F64Seconds mLastUpdateTime; + + F32 secondsToKeyframe(S64Seconds seconds); + F64Seconds keyframeToSeconds(F32 keyframe); + + void parseFromLLSD(LLSD &data); + + static CycleTrack_t::iterator getEntryAtOrBefore(CycleTrack_t &track, F32 keyframe); + static CycleTrack_t::iterator getEntryAtOrAfter(CycleTrack_t &track, F32 keyframe); + + TrackBound_t getBoundingEntries(CycleTrack_t &track, F32 keyframe); + TrackBound_t getBoundingEntries(CycleTrack_t &track, F64Seconds time); + + void onSkyTransitionDone(S32 track, const LLSettingsBlender::ptr_t &blender); + void onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender); + +}; + +#endif diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp new file mode 100644 index 0000000000..ecc89165e8 --- /dev/null +++ b/indra/llinventory/llsettingssky.cpp @@ -0,0 +1,561 @@ +/** +* @file llsettingssky.cpp +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llsettingssky.h" +#include "indra_constants.h" +#include +#include "lltrace.h" +#include "llfasttimer.h" +#include "v3colorutil.h" + +//========================================================================= +namespace +{ + const LLVector3 DUE_EAST(0.0f, 0.0f, 1.0); + const LLVector3 VECT_ZENITH(0.f, 1.f, 0.f); + const LLVector3 VECT_NORTHSOUTH(1.f, 0.f, 0.f); + + LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); + LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); + + LLQuaternion body_position_from_angles(F32 azimuth, F32 altitude); + void angles_from_rotation(LLQuaternion quat, F32 &azimuth, F32 &altitude); +} + +const F32 LLSettingsSky::DOME_OFFSET(0.96f); +const F32 LLSettingsSky::DOME_RADIUS(15000.f); + +const F32 LLSettingsSky::NIGHTTIME_ELEVATION(-8.0f); // degrees +const F32 LLSettingsSky::NIGHTTIME_ELEVATION_COS((F32)sin(NIGHTTIME_ELEVATION*DEG_TO_RAD)); + +//========================================================================= +const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); +const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id"); +const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); +const std::string LLSettingsSky::SETTING_BLUE_HORIZON("blue_horizon"); +const std::string LLSettingsSky::SETTING_CLOUD_COLOR("cloud_color"); +const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY1("cloud_pos_density1"); +const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY2("cloud_pos_density2"); +const std::string LLSettingsSky::SETTING_CLOUD_SCALE("cloud_scale"); +const std::string LLSettingsSky::SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate"); +const std::string LLSettingsSky::SETTING_CLOUD_SHADOW("cloud_shadow"); +const std::string LLSettingsSky::SETTING_CLOUD_TEXTUREID("cloud_id"); +const std::string LLSettingsSky::SETTING_DENSITY_MULTIPLIER("density_multiplier"); +const std::string LLSettingsSky::SETTING_DISTANCE_MULTIPLIER("distance_multiplier"); +const std::string LLSettingsSky::SETTING_DOME_OFFSET("dome_offset"); +const std::string LLSettingsSky::SETTING_DOME_RADIUS("dome_radius"); +const std::string LLSettingsSky::SETTING_GAMMA("gamma"); +const std::string LLSettingsSky::SETTING_GLOW("glow"); +const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density"); +const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon"); +const std::string LLSettingsSky::SETTING_LIGHT_NORMAL("lightnorm"); +const std::string LLSettingsSky::SETTING_MAX_Y("max_y"); +const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation"); +const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id"); +const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness"); +const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color"); +const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation"); +const std::string LLSettingsSky::SETTING_SUN_TEXUTUREID("sun_id"); + +const std::string LLSettingsSky::SETTING_LEGACY_EAST_ANGLE("east_angle"); +const std::string LLSettingsSky::SETTING_LEGACY_ENABLE_CLOUD_SCROLL("enable_cloud_scroll"); +const std::string LLSettingsSky::SETTING_LEGACY_SUN_ANGLE("sun_angle"); + +//========================================================================= +LLSettingsSky::LLSettingsSky(const LLSD &data) : + LLSettingsBase(data) +{ +} + +LLSettingsSky::LLSettingsSky(): + LLSettingsBase() +{ +} + +void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F32 blendf) +{ + LLSettingsSky::ptr_t other = boost::static_pointer_cast(end); + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + + replaceSettings(blenddata); +} + + +void LLSettingsSky::setMoonRotation(F32 azimuth, F32 altitude) +{ + setValue(SETTING_MOON_ROTATION, ::body_position_from_angles(azimuth, altitude)); +} + +LLSettingsSky::azimalt_t LLSettingsSky::getMoonRotationAzAl() const +{ + azimalt_t res; + ::angles_from_rotation(getMoonRotation(), res.first, res.second); + + return res; +} + +void LLSettingsSky::setSunRotation(F32 azimuth, F32 altitude) +{ + setValue(SETTING_SUN_ROTATION, ::body_position_from_angles(azimuth, altitude)); +} + +LLSettingsSky::azimalt_t LLSettingsSky::getSunRotationAzAl() const +{ + azimalt_t res; + ::angles_from_rotation(getSunRotation(), res.first, res.second); + + return res; +} + +LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const +{ + static stringset_t slepSet; + + if (slepSet.empty()) + { + slepSet.insert(SETTING_SUN_ROTATION); + slepSet.insert(SETTING_MOON_ROTATION); + } + + return slepSet; +} + +LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const +{ + static validation_list_t validation; + + if (validation.empty()) + { // Note the use of LLSD(LLSDArray()()()...) This is due to an issue with the + // copy constructor for LLSDArray. Directly binding the LLSDArray as + // a parameter without first wrapping it in a pure LLSD object will result + // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] + + validation.push_back(Validator(SETTING_AMBIENT, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); + validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_BLUE_DENSITY, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + validation.push_back(Validator(SETTING_BLUE_HORIZON, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(1.0f)(1.0f)(1.0f)("*"))))); + validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY1, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(1.68841f)(1.0f)(1.0f)("*"))))); + validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY2, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(1.68841f)(1.0f)(1.0f)("*"))))); + validation.push_back(Validator(SETTING_CLOUD_SCALE, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.001f)(0.999f))))); + validation.push_back(Validator(SETTING_CLOUD_SCROLL_RATE, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)), + LLSD(LLSDArray(20.0f)(20.0f))))); + validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + validation.push_back(Validator(SETTING_DOME_OFFSET, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_DOME_RADIUS, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(2000.0f))))); + validation.push_back(Validator(SETTING_GAMMA, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(10.0f))))); + validation.push_back(Validator(SETTING_GLOW, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.2f)("*")(-2.5f)("*")), + LLSD(LLSDArray(20.0f)("*")(0.0f)("*"))))); + validation.push_back(Validator(SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_LIGHT_NORMAL, false, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorNormalized, _1, 3))); + validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4000.0f))))); + validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); + validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + validation.push_back(Validator(SETTING_SUNLIGHT_COLOR, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); + validation.push_back(Validator(SETTING_SUN_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); + validation.push_back(Validator(SETTING_SUN_TEXUTUREID, false, LLSD::TypeUUID)); + } + + return validation; +} + + +LLSD LLSettingsSky::defaults() +{ + LLSD dfltsetting; + + + LLQuaternion sunquat; + sunquat.setEulerAngles(1.39626, 0.0, 0.0); // 80deg Azumith/0deg East + LLQuaternion moonquat = ~sunquat; + + // Magic constants copied form dfltsetting.xml + dfltsetting[SETTING_AMBIENT] = LLColor4::white.getValue(); + dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue(); + dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); + dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); + dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); + dfltsetting[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(0.0001); + dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); + dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); + dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); + dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); + dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); + dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); + dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); + dfltsetting[SETTING_LIGHT_NORMAL] = LLVector3(0.0000, 0.9126, -0.4086).getValue(); + dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); + dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); + dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); + dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); + + dfltsetting[SETTING_BLOOM_TEXTUREID] = LLUUID::null; + dfltsetting[SETTING_CLOUD_TEXTUREID] = LLUUID::null; + dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! + dfltsetting[SETTING_SUN_TEXUTUREID] = IMG_SUN; // gSunTextureID; + + return dfltsetting; +} + +LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) +{ + LLSD newsettings(defaults()); + + if (legacy.has(SETTING_AMBIENT)) + { + newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); + } + 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_CLOUD_COLOR)) + { + newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); + } + if (legacy.has(SETTING_CLOUD_POS_DENSITY1)) + { + newsettings[SETTING_CLOUD_POS_DENSITY1] = LLColor3(legacy[SETTING_CLOUD_POS_DENSITY1]).getValue(); + } + if (legacy.has(SETTING_CLOUD_POS_DENSITY2)) + { + newsettings[SETTING_CLOUD_POS_DENSITY2] = LLColor3(legacy[SETTING_CLOUD_POS_DENSITY2]).getValue(); + } + if (legacy.has(SETTING_CLOUD_SCALE)) + { + newsettings[SETTING_CLOUD_SCALE] = LLSD::Real(legacy[SETTING_CLOUD_SCALE][0].asReal()); + } + if (legacy.has(SETTING_CLOUD_SCROLL_RATE)) + { + LLVector2 cloud_scroll(legacy[SETTING_CLOUD_SCROLL_RATE]); + + if (legacy.has(SETTING_LEGACY_ENABLE_CLOUD_SCROLL)) + { + LLSD enabled = legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL]; + if (!enabled[0].asBoolean()) + cloud_scroll.mV[0] = 0.0f; + if (!enabled[1].asBoolean()) + cloud_scroll.mV[1] = 0.0f; + } + + newsettings[SETTING_CLOUD_SCROLL_RATE] = cloud_scroll.getValue(); + } + if (legacy.has(SETTING_CLOUD_SHADOW)) + { + newsettings[SETTING_CLOUD_SHADOW] = LLSD::Real(legacy[SETTING_CLOUD_SHADOW][0].asReal()); + } + 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_GAMMA)) + { + newsettings[SETTING_GAMMA] = legacy[SETTING_GAMMA][0].asReal(); + } + if (legacy.has(SETTING_GLOW)) + { + newsettings[SETTING_GLOW] = LLColor3(legacy[SETTING_GLOW]).getValue(); + } + if (legacy.has(SETTING_HAZE_DENSITY)) + { + newsettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal()); + } + if (legacy.has(SETTING_HAZE_HORIZON)) + { + newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); + } + if (legacy.has(SETTING_LIGHT_NORMAL)) + { + newsettings[SETTING_LIGHT_NORMAL] = LLVector3(legacy[SETTING_LIGHT_NORMAL]).getValue(); + } + if (legacy.has(SETTING_MAX_Y)) + { + newsettings[SETTING_MAX_Y] = LLSD::Real(legacy[SETTING_MAX_Y][0].asReal()); + } + if (legacy.has(SETTING_STAR_BRIGHTNESS)) + { + newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal()); + } + if (legacy.has(SETTING_SUNLIGHT_COLOR)) + { + newsettings[SETTING_SUNLIGHT_COLOR] = LLColor4(legacy[SETTING_SUNLIGHT_COLOR]).getValue(); + } + + if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) + { // convert the east and sun angles into a quaternion. + F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); + F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); + + LLQuaternion sunquat = ::body_position_from_angles(azimuth, altitude); + LLQuaternion moonquat = ::body_position_from_angles(azimuth + F_PI, -altitude); + + F32 az(0), al(0); + ::angles_from_rotation(sunquat, az, al); + + newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); + newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); + } + + return newsettings; +} + +void LLSettingsSky::updateSettings() +{ + LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKYVALUES); + //LL_INFOS("WINDLIGHT", "SKY", "EEP") << "WL Parameters are dirty. Reticulating Splines..." << LL_ENDL; + + // base class clears dirty flag so as to not trigger recursive update + LLSettingsBase::updateSettings(); + + calculateHeavnlyBodyPositions(); + calculateLightSettings(); +} + +void LLSettingsSky::calculateHeavnlyBodyPositions() +{ + mSunDirection = DUE_EAST * getSunRotation(); + mSunDirection.normalize(); + mMoonDirection = DUE_EAST * getMoonRotation(); + mMoonDirection.normalize(); + + // is the normal from the sun or the moon + if (mSunDirection.mV[1] >= 0.0) + { + mLightDirection = mSunDirection; + } + else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_COS) + { + // clamp v1 to 0 so sun never points up and causes weirdness on some machines + LLVector3 vec(mSunDirection); + vec.mV[1] = 0.0; + vec.normalize(); + mLightDirection = vec; + } + else + { + mLightDirection = mMoonDirection; + } + + // calculate the clamp lightnorm for sky (to prevent ugly banding in sky + // when haze goes below the horizon + mClampedLightDirection = mLightDirection; + + if (mClampedLightDirection.mV[1] < -0.1f) + { + mClampedLightDirection.mV[1] = -0.1f; + mClampedLightDirection.normalize(); + } +} + +void LLSettingsSky::calculateLightSettings() +{ + LLColor3 vary_HazeColor; + LLColor3 vary_SunlightColor; + LLColor3 vary_AmbientColor; + { + // Initialize temp variables + LLColor3 sunlight = getSunlightColor(); + LLColor3 ambient = getAmbientColor(); + F32 gamma = getGamma(); + LLColor3 blue_density = getBlueDensity(); + LLColor3 blue_horizon = getBlueHorizon(); + F32 haze_density = getHazeDensity(); + F32 haze_horizon = getHazeHorizon(); + F32 density_multiplier = getDensityMultiplier(); + F32 max_y = getMaxY(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + LLColor3 light_atten = + (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y); + + // Calculate relative weights + LLColor3 temp2(0.f, 0.f, 0.f); + LLColor3 temp1 = blue_density + smear(haze_density); + LLColor3 blue_weight = componentDiv(blue_density, temp1); + LLColor3 haze_weight = componentDiv(smear(haze_density), temp1); + + // Compute sunlight from P & lightnorm (for long rays like sky) + /// USE only lightnorm. + // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); + + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; + if (lighty < NIGHTTIME_ELEVATION_COS) + { + lighty = -lighty; + } + + temp2.mV[1] = llmax(0.f, lighty); + if(temp2.mV[1] > 0.f) + { + temp2.mV[1] = 1.f / temp2.mV[1]; + } + componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1])); + + // Distance + temp2.mV[2] = density_multiplier; + + // Transparency (-> temp1) + temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]); + + // vary_AtmosAttenuation = temp1; + + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + + //haze color + vary_HazeColor = + (blue_horizon * blue_weight * (sunlight*(1.f - cloud_shadow) + tmpAmbient) + + componentMult(haze_horizon * haze_weight, sunlight*(1.f - cloud_shadow) * temp2.mV[0] + tmpAmbient) + ); + + //brightness of surface both sunlight and ambient + vary_SunlightColor = componentMult(sunlight, temp1) * 1.f; + vary_SunlightColor.clamp(); + vary_SunlightColor = smear(1.0f) - vary_SunlightColor; + vary_SunlightColor = componentPow(vary_SunlightColor, gamma); + vary_SunlightColor = smear(1.0f) - vary_SunlightColor; + vary_AmbientColor = componentMult(tmpAmbient, temp1) * 0.5; + vary_AmbientColor.clamp(); + vary_AmbientColor = smear(1.0f) - vary_AmbientColor; + vary_AmbientColor = componentPow(vary_AmbientColor, gamma); + vary_AmbientColor = smear(1.0f) - vary_AmbientColor; + + componentMultBy(vary_HazeColor, LLColor3(1.f, 1.f, 1.f) - temp1); + + } + + mSunDiffuse = vary_SunlightColor; + mSunAmbient = vary_AmbientColor; + mMoonDiffuse = vary_SunlightColor; + mMoonAmbient = vary_AmbientColor; + + mTotalAmbient = LLColor4(vary_AmbientColor, 1.0f); + + mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; + mFadeColor.setAlpha(0); +} + + +//========================================================================= +namespace +{ + LLQuaternion body_position_from_angles(F32 azimuth, F32 altitude) + { + // Azimuth is traditionally calculated from North, we are going from East. + LLQuaternion rot_azi; + LLQuaternion rot_alt; + + rot_azi.setAngleAxis(azimuth, VECT_ZENITH); + rot_alt.setAngleAxis(-altitude, VECT_NORTHSOUTH); + + LLQuaternion body_quat = rot_alt * rot_azi; + body_quat.normalize(); + + //LLVector3 sun_vector = (DUE_EAST * body_quat); + //_WARNS("RIDER") << "Azimuth=" << azimuth << " Altitude=" << altitude << " Body Vector=" << sun_vector.getValue() << LL_ENDL; + return body_quat; + } + + void angles_from_rotation(LLQuaternion quat, F32 &azimuth, F32 &altitude) + { + LLVector3 body_vector = (DUE_EAST * quat); + + LLVector3 body_az(body_vector[0], 0.f, body_vector[2]); + LLVector3 body_al(0.f, body_vector[1], body_vector[2]); + + if (fabs(body_az.normalize()) > 0.001) + azimuth = angle_between(DUE_EAST, body_az); + else + azimuth = 0.0f; + + if (fabs(body_al.normalize()) > 0.001) + altitude = angle_between(DUE_EAST, body_al); + else + altitude = 0.0f; + } +} + + diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h new file mode 100644 index 0000000000..ff4b62f86e --- /dev/null +++ b/indra/llinventory/llsettingssky.h @@ -0,0 +1,455 @@ +/** +* @file llsettingssky.h +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef LL_SETTINGS_SKY_H +#define LL_SETTINGS_SKY_H + +#include "llsettingsbase.h" +#include "v4coloru.h" + +class LLSettingsSky: public LLSettingsBase +{ +public: + static const std::string SETTING_AMBIENT; + static const std::string SETTING_BLOOM_TEXTUREID; + static const std::string SETTING_BLUE_DENSITY; + static const std::string SETTING_BLUE_HORIZON; + static const std::string SETTING_CLOUD_COLOR; + static const std::string SETTING_CLOUD_POS_DENSITY1; + static const std::string SETTING_CLOUD_POS_DENSITY2; + static const std::string SETTING_CLOUD_SCALE; + static const std::string SETTING_CLOUD_SCROLL_RATE; + static const std::string SETTING_CLOUD_SHADOW; + static const std::string SETTING_CLOUD_TEXTUREID; + static const std::string SETTING_DENSITY_MULTIPLIER; + static const std::string SETTING_DISTANCE_MULTIPLIER; + static const std::string SETTING_DOME_OFFSET; + static const std::string SETTING_DOME_RADIUS; + static const std::string SETTING_GAMMA; + static const std::string SETTING_GLOW; + static const std::string SETTING_HAZE_DENSITY; + static const std::string SETTING_HAZE_HORIZON; + static const std::string SETTING_LIGHT_NORMAL; + static const std::string SETTING_MAX_Y; + static const std::string SETTING_MOON_ROTATION; + static const std::string SETTING_MOON_TEXTUREID; + static const std::string SETTING_STAR_BRIGHTNESS; + static const std::string SETTING_SUNLIGHT_COLOR; + static const std::string SETTING_SUN_ROTATION; + static const std::string SETTING_SUN_TEXUTUREID; + + typedef boost::shared_ptr ptr_t; + typedef std::pair azimalt_t; + + //--------------------------------------------------------------------- + LLSettingsSky(const LLSD &data); + virtual ~LLSettingsSky() { }; + + virtual ptr_t buildClone() = 0; + + //--------------------------------------------------------------------- + virtual std::string getSettingType() const { return std::string("sky"); } + + // Settings status + virtual void blend(const LLSettingsBase::ptr_t &end, F32 blendf); + + static LLSD defaults(); + + //--------------------------------------------------------------------- + LLColor3 getAmbientColor() const + { + return LLColor3(mSettings[SETTING_AMBIENT]); + } + + void setAmbientColor(const LLColor3 &val) + { + setValue(SETTING_AMBIENT, val); + } + + LLUUID getBloomTextureId() const + { + return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); + } + + LLColor3 getBlueDensity() const + { + return LLColor3(mSettings[SETTING_BLUE_DENSITY]); + } + + void setBlueDensity(const LLColor3 &val) + { + setValue(SETTING_BLUE_DENSITY, val); + } + + LLColor3 getBlueHorizon() const + { + return LLColor3(mSettings[SETTING_BLUE_HORIZON]); + } + + void setBlueHorizon(const LLColor3 &val) + { + setValue(SETTING_BLUE_HORIZON, val); + } + + LLColor3 getCloudColor() const + { + return LLColor3(mSettings[SETTING_CLOUD_COLOR]); + } + + void setCloudColor(const LLColor3 &val) + { + setValue(SETTING_CLOUD_COLOR, val); + } + + LLUUID getCloudNoiseTextureId() const + { + return mSettings[SETTING_CLOUD_TEXTUREID].asUUID(); + } + + LLColor3 getCloudPosDensity1() const + { + return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]); + } + + void setCloudPosDensity1(const LLColor3 &val) + { + setValue(SETTING_CLOUD_POS_DENSITY1, val); + } + + LLColor3 getCloudPosDensity2() const + { + return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY2]); + } + + void setCloudPosDensity2(const LLColor3 &val) + { + setValue(SETTING_CLOUD_POS_DENSITY2, val); + } + + F32 getCloudScale() const + { + return mSettings[SETTING_CLOUD_SCALE].asReal(); + } + + void setCloudScale(F32 val) + { + setValue(SETTING_CLOUD_SCALE, val); + } + + LLVector2 getCloudScrollRate() const + { + return LLVector2(mSettings[SETTING_CLOUD_SCROLL_RATE]); + } + + void setCloudScrollRate(const LLVector2 &val) + { + setValue(SETTING_CLOUD_SCROLL_RATE, val); + } + + void setCloudScrollRateX(F32 val) + { + mSettings[SETTING_CLOUD_SCROLL_RATE][0] = val; + setDirtyFlag(true); + } + + void setCloudScrollRateY(F32 val) + { + mSettings[SETTING_CLOUD_SCROLL_RATE][1] = val; + setDirtyFlag(true); + } + + F32 getCloudShadow() const + { + return mSettings[SETTING_CLOUD_SHADOW].asReal(); + } + + void setCloudShadow(F32 val) + { + setValue(SETTING_CLOUD_SHADOW, val); + } + + F32 getDensityMultiplier() const + { + return mSettings[SETTING_DENSITY_MULTIPLIER].asReal(); + } + + void setDensityMultiplier(F32 val) + { + setValue(SETTING_DENSITY_MULTIPLIER, val); + } + + F32 getDistanceMultiplier() const + { + return mSettings[SETTING_DISTANCE_MULTIPLIER].asReal(); + } + + void setDistanceMultiplier(F32 val) + { + setValue(SETTING_DISTANCE_MULTIPLIER, val); + } + + F32 getDomeOffset() const + { + return DOME_OFFSET; + //return mSettings[SETTING_DOME_OFFSET].asReal(); + } + + F32 getDomeRadius() const + { + return DOME_RADIUS; + //return mSettings[SETTING_DOME_RADIUS].asReal(); + } + + F32 getGamma() const + { + return mSettings[SETTING_GAMMA].asReal(); + } + + void setGamma(F32 val) + { + mSettings[SETTING_GAMMA] = LLSD::Real(val); + setDirtyFlag(true); + } + + LLColor3 getGlow() const + { + return LLColor3(mSettings[SETTING_GLOW]); + } + + void setGlow(const LLColor3 &val) + { + setValue(SETTING_GLOW, val); + } + + F32 getHazeDensity() const + { + return mSettings[SETTING_HAZE_DENSITY].asReal(); + } + + void setHazeDensity(F32 val) + { + setValue(SETTING_HAZE_DENSITY, val); + } + + F32 getHazeHorizon() const + { + return mSettings[SETTING_HAZE_HORIZON].asReal(); + } + + void setHazeHorizon(F32 val) + { + setValue(SETTING_HAZE_HORIZON, val); + } + + LLVector3 getLightNormal() const + { + return LLVector3(mSettings[SETTING_LIGHT_NORMAL]); + } + + void setLightNormal(const LLVector3 &val) + { + setValue(SETTING_LIGHT_NORMAL, val); + } + + F32 getMaxY() const + { + return mSettings[SETTING_MAX_Y].asReal(); + } + + LLQuaternion getMoonRotation() const + { + return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); + } + + void setMoonRotation(const LLQuaternion &val) + { + setValue(SETTING_MOON_ROTATION, val); + } + + azimalt_t getMoonRotationAzAl() const; + + void setMoonRotation(F32 azimuth, F32 altitude); + + void setMoonRotation(const azimalt_t &azialt) + { + setMoonRotation(azialt.first, azialt.second); + } + + LLUUID getMoonTextureId() const + { + return mSettings[SETTING_MOON_TEXTUREID].asUUID(); + } + + F32 getStarBrightness() const + { + return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); + } + + void setStarBrightness(F32 val) + { + setValue(SETTING_STAR_BRIGHTNESS, val); + } + + LLColor3 getSunlightColor() const + { + return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]); + } + + void setSunlightColor(const LLColor3 &val) + { + setValue(SETTING_SUNLIGHT_COLOR, val); + } + + LLQuaternion getSunRotation() const + { + return LLQuaternion(mSettings[SETTING_SUN_ROTATION]); + } + + azimalt_t getSunRotationAzAl() const; + + void setSunRotation(const LLQuaternion &val) + { + setValue(SETTING_SUN_ROTATION, val); + } + + void setSunRotation(F32 azimuth, F32 altitude); + + void setSunRotation(const azimalt_t & azimalt) + { + setSunRotation(azimalt.first, azimalt.second); + } + + LLUUID getSunTextureId() const + { + return mSettings[SETTING_SUN_TEXUTUREID].asUUID(); + } + + // Internal/calculated settings + LLVector3 getLightDirection() const + { + update(); + return mLightDirection; + }; + + LLVector3 getClampedLightDirection() const + { + update(); + return mClampedLightDirection; + }; + + LLVector3 getSunDirection() const + { + update(); + return mSunDirection; + } + + LLVector3 getMoonDirection() const + { + update(); + return mMoonDirection; + } + + LLColor4U getFadeColor() const + { + update(); + return mFadeColor; + } + + LLColor4 getMoonAmbient() const + { + update(); + return mMoonAmbient; + } + + LLColor3 getMoonDiffuse() const + { + update(); + return mMoonDiffuse; + } + + LLColor4 getSunAmbient() const + { + update(); + return mSunAmbient; + } + + LLColor3 getSunDiffuse() const + { + update(); + return mSunDiffuse; + } + + LLColor4 getTotalAmbient() const + { + update(); + return mTotalAmbient; + } + +protected: + LLSettingsSky(); + + virtual stringset_t getSlerpKeys() const; + + virtual validation_list_t getValidationList() const; + + virtual void updateSettings(); + + static LLSD translateLegacySettings(LLSD legacy); + +private: + static const std::string SETTING_LEGACY_EAST_ANGLE; + static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; + static const std::string SETTING_LEGACY_SUN_ANGLE; + + static const F32 NIGHTTIME_ELEVATION; + static const F32 NIGHTTIME_ELEVATION_COS; + + void calculateHeavnlyBodyPositions(); + void calculateLightSettings(); + + LLVector3 mSunDirection; + LLVector3 mMoonDirection; + LLVector3 mLightDirection; + LLVector3 mClampedLightDirection; + + static const F32 DOME_RADIUS; + static const F32 DOME_OFFSET; + + LLColor4U mFadeColor; + LLColor4 mMoonAmbient; + LLColor3 mMoonDiffuse; + LLColor4 mSunAmbient; + LLColor3 mSunDiffuse; + + LLColor4 mTotalAmbient; + + typedef std::map mapNameToUniformId_t; + + static mapNameToUniformId_t sNameToUniformMapping; +}; + +#endif diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp new file mode 100644 index 0000000000..1b960746d5 --- /dev/null +++ b/indra/llinventory/llsettingswater.cpp @@ -0,0 +1,215 @@ +/** +* @file llsettingswater.h +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llsettingswater.h" +#include +#include +#include "lltrace.h" +#include "llfasttimer.h" +#include "v3colorutil.h" +#include "indra_constants.h" + +//========================================================================= +namespace +{ + LLTrace::BlockTimerStatHandle FTM_BLEND_WATERVALUES("Blending Water Environment"); + LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERVALUES("Update Water Environment"); +} + +//========================================================================= +const std::string LLSettingsWater::SETTING_BLUR_MULTIPILER("blur_multiplier"); +const std::string LLSettingsWater::SETTING_FOG_COLOR("water_fog_color"); +const std::string LLSettingsWater::SETTING_FOG_DENSITY("water_fog_density"); +const std::string LLSettingsWater::SETTING_FOG_MOD("underwater_fog_mod"); +const std::string LLSettingsWater::SETTING_FRESNEL_OFFSET("fresnel_offset"); +const std::string LLSettingsWater::SETTING_FRESNEL_SCALE("fresnel_scale"); +const std::string LLSettingsWater::SETTING_NORMAL_MAP("normal_map"); +const std::string LLSettingsWater::SETTING_NORMAL_SCALE("normal_scale"); +const std::string LLSettingsWater::SETTING_SCALE_ABOVE("scale_above"); +const std::string LLSettingsWater::SETTING_SCALE_BELOW("scale_below"); +const std::string LLSettingsWater::SETTING_WAVE1_DIR("wave1_direction"); +const std::string LLSettingsWater::SETTING_WAVE2_DIR("wave2_direction"); + +const std::string LLSettingsWater::SETTING_LEGACY_BLUR_MULTIPILER("blurMultiplier"); +const std::string LLSettingsWater::SETTING_LEGACY_FOG_COLOR("waterFogColor"); +const std::string LLSettingsWater::SETTING_LEGACY_FOG_DENSITY("waterFogDensity"); +const std::string LLSettingsWater::SETTING_LEGACY_FOG_MOD("underWaterFogMod"); +const std::string LLSettingsWater::SETTING_LEGACY_FRESNEL_OFFSET("fresnelOffset"); +const std::string LLSettingsWater::SETTING_LEGACY_FRESNEL_SCALE("fresnelScale"); +const std::string LLSettingsWater::SETTING_LEGACY_NORMAL_MAP("normalMap"); +const std::string LLSettingsWater::SETTING_LEGACY_NORMAL_SCALE("normScale"); +const std::string LLSettingsWater::SETTING_LEGACY_SCALE_ABOVE("scaleAbove"); +const std::string LLSettingsWater::SETTING_LEGACY_SCALE_BELOW("scaleBelow"); +const std::string LLSettingsWater::SETTING_LEGACY_WAVE1_DIR("wave1Dir"); +const std::string LLSettingsWater::SETTING_LEGACY_WAVE2_DIR("wave2Dir"); + +const LLUUID LLSettingsWater::DEFAULT_WATER_NORMAL_ID(DEFAULT_WATER_NORMAL); + + +//========================================================================= +LLSettingsWater::LLSettingsWater(const LLSD &data) : + LLSettingsBase(data) +{ +} + +LLSettingsWater::LLSettingsWater() : + LLSettingsBase() +{ +} + +//========================================================================= +LLSD LLSettingsWater::defaults() +{ + LLSD dfltsetting; + + // Magic constants copied form defaults.xml + dfltsetting[SETTING_BLUR_MULTIPILER] = LLSD::Real(0.04000f); + dfltsetting[SETTING_FOG_COLOR] = LLColor3(0.0156f, 0.1490f, 0.2509f).getValue(); + dfltsetting[SETTING_FOG_DENSITY] = LLSD::Real(2.0f); + dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f); + dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f); + dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999); + dfltsetting[SETTING_NORMAL_MAP] = LLSD::UUID(DEFAULT_WATER_NORMAL_ID); + dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f, 2.0f, 2.0f).getValue(); + dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f); + dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f); + dfltsetting[SETTING_WAVE1_DIR] = LLVector2(1.04999f, -0.42000f).getValue(); + dfltsetting[SETTING_WAVE2_DIR] = LLVector2(1.10999f, -1.16000f).getValue(); + + return dfltsetting; +} + +LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) +{ + LLSD newsettings(defaults()); + + if (legacy.has(SETTING_LEGACY_BLUR_MULTIPILER)) + { + newsettings[SETTING_BLUR_MULTIPILER] = LLSD::Real(legacy[SETTING_LEGACY_BLUR_MULTIPILER].asReal()); + } + if (legacy.has(SETTING_LEGACY_FOG_COLOR)) + { + newsettings[SETTING_FOG_COLOR] = LLColor3(legacy[SETTING_LEGACY_FOG_COLOR]).getValue(); + } + if (legacy.has(SETTING_LEGACY_FOG_DENSITY)) + { + newsettings[SETTING_FOG_DENSITY] = LLSD::Real(legacy[SETTING_LEGACY_FOG_DENSITY]); + } + if (legacy.has(SETTING_LEGACY_FOG_MOD)) + { + newsettings[SETTING_FOG_MOD] = LLSD::Real(legacy[SETTING_LEGACY_FOG_MOD].asReal()); + } + if (legacy.has(SETTING_LEGACY_FRESNEL_OFFSET)) + { + newsettings[SETTING_FRESNEL_OFFSET] = LLSD::Real(legacy[SETTING_LEGACY_FRESNEL_OFFSET].asReal()); + } + if (legacy.has(SETTING_LEGACY_FRESNEL_SCALE)) + { + newsettings[SETTING_FRESNEL_SCALE] = LLSD::Real(legacy[SETTING_LEGACY_FRESNEL_SCALE].asReal()); + } + if (legacy.has(SETTING_LEGACY_NORMAL_MAP)) + { + newsettings[SETTING_NORMAL_MAP] = LLSD::UUID(legacy[SETTING_LEGACY_NORMAL_MAP].asUUID()); + } + if (legacy.has(SETTING_LEGACY_NORMAL_SCALE)) + { + newsettings[SETTING_NORMAL_SCALE] = LLVector3(legacy[SETTING_LEGACY_NORMAL_SCALE]).getValue(); + } + if (legacy.has(SETTING_LEGACY_SCALE_ABOVE)) + { + newsettings[SETTING_SCALE_ABOVE] = LLSD::Real(legacy[SETTING_LEGACY_SCALE_ABOVE].asReal()); + } + if (legacy.has(SETTING_LEGACY_SCALE_BELOW)) + { + newsettings[SETTING_SCALE_BELOW] = LLSD::Real(legacy[SETTING_LEGACY_SCALE_BELOW].asReal()); + } + if (legacy.has(SETTING_LEGACY_WAVE1_DIR)) + { + newsettings[SETTING_WAVE1_DIR] = LLVector2(legacy[SETTING_LEGACY_WAVE1_DIR]).getValue(); + } + if (legacy.has(SETTING_LEGACY_WAVE2_DIR)) + { + newsettings[SETTING_WAVE2_DIR] = LLVector2(legacy[SETTING_LEGACY_WAVE2_DIR]).getValue(); + } + + return newsettings; +} + +void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F32 blendf) +{ + LLSettingsWater::ptr_t other = boost::static_pointer_cast(end); + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + + replaceSettings(blenddata); +} + +LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const +{ + static validation_list_t validation; + + if (validation.empty()) + { // Note the use of LLSD(LLSDArray()()()...) This is due to an issue with the + // copy constructor for LLSDArray. Directly binding the LLSDArray as + // a parameter without first wrapping it in a pure LLSD object will result + // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] + + validation.push_back(Validator(SETTING_BLUR_MULTIPILER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.16f))))); + validation.push_back(Validator(SETTING_FOG_COLOR, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)(1.0f)), + LLSD(LLSDArray(1.0f)(1.0f)(1.0f)(1.0f))))); + validation.push_back(Validator(SETTING_FOG_DENSITY, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1.0f)(1024.0f))))); + validation.push_back(Validator(SETTING_FOG_MOD, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1.0f)(1024.0f))))); + validation.push_back(Validator(SETTING_FRESNEL_OFFSET, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_FRESNEL_SCALE, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_NORMAL_MAP, true, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_NORMAL_SCALE, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)), + LLSD(LLSDArray(10.0f)(10.0f)(10.0f))))); + validation.push_back(Validator(SETTING_SCALE_ABOVE, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_SCALE_BELOW, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_WAVE1_DIR, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(-4.0f)(-4.0f)), + LLSD(LLSDArray(4.0f)(4.0f))))); + validation.push_back(Validator(SETTING_WAVE2_DIR, true, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(-4.0f)(-4.0f)), + LLSD(LLSDArray(4.0f)(4.0f))))); + } + + return validation; +} + diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h new file mode 100644 index 0000000000..5d6a482d56 --- /dev/null +++ b/indra/llinventory/llsettingswater.h @@ -0,0 +1,227 @@ +/** +* @file llsettingssky.h +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef LL_SETTINGS_WATER_H +#define LL_SETTINGS_WATER_H + +#include "llsettingsbase.h" + +class LLSettingsWater : public LLSettingsBase +{ +public: + static const std::string SETTING_BLUR_MULTIPILER; + static const std::string SETTING_FOG_COLOR; + static const std::string SETTING_FOG_DENSITY; + static const std::string SETTING_FOG_MOD; + static const std::string SETTING_FRESNEL_OFFSET; + static const std::string SETTING_FRESNEL_SCALE; + static const std::string SETTING_NORMAL_MAP; + static const std::string SETTING_NORMAL_SCALE; + static const std::string SETTING_SCALE_ABOVE; + static const std::string SETTING_SCALE_BELOW; + static const std::string SETTING_WAVE1_DIR; + static const std::string SETTING_WAVE2_DIR; + + static const LLUUID DEFAULT_WATER_NORMAL_ID; + + typedef boost::shared_ptr ptr_t; + + //--------------------------------------------------------------------- + LLSettingsWater(const LLSD &data); + virtual ~LLSettingsWater() { }; + + virtual ptr_t buildClone() = 0; + + //--------------------------------------------------------------------- + virtual std::string getSettingType() const { return std::string("water"); } + + // Settings status + virtual void blend(const LLSettingsBase::ptr_t &end, F32 blendf); + + static LLSD defaults(); + + //--------------------------------------------------------------------- + F32 getBlurMultiplier() const + { + return mSettings[SETTING_BLUR_MULTIPILER].asReal(); + } + + void setBlurMultiplier(F32 val) + { + setValue(SETTING_BLUR_MULTIPILER, val); + } + + LLColor3 getFogColor() const + { + return LLColor3(mSettings[SETTING_FOG_COLOR]); + } + + void setFogColor(LLColor3 val) + { + setValue(SETTING_FOG_COLOR, val); + } + + F32 getFogDensity() const + { + return mSettings[SETTING_FOG_DENSITY].asReal(); + } + + void setFogDensity(F32 val) + { + setValue(SETTING_FOG_DENSITY, val); + } + + F32 getFogMod() const + { + return mSettings[SETTING_FOG_MOD].asReal(); + } + + void setFogMod(F32 val) + { + setValue(SETTING_FOG_MOD, val); + } + + F32 getFresnelOffset() const + { + return mSettings[SETTING_FRESNEL_OFFSET].asReal(); + } + + void setFresnelOffset(F32 val) + { + setValue(SETTING_FRESNEL_OFFSET, val); + } + + F32 getFresnelScale() const + { + return mSettings[SETTING_FRESNEL_SCALE].asReal(); + } + + void setFresnelScale(F32 val) + { + setValue(SETTING_FRESNEL_SCALE, val); + } + + LLUUID getNormalMapID() const + { + return mSettings[SETTING_NORMAL_MAP].asUUID(); + } + + void setNormalMapID(LLUUID val) + { + setValue(SETTING_NORMAL_MAP, val); + } + + LLVector3 getNormalScale() const + { + return LLVector3(mSettings[SETTING_NORMAL_SCALE]); + } + + void setNormalScale(LLVector3 val) + { + setValue(SETTING_NORMAL_SCALE, val); + } + + F32 getScaleAbove() const + { + return mSettings[SETTING_SCALE_ABOVE].asReal(); + } + + void setScaleAbove(F32 val) + { + setValue(SETTING_SCALE_ABOVE, val); + } + + F32 getScaleBelow() const + { + return mSettings[SETTING_SCALE_BELOW].asReal(); + } + + void setScaleBelow(F32 val) + { + setValue(SETTING_SCALE_BELOW, val); + } + + LLVector2 getWave1Dir() const + { + return LLVector2(mSettings[SETTING_WAVE1_DIR]); + } + + void setWave1Dir(LLVector2 val) + { + setValue(SETTING_WAVE1_DIR, val); + } + + LLVector2 getWave2Dir() const + { + return LLVector2(mSettings[SETTING_WAVE2_DIR]); + } + + void setWave2Dir(LLVector2 val) + { + setValue(SETTING_WAVE2_DIR, val); + } + + //------------------------------------------- + LLVector4 getWaterPlane() const + { + update(); + return mWaterPlane; + } + + F32 getWaterFogKS() const + { + update(); + return mWaterFogKS; + } + +protected: + LLSettingsWater(); + + virtual validation_list_t getValidationList() const; + + static LLSD translateLegacySettings(LLSD legacy); + + LLVector4 mWaterPlane; + F32 mWaterFogKS; + +private: + static const std::string SETTING_LEGACY_BLUR_MULTIPILER; + static const std::string SETTING_LEGACY_FOG_COLOR; + static const std::string SETTING_LEGACY_FOG_DENSITY; + static const std::string SETTING_LEGACY_FOG_MOD; + static const std::string SETTING_LEGACY_FRESNEL_OFFSET; + static const std::string SETTING_LEGACY_FRESNEL_SCALE; + static const std::string SETTING_LEGACY_NORMAL_MAP; + static const std::string SETTING_LEGACY_NORMAL_SCALE; + static const std::string SETTING_LEGACY_SCALE_ABOVE; + static const std::string SETTING_LEGACY_SCALE_BELOW; + static const std::string SETTING_LEGACY_WAVE1_DIR; + static const std::string SETTING_LEGACY_WAVE2_DIR; + +}; + +#endif -- cgit v1.2.3 From 8211f57205f0008d8ffb9bfcd465ca26d906e19c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 8 Jan 2018 15:10:25 -0800 Subject: MAINT-7699: Deliver new settings to viewer via cap --- indra/llinventory/llsettingsbase.cpp | 16 ++++++------- indra/llinventory/llsettingsbase.h | 39 +++++++++++++++++++----------- indra/llinventory/llsettingsdaycycle.cpp | 41 ++++++++++++++++++++------------ indra/llinventory/llsettingsdaycycle.h | 28 +++++++++++++++++++--- indra/llinventory/llsettingssky.cpp | 2 +- indra/llinventory/llsettingssky.h | 10 ++++---- indra/llinventory/llsettingswater.cpp | 2 +- indra/llinventory/llsettingswater.h | 23 +++++++++--------- 8 files changed, 103 insertions(+), 58 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index e4291d8080..30b1d66634 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -35,7 +35,7 @@ //========================================================================= namespace { - const F32 BREAK_POINT = 0.5; + const F64 BREAK_POINT = 0.5; } //========================================================================= @@ -44,7 +44,7 @@ const std::string LLSettingsBase::SETTING_NAME("name"); const std::string LLSettingsBase::SETTING_HASH("hash"); const std::string LLSettingsBase::SETTING_TYPE("type"); -const F32Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); +const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); //========================================================================= LLSettingsBase::LLSettingsBase(): @@ -60,7 +60,7 @@ LLSettingsBase::LLSettingsBase(const LLSD setting) : } //========================================================================= -void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F32 mix) +void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F64 mix) { mSettings = interpolateSDMap(mSettings, other.mSettings, mix); setDirtyFlag(true); @@ -140,7 +140,7 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons return newSettings; } -LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F32 mix) const +LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const { LLSD newSettings; @@ -535,9 +535,9 @@ bool LLSettingsBase::Validator::verifyQuaternionNormal(LLSD &value) bool LLSettingsBase::Validator::verifyFloatRange(LLSD &value, LLSD range) { - F32 real = value.asReal(); + F64 real = value.asReal(); - F32 clampedval = llclamp(LLSD::Real(real), range[0].asReal(), range[1].asReal()); + F64 clampedval = llclamp(LLSD::Real(real), range[0].asReal(), range[1].asReal()); if (is_approx_equal(clampedval, real)) return true; @@ -561,7 +561,7 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) //========================================================================= -void LLSettingsBlender::update(F32Seconds timedelta) +void LLSettingsBlender::update(F64Seconds timedelta) { mTimeSpent += timedelta; @@ -573,7 +573,7 @@ void LLSettingsBlender::update(F32Seconds timedelta) return; } - F32 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); + F64 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); mTarget->replaceSettings(mInitial->getSettings()); mTarget->blend(mFinal, blendf); diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 2b59a103ad..0a20754ffb 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -151,7 +151,7 @@ public: (const_cast(this))->updateSettings(); } - virtual void blend(const ptr_t &end, F32 blendf) = 0; + virtual void blend(const ptr_t &end, F64 blendf) = 0; virtual bool validate(); @@ -198,8 +198,8 @@ protected: typedef std::set stringset_t; // combining settings objects. Customize for specific setting types - virtual void lerpSettings(const LLSettingsBase &other, F32 mix); - LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, F32 mix) const; + virtual void lerpSettings(const LLSettingsBase &other, F64 mix); + LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const; /// when lerping between settings, some may require special handling. /// Get a list of these key to be skipped by the default settings lerp. @@ -240,10 +240,10 @@ public: typedef boost::signals2::signal finish_signal_t; typedef boost::signals2::connection connection_t; - static const F32Seconds DEFAULT_THRESHOLD; + static const F64Seconds DEFAULT_THRESHOLD; LLSettingsBlender(const LLSettingsBase::ptr_t &target, - const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F32Seconds seconds) : + const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds) : mTarget(target), mInitial(initsetting), mFinal(endsetting), @@ -254,23 +254,34 @@ public: mTimeSpent(0.0f) { mTarget->replaceSettings(mInitial->getSettings()); - mTimeStart = F32Seconds(LLDate::now().secondsSinceEpoch()); + mTimeStart = F64Seconds(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; } ~LLSettingsBlender() {} + void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 seconds ) + { + mInitial = initsetting; + mFinal = endsetting; + mSeconds.value(seconds); + mTarget->replaceSettings(mInitial->getSettings()); + mTimeStart.value(LLDate::now().secondsSinceEpoch()); + mLastUpdate = mTimeStart; + mTimeSpent.value(0.0f); + } + connection_t setOnFinished(const finish_signal_t::slot_type &onfinished) { return mOnFinished.connect(onfinished); } - void setUpdateThreshold(F32Seconds threshold) + void setUpdateThreshold(F64Seconds threshold) { mBlendThreshold = threshold; } - F32Seconds getUpdateThreshold() const + F64Seconds getUpdateThreshold() const { return mBlendThreshold; } @@ -290,17 +301,17 @@ public: return mFinal; } - void update(F32Seconds time); + void update(F64Seconds time); private: LLSettingsBase::ptr_t mTarget; LLSettingsBase::ptr_t mInitial; LLSettingsBase::ptr_t mFinal; - F32Seconds mSeconds; + F64Seconds mSeconds; finish_signal_t mOnFinished; - F32Seconds mBlendThreshold; - F32Seconds mLastUpdate; - F32Seconds mTimeSpent; - F32Seconds mTimeStart; + F64Seconds mBlendThreshold; + F64Seconds mLastUpdate; + F64Seconds mTimeSpent; + F64Seconds mTimeStart; }; #endif diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 687210e127..180992cd29 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -104,11 +104,14 @@ const std::string LLSettingsDay::SETTING_KEYHASH("key_hash"); const std::string LLSettingsDay::SETTING_TRACKS("tracks"); const std::string LLSettingsDay::SETTING_FRAMES("frames"); -const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 300); // 5 mins - -//const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 14400); // 4 hours +const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 300); // 5 mins +const S64 LLSettingsDay::DEFAULT_DAYLENGTH( 14400); // 4 hours const S64 LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days +const S32 LLSettingsDay::MINIMUM_DAYOFFSET( 0); +const S32 LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset) +const S32 LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours + const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water const S32 LLSettingsDay::FRAME_MAX(56); @@ -116,14 +119,18 @@ const S32 LLSettingsDay::FRAME_MAX(56); //========================================================================= LLSettingsDay::LLSettingsDay(const LLSD &data) : LLSettingsBase(data), - mInitialized(false) + mInitialized(false), + mDayLength(DEFAULT_DAYLENGTH), + mDayOffset(DEFAULT_DAYOFFSET) { mDayTracks.resize(TRACK_MAX); } LLSettingsDay::LLSettingsDay() : LLSettingsBase(), - mInitialized(false) + mInitialized(false), + mDayLength(DEFAULT_DAYLENGTH), + mDayOffset(DEFAULT_DAYOFFSET) { mDayTracks.resize(TRACK_MAX); } @@ -266,7 +273,7 @@ LLSD LLSettingsDay::defaults() return dfltsetting; } -void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F32 mix) +void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F64 mix) { LL_ERRS("DAYCYCLE") << "Day cycles are not blendable!" << LL_ENDL; } @@ -337,19 +344,30 @@ LLSettingsDay::validation_list_t LLSettingsDay::getValidationList() const return validation; } +LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track) +{ + static CycleTrack_t emptyTrack; + if (mDayTracks.size() <= track) + return emptyTrack; + + return mDayTracks[track]; +} + //========================================================================= F32 LLSettingsDay::secondsToKeyframe(S64Seconds seconds) { S64Seconds daylength = getDayLength(); + S64Seconds dayoffset = getDayOffset(); - return llclamp(static_cast(seconds.value() % daylength.value()) / static_cast(daylength.value()), 0.0f, 1.0f); + return llclamp(static_cast((seconds.value() + dayoffset.value()) % daylength.value()) / static_cast(daylength.value()), 0.0f, 1.0f); } F64Seconds LLSettingsDay::keyframeToSeconds(F32 keyframe) { S64Seconds daylength = getDayLength(); + S64Seconds dayoffset = getDayOffset(); - return F64Seconds(static_cast(keyframe * static_cast(daylength.value()))); + return F64Seconds(static_cast(keyframe * static_cast(daylength.value())) - dayoffset.value()); } //========================================================================= @@ -424,13 +442,6 @@ void LLSettingsDay::updateSettings() } //========================================================================= -void LLSettingsDay::setDayLength(S64Seconds seconds) -{ - S32 val = llclamp(seconds.value(), MINIMUM_DAYLENGTH, MAXIMUM_DAYLENGTH); - - setValue(SETTING_DAYLENGTH, val); -} - LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) { if ((trackno < 1) || (trackno >= TRACK_MAX)) diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 3b24ce9f97..ae47a54270 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -48,8 +48,13 @@ public: static const std::string SETTING_FRAMES; static const S64 MINIMUM_DAYLENGTH; + static const S64 DEFAULT_DAYLENGTH; static const S64 MAXIMUM_DAYLENGTH; + static const S32 MINIMUM_DAYOFFSET; + static const S32 DEFAULT_DAYOFFSET; + static const S32 MAXIMUM_DAYOFFSET; + static const S32 TRACK_WATER; static const S32 TRACK_MAX; static const S32 FRAME_MAX; @@ -74,17 +79,30 @@ public: virtual std::string getSettingType() const { return std::string("daycycle"); } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &other, F32 mix); + virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix); static LLSD defaults(); //--------------------------------------------------------------------- S64Seconds getDayLength() const { - return S64Seconds(mSettings[SETTING_DAYLENGTH].asInteger()); + return mDayLength; + } + + void setDayLength(S64Seconds seconds) + { + mDayLength = seconds; + } + + S64Seconds getDayOffset() const + { + return mDayOffset; } - void setDayLength(S64Seconds seconds); + void setDayOffset(S64Seconds seconds) + { + mDayOffset = seconds; + } KeyframeList_t getTrackKeyframes(S32 track); TimeList_t getTrackTimes(S32 track); @@ -117,6 +135,7 @@ public: virtual LLSettingsWaterPtr_t getNamedWater(const std::string &) const = 0; void setInitialized(bool value = true) { mInitialized = value; } + CycleTrack_t & getCycleTrack(S32 track); protected: LLSettingsDay(); @@ -137,6 +156,9 @@ private: F64Seconds mLastUpdateTime; + S64Seconds mDayLength; + S64Seconds mDayOffset; + F32 secondsToKeyframe(S64Seconds seconds); F64Seconds keyframeToSeconds(F32 keyframe); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ecc89165e8..7fc9d83cae 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -96,7 +96,7 @@ LLSettingsSky::LLSettingsSky(): { } -void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F32 blendf) +void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { LLSettingsSky::ptr_t other = boost::static_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index ff4b62f86e..12ea237ef3 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -75,7 +75,7 @@ public: virtual std::string getSettingType() const { return std::string("sky"); } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &end, F32 blendf); + virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf); static LLSD defaults(); @@ -410,6 +410,10 @@ public: } protected: + static const std::string SETTING_LEGACY_EAST_ANGLE; + static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; + static const std::string SETTING_LEGACY_SUN_ANGLE; + LLSettingsSky(); virtual stringset_t getSlerpKeys() const; @@ -421,10 +425,6 @@ protected: static LLSD translateLegacySettings(LLSD legacy); private: - static const std::string SETTING_LEGACY_EAST_ANGLE; - static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; - static const std::string SETTING_LEGACY_SUN_ANGLE; - static const F32 NIGHTTIME_ELEVATION; static const F32 NIGHTTIME_ELEVATION_COS; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 1b960746d5..00f870bbb0 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -159,7 +159,7 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) return newsettings; } -void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F32 blendf) +void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { LLSettingsWater::ptr_t other = boost::static_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 5d6a482d56..d18caf68b1 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -60,7 +60,7 @@ public: virtual std::string getSettingType() const { return std::string("water"); } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &end, F32 blendf); + virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf); static LLSD defaults(); @@ -199,16 +199,6 @@ public: } protected: - LLSettingsWater(); - - virtual validation_list_t getValidationList() const; - - static LLSD translateLegacySettings(LLSD legacy); - - LLVector4 mWaterPlane; - F32 mWaterFogKS; - -private: static const std::string SETTING_LEGACY_BLUR_MULTIPILER; static const std::string SETTING_LEGACY_FOG_COLOR; static const std::string SETTING_LEGACY_FOG_DENSITY; @@ -222,6 +212,17 @@ private: static const std::string SETTING_LEGACY_WAVE1_DIR; static const std::string SETTING_LEGACY_WAVE2_DIR; + LLSettingsWater(); + + virtual validation_list_t getValidationList() const; + + static LLSD translateLegacySettings(LLSD legacy); + + LLVector4 mWaterPlane; + F32 mWaterFogKS; + +private: + }; #endif -- cgit v1.2.3 From a0c228d84240a80437b63e0a2cd1cee24e8004a0 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 16 Jan 2018 11:03:26 -0800 Subject: MAINT-8052: Report if the returned environment is the default. --- indra/llinventory/llparcel.cpp | 5 +++++ indra/llinventory/llparcel.h | 17 +++++++++++++++-- indra/llinventory/llsettingsdaycycle.cpp | 1 - 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 0908613c10..f53ef5e0ff 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -231,6 +231,11 @@ void LLParcel::init(const LLUUID &owner_id, setAllowGroupAVSounds(TRUE); setAllowAnyAVSounds(TRUE); setHaveNewParcelLimitData(FALSE); + + mDayLength = S64Seconds(LLSettingsDay::DEFAULT_DAYLENGTH); + mDayOffset = S64Seconds(LLSettingsDay::DEFAULT_DAYOFFSET); + mIsDefaultDayCycle = true; + mDayCycle.reset(); } void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned) diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 135d0ca7b9..dada2cf6d8 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -34,6 +34,7 @@ #include "llpermissions.h" #include "lltimer.h" #include "v3math.h" +#include "llsettingsdaycycle.h" // Grid out of which parcels taken is stepped every 4 meters. const F32 PARCEL_GRID_STEP_METERS = 4.f; @@ -590,7 +591,15 @@ public: BOOL getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; } BOOL getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) ? TRUE : FALSE; } - + S64Seconds getDayLength() const { return mDayLength; } + void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; } + S64Seconds getDayOffset() const { return mDayOffset; } + void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; } + bool getIsDefaultDayCycle() const { return mIsDefaultDayCycle; } + void setIsDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; } + LLSettingsDay::ptr_t getParcelDayCycle() const { return mDayCycle; } + void setParcelDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; } + protected: LLUUID mID; LLUUID mOwnerID; @@ -665,7 +674,11 @@ protected: BOOL mAllowGroupAVSounds; BOOL mAllowAnyAVSounds; - + S64Seconds mDayLength; + S64Seconds mDayOffset; + bool mIsDefaultDayCycle; + LLSettingsDay::ptr_t mDayCycle; + public: // HACK, make private S32 mLocalID; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 180992cd29..4207df0924 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -432,7 +432,6 @@ void LLSettingsDay::updateSettings() { static LLFrameTimer timer; - F64Seconds delta(timer.getElapsedTimeAndResetF32()); if (mSkyBlender) -- cgit v1.2.3 From 1b8c2b5ebbe0d42f147730bc9b6528fa8c6796ce Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 23 Jan 2018 08:54:34 -0800 Subject: MAINT-8052: Initial support for new EEP cap --- indra/llinventory/llparcel.h | 4 +- indra/llinventory/llsettingsbase.cpp | 89 ++++++++++++++--------- indra/llinventory/llsettingsbase.h | 6 +- indra/llinventory/llsettingsdaycycle.cpp | 120 ++++++++++++++++++++++++++++--- indra/llinventory/llsettingsdaycycle.h | 9 +-- indra/llinventory/llsettingssky.cpp | 5 ++ indra/llinventory/llsettingssky.h | 5 +- indra/llinventory/llsettingswater.cpp | 5 ++ indra/llinventory/llsettingswater.h | 5 +- 9 files changed, 196 insertions(+), 52 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index dada2cf6d8..7b4647cc5f 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -595,8 +595,8 @@ public: void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; } S64Seconds getDayOffset() const { return mDayOffset; } void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; } - bool getIsDefaultDayCycle() const { return mIsDefaultDayCycle; } - void setIsDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; } + bool getUsesDefaultDayCycle() const { return mIsDefaultDayCycle; } + void setUsesDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; } LLSettingsDay::ptr_t getParcelDayCycle() const { return mDayCycle; } void setParcelDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; } diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 30b1d66634..fb9d8de053 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -315,49 +315,65 @@ namespace bool LLSettingsBase::validate() { - static Validator validateName(SETTING_NAME, false, LLSD::TypeString); - static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); - static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); - static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); validation_list_t validations = getValidationList(); - stringset_t validated; - stringset_t strip; if (!mSettings.has(SETTING_TYPE)) { mSettings[SETTING_TYPE] = getSettingType(); } + LLSD result = LLSettingsBase::settingValidation(mSettings, validations); + + if (result["errors"].size() > 0) + { + LL_WARNS("SETTINGS") << "Validation errors: " << result["errors"] << LL_ENDL; + } + if (result["warnings"].size() > 0) + { + LL_WARNS("SETTINGS") << "Validation warnings: " << result["errors"] << LL_ENDL; + } + + return result["success"].asBoolean(); +} + +LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &validations) +{ + static Validator validateName(SETTING_NAME, false, LLSD::TypeString); + static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); + static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); + static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); + stringset_t validated; + stringset_t strip; + bool isValid(true); + LLSD errors(LLSD::emptyArray()); + LLSD warnings(LLSD::emptyArray()); + // Fields common to all settings. - if (!validateName.verify(mSettings)) + if (!validateName.verify(settings)) { - LL_WARNS("SETTINGS") << "Unable to validate Name." << LL_ENDL; - mIsValid = false; - return false; + errors.append( LLSD::String("Unable to validate 'name'.") ); + isValid = false; } validated.insert(validateName.getName()); - if (!validateId.verify(mSettings)) + if (!validateId.verify(settings)) { - LL_WARNS("SETTINGS") << "Unable to validate Id." << LL_ENDL; - mIsValid = false; - return false; + errors.append( LLSD::String("Unable to validate 'id'.") ); + isValid = false; } validated.insert(validateId.getName()); - if (!validateHash.verify(mSettings)) + if (!validateHash.verify(settings)) { - LL_WARNS("SETTINGS") << "Unable to validate Hash." << LL_ENDL; - mIsValid = false; - return false; + errors.append( LLSD::String("Unable to validate 'hash'.") ); + isValid = false; } validated.insert(validateHash.getName()); - if (!validateType.verify(mSettings)) + if (!validateType.verify(settings)) { - LL_WARNS("SETTINGS") << "Unable to validate Type." << LL_ENDL; - mIsValid = false; - return false; + errors.append( LLSD::String("Unable to validate 'type'.") ); + isValid = false; } validated.insert(validateType.getName()); @@ -366,47 +382,54 @@ bool LLSettingsBase::validate() { #ifdef VALIDATION_DEBUG LLSD oldvalue; - if (mSettings.has((*itv).getName())) + if (settings.has((*itv).getName())) { oldvalue = llsd_clone(mSettings[(*itv).getName()]); } #endif - if (!(*itv).verify(mSettings)) + if (!(*itv).verify(settings)) { - LL_WARNS("SETTINGS") << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!" << LL_ENDL; - mIsValid = false; - return false; + std::stringstream errtext; + + errtext << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!"; + errors.append( errtext.str() ); + isValid = false; } validated.insert((*itv).getName()); #ifdef VALIDATION_DEBUG if (!oldvalue.isUndefined()) { - if (!compare_llsd(mSettings[(*itv).getName()], oldvalue)) + if (!compare_llsd(settings[(*itv).getName()], oldvalue)) { - LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << mSettings[(*itv).getName()] << LL_ENDL; + LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << settings[(*itv).getName()] << LL_ENDL; } } #endif } // strip extra entries - for (LLSD::map_iterator itm = mSettings.beginMap(); itm != mSettings.endMap(); ++itm) + for (LLSD::map_const_iterator itm = settings.beginMap(); itm != settings.endMap(); ++itm) { if (validated.find((*itm).first) == validated.end()) { - LL_WARNS("SETTINGS") << "Stripping setting '" << (*itm).first << "'" << LL_ENDL; + std::stringstream warntext; + + warntext << "Stripping setting '" << (*itm).first << "'"; + warnings.append( warntext.str() ); strip.insert((*itm).first); } } for (stringset_t::iterator its = strip.begin(); its != strip.end(); ++its) { - mSettings.erase(*its); + settings.erase(*its); } - return true; + return LLSDMap("success", LLSD::Boolean(isValid)) + ("errors", errors) + ("warnings", warnings); } //========================================================================= diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 0a20754ffb..fa5fb7a763 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -155,7 +155,6 @@ public: virtual bool validate(); -protected: class Validator { public: @@ -192,9 +191,14 @@ protected: }; typedef std::vector validation_list_t; + static LLSD settingValidation(LLSD &settings, validation_list_t &validations); +protected: + LLSettingsBase(); LLSettingsBase(const LLSD setting); + static LLSD settingValidation(LLSD settings); + typedef std::set stringset_t; // combining settings objects. Customize for specific setting types diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 4207df0924..c7d5c35c60 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -183,7 +183,7 @@ LLSD LLSettingsDay::getSettings() const return settings; } -void LLSettingsDay::initialize() +bool LLSettingsDay::initialize() { LLSD tracks = mSettings[SETTING_TRACKS]; LLSD frames = mSettings[SETTING_FRAMES]; @@ -194,21 +194,32 @@ void LLSettingsDay::initialize() { std::string name = (*itFrame).first; LLSD data = (*itFrame).second; + LLSettingsBase::ptr_t keyframe; if (data[SETTING_TYPE].asString() == "sky") { - used[name] = buildSky(data); + keyframe = buildSky(data); } else if (data[SETTING_TYPE].asString() == "water") { - used[name] = buildWater(data); + keyframe = buildWater(data); } else { LL_WARNS("DAYCYCLE") << "Unknown child setting type '" << data[SETTING_TYPE].asString() << "' named '" << name << "'" << LL_ENDL; } + if (!keyframe) + { + LL_WARNS("DAYCYCLE") << "Invalid frame data" << LL_ENDL; + continue; + } + + used[name] = keyframe; } + bool haswater(false); + bool hassky(false); + for (S32 i = 0; (i < tracks.size()) && (i < TRACK_MAX); ++i) { mDayTracks[i].clear(); @@ -246,15 +257,27 @@ void LLSettingsDay::initialize() } if (setting) + { + if (i == TRACK_WATER) + haswater |= true; + else + hassky |= true; mDayTracks[i][keyframe] = setting; + } } } + if (!haswater || !hassky) + { + LL_WARNS("DAYCYCLE") << "Must have at least one water and one sky frame!" << LL_ENDL; + return false; + } // these are no longer needed and just take up space now. mSettings.erase(SETTING_TRACKS); mSettings.erase(SETTING_FRAMES); mInitialized = true; + return true; } @@ -288,11 +311,14 @@ namespace value.erase(value.size() - 1); } + S32 framecount(0); + for (LLSD::array_iterator track = value.beginArray(); track != value.endArray(); ++track) { S32 index = 0; while (index < (*track).size()) { + ++framecount; if (index >= LLSettingsDay::FRAME_MAX) { (*track).erase(index); @@ -323,22 +349,100 @@ namespace } } + + framecount -= value[0].size(); + + if (value[0].size() < 1) + { + LL_WARNS("SETTINGS") << "Missing water track" << LL_ENDL; + return false; + } + + if (framecount < 1) + { + LL_WARNS("SETTINGS") << "Missing sky tracks" << LL_ENDL; + return false; + } + return true; + } + + bool validateDayCycleFrames(LLSD &value) + { + bool hasSky(false); + bool hasWater(false); + + for (LLSD::map_iterator itf = value.beginMap(); itf != value.endMap(); ++itf) + { + LLSD frame = (*itf).second; + + std::string ftype = frame[LLSettingsBase::SETTING_TYPE]; + if (ftype == "sky") + { + LLSettingsSky::validation_list_t valid_sky = LLSettingsSky::validationList(); + LLSD res_sky = LLSettingsSky::settingValidation(frame, valid_sky); + LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_sky << LL_ENDL; + //_WARNS("SETTINGS") << "success=" << res_sky["success"].asBoolean() << "(" << res_sky["success"].asInteger() << ") res=" << res_sky << LL_ENDL; + + if (res_sky["success"].asInteger() == 0) + { + LL_WARNS("SETTINGS") << "Sky setting named '" << (*itf).first << "' validation failed!: " << res_sky << LL_ENDL; + LL_WARNS("SETTINGS") << "Sky: " << frame << LL_ENDL; + continue; + } + hasSky |= true; + } + else if (ftype == "water") + { + LLSettingsWater::validation_list_t valid_h2o = LLSettingsWater::validationList(); + LLSD res_h2o = LLSettingsWater::settingValidation(frame, valid_h2o); + LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_h2o << LL_ENDL; + //_WARNS("SETTINGS") << "success=" << res_h2o["success"].asBoolean() << LL_ENDL; + if (res_h2o["success"].asInteger() == 0) + { + LL_WARNS("SETTINGS") << "Water setting named '" << (*itf).first << "' validation failed!: " << res_h2o << LL_ENDL; + LL_WARNS("SETTINGS") << "Water: " << frame << LL_ENDL; + continue; + } + hasWater |= true; + } + else + { + LL_WARNS("SETTINGS") << "Unknown settings block of type '" << ftype << "' named '" << (*itf).first << "'" << LL_ENDL; + return false; + } + } + + if (!hasSky) + { + LL_WARNS("SETTINGS") << "No skies defined." << LL_ENDL; + return false; + } + + if (!hasWater) + { + LL_WARNS("SETTINGS") << "No waters defined." << LL_ENDL; + return false; + } + return true; } } LLSettingsDay::validation_list_t LLSettingsDay::getValidationList() const +{ + return LLSettingsDay::validationList(); +} + +LLSettingsDay::validation_list_t LLSettingsDay::validationList() { static validation_list_t validation; if (validation.empty()) { - validation.push_back(Validator(SETTING_TRACKS, false, LLSD::TypeArray, + validation.push_back(Validator(SETTING_TRACKS, true, LLSD::TypeArray, &validateDayCycleTrack)); - validation.push_back(Validator(SETTING_FRAMES, false, LLSD::TypeMap)); - validation.push_back(Validator(SETTING_DAYLENGTH, false, LLSD::TypeInteger, - boost::bind(&Validator::verifyIntegerRange, _1, - LLSD(LLSDArray(LLSD::Integer(MINIMUM_DAYLENGTH))(LLSD::Integer(MAXIMUM_DAYLENGTH)))))); + validation.push_back(Validator(SETTING_FRAMES, true, LLSD::TypeMap, + &validateDayCycleFrames)); } return validation; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index ae47a54270..b3cf53869f 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -61,7 +61,7 @@ public: typedef std::map CycleTrack_t; typedef std::vector CycleList_t; - typedef boost::shared_ptr ptr_t; + typedef boost::shared_ptr ptr_t; typedef std::vector TimeList_t; typedef std::vector KeyframeList_t; typedef std::pair TrackBound_t; @@ -70,7 +70,7 @@ public: LLSettingsDay(const LLSD &data); virtual ~LLSettingsDay() { }; - void initialize(); + bool initialize(); virtual ptr_t buildClone() = 0; virtual LLSD getSettings() const; @@ -136,13 +136,14 @@ public: void setInitialized(bool value = true) { mInitialized = value; } CycleTrack_t & getCycleTrack(S32 track); + + virtual validation_list_t getValidationList() const; + static validation_list_t validationList(); protected: LLSettingsDay(); virtual void updateSettings(); - virtual validation_list_t getValidationList() const; - bool mInitialized; private: diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 7fc9d83cae..14024cf4f7 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -145,6 +145,11 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const } LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const +{ + return LLSettingsSky::validationList(); +} + +LLSettingsSky::validation_list_t LLSettingsSky::validationList() { static validation_list_t validation; diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 12ea237ef3..d36de571f6 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -409,6 +409,9 @@ public: return mTotalAmbient; } + virtual validation_list_t getValidationList() const; + static validation_list_t validationList(); + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -418,8 +421,6 @@ protected: virtual stringset_t getSlerpKeys() const; - virtual validation_list_t getValidationList() const; - virtual void updateSettings(); static LLSD translateLegacySettings(LLSD legacy); diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 00f870bbb0..67a9cd39cb 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -168,6 +168,11 @@ void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) } LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const +{ + return LLSettingsWater::validationList(); +} + +LLSettingsWater::validation_list_t LLSettingsWater::validationList() { static validation_list_t validation; diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index d18caf68b1..94e5583fd7 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -198,6 +198,9 @@ public: return mWaterFogKS; } + virtual validation_list_t getValidationList() const; + static validation_list_t validationList(); + protected: static const std::string SETTING_LEGACY_BLUR_MULTIPILER; static const std::string SETTING_LEGACY_FOG_COLOR; @@ -214,8 +217,6 @@ protected: LLSettingsWater(); - virtual validation_list_t getValidationList() const; - static LLSD translateLegacySettings(LLSD legacy); LLVector4 mWaterPlane; -- cgit v1.2.3 From 536aeb54a6130f3d1e20405c8f6cbd29201de26d Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 23 Jan 2018 17:34:25 -0800 Subject: MAINT-8052: One more step towards parcel environments. --- indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsdaycycle.h | 29 ++++++++--------------------- indra/llinventory/llsettingssky.cpp | 2 ++ indra/llinventory/llsettingssky.h | 4 ++-- indra/llinventory/llsettingswater.cpp | 2 ++ indra/llinventory/llsettingswater.h | 4 ++-- 6 files changed, 17 insertions(+), 26 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index fb9d8de053..a35504e0e6 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -251,7 +251,7 @@ LLSD LLSettingsBase::getSettings() const LLSD LLSettingsBase::cloneSettings() const { - return combineSDMaps(mSettings, LLSD()); + return combineSDMaps(getSettings(), LLSD()); } size_t LLSettingsBase::getHash() const diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index b3cf53869f..4a7bc02871 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -84,25 +84,6 @@ public: static LLSD defaults(); //--------------------------------------------------------------------- - S64Seconds getDayLength() const - { - return mDayLength; - } - - void setDayLength(S64Seconds seconds) - { - mDayLength = seconds; - } - - S64Seconds getDayOffset() const - { - return mDayOffset; - } - - void setDayOffset(S64Seconds seconds) - { - mDayOffset = seconds; - } KeyframeList_t getTrackKeyframes(S32 track); TimeList_t getTrackTimes(S32 track); @@ -139,6 +120,12 @@ public: virtual validation_list_t getValidationList() const; static validation_list_t validationList(); + + S64Seconds getDayLength() const { return mDayLength; } + void setDayLength(S64Seconds val ) { mDayLength = val; } + S64Seconds getDayOffset() const { return mDayOffset; } + void setDayOffset(S64Seconds val) { mDayOffset = val; } + protected: LLSettingsDay(); @@ -157,8 +144,8 @@ private: F64Seconds mLastUpdateTime; - S64Seconds mDayLength; - S64Seconds mDayOffset; + S64Seconds mDayLength; + S64Seconds mDayOffset; F32 secondsToKeyframe(S64Seconds seconds); F64Seconds keyframeToSeconds(F32 keyframe); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 14024cf4f7..c02d99fb67 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -270,6 +270,8 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! dfltsetting[SETTING_SUN_TEXUTUREID] = IMG_SUN; // gSunTextureID; + dfltsetting[SETTING_TYPE] = "sky"; + return dfltsetting; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index d36de571f6..9947ffc022 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -412,6 +412,8 @@ public: virtual validation_list_t getValidationList() const; static validation_list_t validationList(); + static LLSD translateLegacySettings(LLSD legacy); + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -423,8 +425,6 @@ protected: virtual void updateSettings(); - static LLSD translateLegacySettings(LLSD legacy); - private: static const F32 NIGHTTIME_ELEVATION; static const F32 NIGHTTIME_ELEVATION_COS; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 67a9cd39cb..0fe3de44d3 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -100,6 +100,8 @@ LLSD LLSettingsWater::defaults() dfltsetting[SETTING_WAVE1_DIR] = LLVector2(1.04999f, -0.42000f).getValue(); dfltsetting[SETTING_WAVE2_DIR] = LLVector2(1.10999f, -1.16000f).getValue(); + dfltsetting[SETTING_TYPE] = "water"; + return dfltsetting; } diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 94e5583fd7..4c61e2a34c 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -201,6 +201,8 @@ public: virtual validation_list_t getValidationList() const; static validation_list_t validationList(); + static LLSD translateLegacySettings(LLSD legacy); + protected: static const std::string SETTING_LEGACY_BLUR_MULTIPILER; static const std::string SETTING_LEGACY_FOG_COLOR; @@ -217,8 +219,6 @@ protected: LLSettingsWater(); - static LLSD translateLegacySettings(LLSD legacy); - LLVector4 mWaterPlane; F32 mWaterFogKS; -- cgit v1.2.3 From fbd8a98300277bdbc1885c25eea290560fd8c6c1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 25 Jan 2018 17:21:25 -0800 Subject: Selects correct day cycle. Fix an error validating legacy daycycles. --- indra/llinventory/llparcel.cpp | 10 ++++++++++ indra/llinventory/llparcel.h | 20 ++++++++++++-------- indra/llinventory/llsettingsdaycycle.cpp | 3 +-- 3 files changed, 23 insertions(+), 10 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index f53ef5e0ff..411c35ed6b 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -236,6 +236,7 @@ void LLParcel::init(const LLUUID &owner_id, mDayOffset = S64Seconds(LLSettingsDay::DEFAULT_DAYOFFSET); mIsDefaultDayCycle = true; mDayCycle.reset(); + mDayCycleHash = 0; } void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned) @@ -1272,3 +1273,12 @@ U32 LLParcel::countExperienceKeyType( U32 type ) boost::end(mExperienceKeys | boost::adaptors::map_values), std::bind2nd(std::equal_to(), type)); } + +void LLParcel::clearParcelDayCycleInfo() +{ + mDayLength = S64Seconds(LLSettingsDay::DEFAULT_DAYLENGTH); + mDayOffset = S64Seconds(LLSettingsDay::DEFAULT_DAYOFFSET); + mIsDefaultDayCycle = true; + mDayCycle.reset(); + mDayCycleHash = 0; +} diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 7b4647cc5f..6bbd5a949d 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -591,14 +591,17 @@ public: BOOL getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; } BOOL getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) ? TRUE : FALSE; } - S64Seconds getDayLength() const { return mDayLength; } - void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; } - S64Seconds getDayOffset() const { return mDayOffset; } - void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; } - bool getUsesDefaultDayCycle() const { return mIsDefaultDayCycle; } - void setUsesDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; } - LLSettingsDay::ptr_t getParcelDayCycle() const { return mDayCycle; } - void setParcelDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; } + S64Seconds getDayLength() const { return mDayLength; } + void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; } + S64Seconds getDayOffset() const { return mDayOffset; } + void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; } + bool getUsesDefaultDayCycle() const { return mIsDefaultDayCycle; } + void setUsesDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; } + LLSettingsDay::ptr_t getParcelDayCycle() const { return mDayCycle; } + void setParcelDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; } + size_t getParcelDayCycleHash() const { return mDayCycleHash; } + void setParcelDayCycleHash(size_t hash) { mDayCycleHash = hash; } + void clearParcelDayCycleInfo(); protected: LLUUID mID; @@ -678,6 +681,7 @@ protected: S64Seconds mDayOffset; bool mIsDefaultDayCycle; LLSettingsDay::ptr_t mDayCycle; + size_t mDayCycleHash; public: // HACK, make private diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index c7d5c35c60..1b992ff313 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -376,12 +376,12 @@ namespace LLSD frame = (*itf).second; std::string ftype = frame[LLSettingsBase::SETTING_TYPE]; + LL_WARNS("LAPRAS") << "Validating frame: " << frame << LL_ENDL; if (ftype == "sky") { LLSettingsSky::validation_list_t valid_sky = LLSettingsSky::validationList(); LLSD res_sky = LLSettingsSky::settingValidation(frame, valid_sky); LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_sky << LL_ENDL; - //_WARNS("SETTINGS") << "success=" << res_sky["success"].asBoolean() << "(" << res_sky["success"].asInteger() << ") res=" << res_sky << LL_ENDL; if (res_sky["success"].asInteger() == 0) { @@ -396,7 +396,6 @@ namespace LLSettingsWater::validation_list_t valid_h2o = LLSettingsWater::validationList(); LLSD res_h2o = LLSettingsWater::settingValidation(frame, valid_h2o); LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_h2o << LL_ENDL; - //_WARNS("SETTINGS") << "success=" << res_h2o["success"].asBoolean() << LL_ENDL; if (res_h2o["success"].asInteger() == 0) { LL_WARNS("SETTINGS") << "Water setting named '" << (*itf).first << "' validation failed!: " << res_h2o << LL_ENDL; -- cgit v1.2.3 From 0bf50e2f8cfa5f3ccd6165ce935cf0fd9c174ced Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 30 Jan 2018 16:42:34 -0800 Subject: Cleanup on daycyle selection and stack. Move blenders into environment. (Transition bronken, instant only. Shaddows moved based on region, not parcel) --- indra/llinventory/llparcel.cpp | 15 --- indra/llinventory/llparcel.h | 16 ---- indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsbase.h | 17 +--- indra/llinventory/llsettingsdaycycle.cpp | 160 ++----------------------------- indra/llinventory/llsettingsdaycycle.h | 50 ++-------- indra/llinventory/llsettingssky.cpp | 2 +- 7 files changed, 21 insertions(+), 241 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 411c35ed6b..0908613c10 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -231,12 +231,6 @@ void LLParcel::init(const LLUUID &owner_id, setAllowGroupAVSounds(TRUE); setAllowAnyAVSounds(TRUE); setHaveNewParcelLimitData(FALSE); - - mDayLength = S64Seconds(LLSettingsDay::DEFAULT_DAYLENGTH); - mDayOffset = S64Seconds(LLSettingsDay::DEFAULT_DAYOFFSET); - mIsDefaultDayCycle = true; - mDayCycle.reset(); - mDayCycleHash = 0; } void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned) @@ -1273,12 +1267,3 @@ U32 LLParcel::countExperienceKeyType( U32 type ) boost::end(mExperienceKeys | boost::adaptors::map_values), std::bind2nd(std::equal_to(), type)); } - -void LLParcel::clearParcelDayCycleInfo() -{ - mDayLength = S64Seconds(LLSettingsDay::DEFAULT_DAYLENGTH); - mDayOffset = S64Seconds(LLSettingsDay::DEFAULT_DAYOFFSET); - mIsDefaultDayCycle = true; - mDayCycle.reset(); - mDayCycleHash = 0; -} diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 6bbd5a949d..6ef389d246 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -590,18 +590,6 @@ public: LLUUID getPreviousOwnerID() const { return mPreviousOwnerID; } BOOL getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; } BOOL getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) ? TRUE : FALSE; } - - S64Seconds getDayLength() const { return mDayLength; } - void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; } - S64Seconds getDayOffset() const { return mDayOffset; } - void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; } - bool getUsesDefaultDayCycle() const { return mIsDefaultDayCycle; } - void setUsesDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; } - LLSettingsDay::ptr_t getParcelDayCycle() const { return mDayCycle; } - void setParcelDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; } - size_t getParcelDayCycleHash() const { return mDayCycleHash; } - void setParcelDayCycleHash(size_t hash) { mDayCycleHash = hash; } - void clearParcelDayCycleInfo(); protected: LLUUID mID; @@ -677,11 +665,7 @@ protected: BOOL mAllowGroupAVSounds; BOOL mAllowAnyAVSounds; - S64Seconds mDayLength; - S64Seconds mDayOffset; bool mIsDefaultDayCycle; - LLSettingsDay::ptr_t mDayCycle; - size_t mDayCycleHash; public: // HACK, make private diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index a35504e0e6..ffeae8677f 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -592,12 +592,12 @@ void LLSettingsBlender::update(F64Seconds timedelta) { LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon mOnFinished(shared_from_this()); - mOnFinished.disconnect_all_slots(); // prevent from firing more than once. return; } F64 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); + //_WARNS("LAPRAS") << "blending at " << (blendf * 100.0f) << "%" << LL_ENDL; mTarget->replaceSettings(mInitial->getSettings()); mTarget->blend(mFinal, blendf); } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index fa5fb7a763..f5146b1c27 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -253,7 +253,6 @@ public: mFinal(endsetting), mSeconds(seconds), mOnFinished(), - mBlendThreshold(DEFAULT_THRESHOLD), mLastUpdate(0.0f), mTimeSpent(0.0f) { @@ -264,11 +263,11 @@ public: ~LLSettingsBlender() {} - void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 seconds ) + void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds ) { mInitial = initsetting; mFinal = endsetting; - mSeconds.value(seconds); + mSeconds = seconds; mTarget->replaceSettings(mInitial->getSettings()); mTimeStart.value(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; @@ -280,16 +279,6 @@ public: return mOnFinished.connect(onfinished); } - void setUpdateThreshold(F64Seconds threshold) - { - mBlendThreshold = threshold; - } - - F64Seconds getUpdateThreshold() const - { - return mBlendThreshold; - } - LLSettingsBase::ptr_t getTarget() const { return mTarget; @@ -306,13 +295,13 @@ public: } void update(F64Seconds time); + private: LLSettingsBase::ptr_t mTarget; LLSettingsBase::ptr_t mInitial; LLSettingsBase::ptr_t mFinal; F64Seconds mSeconds; finish_signal_t mOnFinished; - F64Seconds mBlendThreshold; F64Seconds mLastUpdate; F64Seconds mTimeSpent; F64Seconds mTimeStart; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 1b992ff313..9b0a6c1127 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -96,7 +96,6 @@ namespace } //========================================================================= -const std::string LLSettingsDay::SETTING_DAYLENGTH("day_length"); const std::string LLSettingsDay::SETTING_KEYID("key_id"); const std::string LLSettingsDay::SETTING_KEYNAME("key_name"); const std::string LLSettingsDay::SETTING_KEYKFRAME("key_keyframe"); @@ -104,13 +103,13 @@ const std::string LLSettingsDay::SETTING_KEYHASH("key_hash"); const std::string LLSettingsDay::SETTING_TRACKS("tracks"); const std::string LLSettingsDay::SETTING_FRAMES("frames"); -const S64 LLSettingsDay::MINIMUM_DAYLENGTH( 300); // 5 mins -const S64 LLSettingsDay::DEFAULT_DAYLENGTH( 14400); // 4 hours -const S64 LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days +const S64Seconds LLSettingsDay::MINIMUM_DAYLENGTH(300); // 5 mins +const S64Seconds LLSettingsDay::DEFAULT_DAYLENGTH(14400); // 4 hours +const S64Seconds LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days -const S32 LLSettingsDay::MINIMUM_DAYOFFSET( 0); -const S32 LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset) -const S32 LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours +const S64Seconds LLSettingsDay::MINIMUM_DAYOFFSET(0); +const S64Seconds LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset) +const S64Seconds LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water @@ -119,18 +118,14 @@ const S32 LLSettingsDay::FRAME_MAX(56); //========================================================================= LLSettingsDay::LLSettingsDay(const LLSD &data) : LLSettingsBase(data), - mInitialized(false), - mDayLength(DEFAULT_DAYLENGTH), - mDayOffset(DEFAULT_DAYOFFSET) + mInitialized(false) { mDayTracks.resize(TRACK_MAX); } LLSettingsDay::LLSettingsDay() : LLSettingsBase(), - mInitialized(false), - mDayLength(DEFAULT_DAYLENGTH), - mDayOffset(DEFAULT_DAYOFFSET) + mInitialized(false) { mDayTracks.resize(TRACK_MAX); } @@ -287,7 +282,6 @@ LLSD LLSettingsDay::defaults() LLSD dfltsetting; dfltsetting[SETTING_NAME] = "_default_"; - dfltsetting[SETTING_DAYLENGTH] = static_cast(MINIMUM_DAYLENGTH); dfltsetting[SETTING_TRACKS] = LLSDArray( LLSDArray(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_")) (LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_"))); @@ -376,12 +370,10 @@ namespace LLSD frame = (*itf).second; std::string ftype = frame[LLSettingsBase::SETTING_TYPE]; - LL_WARNS("LAPRAS") << "Validating frame: " << frame << LL_ENDL; if (ftype == "sky") { LLSettingsSky::validation_list_t valid_sky = LLSettingsSky::validationList(); LLSD res_sky = LLSettingsSky::settingValidation(frame, valid_sky); - LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_sky << LL_ENDL; if (res_sky["success"].asInteger() == 0) { @@ -395,7 +387,6 @@ namespace { LLSettingsWater::validation_list_t valid_h2o = LLSettingsWater::validationList(); LLSD res_h2o = LLSettingsWater::settingValidation(frame, valid_h2o); - LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_h2o << LL_ENDL; if (res_h2o["success"].asInteger() == 0) { LL_WARNS("SETTINGS") << "Water setting named '" << (*itf).first << "' validation failed!: " << res_h2o << LL_ENDL; @@ -456,23 +447,6 @@ LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track) return mDayTracks[track]; } -//========================================================================= -F32 LLSettingsDay::secondsToKeyframe(S64Seconds seconds) -{ - S64Seconds daylength = getDayLength(); - S64Seconds dayoffset = getDayOffset(); - - return llclamp(static_cast((seconds.value() + dayoffset.value()) % daylength.value()) / static_cast(daylength.value()), 0.0f, 1.0f); -} - -F64Seconds LLSettingsDay::keyframeToSeconds(F32 keyframe) -{ - S64Seconds daylength = getDayLength(); - S64Seconds dayoffset = getDayOffset(); - - return F64Seconds(static_cast(keyframe * static_cast(daylength.value())) - dayoffset.value()); -} - //========================================================================= void LLSettingsDay::startDayCycle() { @@ -484,63 +458,11 @@ void LLSettingsDay::startDayCycle() return; } - // water - if (mDayTracks[0].empty()) - { - mBlendedWater.reset(); - mWaterBlender.reset(); - } - else if (mDayTracks[0].size() == 1) - { - mBlendedWater = boost::static_pointer_cast((*(mDayTracks[0].begin())).second); - mWaterBlender.reset(); - } - else - { - TrackBound_t bounds = getBoundingEntries(mDayTracks[0], now); - - F64Seconds timespan = F64Seconds( getDayLength() * get_wrapping_distance((*bounds.first).first, (*bounds.second).first)); - - mBlendedWater = getDefaultWater(); - mWaterBlender = boost::make_shared(mBlendedWater, - (*bounds.first).second, (*bounds.second).second, timespan); - mWaterBlender->setOnFinished(boost::bind(&LLSettingsDay::onWaterTransitionDone, this, _1)); - } - - // sky - if (mDayTracks[1].empty()) - { - mBlendedSky.reset(); - mSkyBlender.reset(); - } - else if (mDayTracks[1].size() == 1) - { - mBlendedSky = boost::static_pointer_cast( (*(mDayTracks[1].begin())).second); - mSkyBlender.reset(); - } - else - { - TrackBound_t bounds = getBoundingEntries(mDayTracks[1], now); - F64Seconds timespan = F64Seconds(getDayLength() * get_wrapping_distance((*bounds.first).first, (*bounds.second).first)); - - mBlendedSky = getDefaultSky(); - mSkyBlender = boost::make_shared(mBlendedSky, - (*bounds.first).second, (*bounds.second).second, timespan); - mSkyBlender->setOnFinished(boost::bind(&LLSettingsDay::onSkyTransitionDone, this, 1, _1)); - } } void LLSettingsDay::updateSettings() { - static LLFrameTimer timer; - - F64Seconds delta(timer.getElapsedTimeAndResetF32()); - - if (mSkyBlender) - mSkyBlender->update(delta); - if (mWaterBlender) - mWaterBlender->update(delta); } //========================================================================= @@ -565,30 +487,6 @@ LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) return keyframes; } -LLSettingsDay::TimeList_t LLSettingsDay::getTrackTimes(S32 trackno) -{ - KeyframeList_t keyframes = getTrackKeyframes(trackno); - - if (keyframes.empty()) - return TimeList_t(); - - TimeList_t times; - - times.reserve(keyframes.size()); - for (KeyframeList_t::iterator it = keyframes.begin(); it != keyframes.end(); ++it) - { - times.push_back(keyframeToSeconds(*it)); - } - - return times; -} - -void LLSettingsDay::setWaterAtTime(const LLSettingsWaterPtr_t &water, S64Seconds seconds) -{ - F32 keyframe = secondsToKeyframe(seconds); - setWaterAtKeyframe(water, keyframe); -} - void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe) { mDayTracks[TRACK_WATER][llclamp(keyframe, 0.0f, 1.0f)] = water; @@ -596,12 +494,6 @@ void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 ke } -void LLSettingsDay::setSkyAtTime(const LLSettingsSkyPtr_t &sky, S64Seconds seconds, S32 track) -{ - F32 keyframe = secondsToKeyframe(seconds); - setSkyAtKeyframe(sky, keyframe, track); -} - void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track) { if ((track < 1) || (track >= TRACK_MAX)) @@ -619,40 +511,4 @@ LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::Cyc return TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); } -LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F64Seconds time) -{ - F32 frame = secondsToKeyframe(time); - - return getBoundingEntries(track, frame); -} - //========================================================================= -void LLSettingsDay::onSkyTransitionDone(S32 track, const LLSettingsBlender::ptr_t &blender) -{ - F64Seconds now(LLDate::now().secondsSinceEpoch()); - TrackBound_t bounds = getBoundingEntries(mDayTracks[track], now); - - F32 distance = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); - F64Seconds timespan = F64Seconds(distance * getDayLength()); - - LL_DEBUGS("DAYCYCLE") << "New sky blender. now=" << now << - " start=" << (*bounds.first).first << " end=" << (*bounds.second).first << - " span=" << timespan << LL_ENDL; - - mSkyBlender = boost::make_shared(mBlendedSky, - (*bounds.first).second, (*bounds.second).second, timespan); - mSkyBlender->setOnFinished(boost::bind(&LLSettingsDay::onSkyTransitionDone, this, track, _1)); -} - -void LLSettingsDay::onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender) -{ - F64Seconds now(LLDate::now().secondsSinceEpoch()); - TrackBound_t bounds = getBoundingEntries(mDayTracks[0], now); - - F32 distance = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); - F64Seconds timespan = F64Seconds(distance * getDayLength()); - - mWaterBlender = boost::make_shared(mBlendedWater, - (*bounds.first).second, (*bounds.second).second, timespan); - mWaterBlender->setOnFinished(boost::bind(&LLSettingsDay::onWaterTransitionDone, this, _1)); -} diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 4a7bc02871..8a1634d674 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -39,7 +39,6 @@ typedef boost::shared_ptr LLSettingsSkyPtr_t; class LLSettingsDay : public LLSettingsBase { public: - static const std::string SETTING_DAYLENGTH; static const std::string SETTING_KEYID; static const std::string SETTING_KEYNAME; static const std::string SETTING_KEYKFRAME; @@ -47,13 +46,13 @@ public: static const std::string SETTING_TRACKS; static const std::string SETTING_FRAMES; - static const S64 MINIMUM_DAYLENGTH; - static const S64 DEFAULT_DAYLENGTH; - static const S64 MAXIMUM_DAYLENGTH; + static const S64Seconds MINIMUM_DAYLENGTH; + static const S64Seconds DEFAULT_DAYLENGTH; + static const S64Seconds MAXIMUM_DAYLENGTH; - static const S32 MINIMUM_DAYOFFSET; - static const S32 DEFAULT_DAYOFFSET; - static const S32 MAXIMUM_DAYOFFSET; + static const S64Seconds MINIMUM_DAYOFFSET; + static const S64Seconds DEFAULT_DAYOFFSET; + static const S64Seconds MAXIMUM_DAYOFFSET; static const S32 TRACK_WATER; static const S32 TRACK_MAX; @@ -62,7 +61,6 @@ public: typedef std::map CycleTrack_t; typedef std::vector CycleList_t; typedef boost::shared_ptr ptr_t; - typedef std::vector TimeList_t; typedef std::vector KeyframeList_t; typedef std::pair TrackBound_t; @@ -86,26 +84,12 @@ public: //--------------------------------------------------------------------- KeyframeList_t getTrackKeyframes(S32 track); - TimeList_t getTrackTimes(S32 track); - void setWaterAtTime(const LLSettingsWaterPtr_t &water, S64Seconds seconds); void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe); - - void setSkyAtTime(const LLSettingsSkyPtr_t &sky, S64Seconds seconds, S32 track); void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track); //--------------------------------------------------------------------- void startDayCycle(); - LLSettingsSkyPtr_t getCurrentSky() const - { - return mBlendedSky; - } - - LLSettingsWaterPtr_t getCurrentWater() const - { - return mBlendedWater; - } - virtual LLSettingsSkyPtr_t getDefaultSky() const = 0; virtual LLSettingsWaterPtr_t getDefaultWater() const = 0; @@ -121,11 +105,6 @@ public: virtual validation_list_t getValidationList() const; static validation_list_t validationList(); - S64Seconds getDayLength() const { return mDayLength; } - void setDayLength(S64Seconds val ) { mDayLength = val; } - S64Seconds getDayOffset() const { return mDayOffset; } - void setDayOffset(S64Seconds val) { mDayOffset = val; } - protected: LLSettingsDay(); @@ -134,32 +113,19 @@ protected: bool mInitialized; private: - LLSettingsBlender::ptr_t mSkyBlender; // convert to [] for altitudes - LLSettingsBlender::ptr_t mWaterBlender; - - LLSettingsSkyPtr_t mBlendedSky; - LLSettingsWaterPtr_t mBlendedWater; - CycleList_t mDayTracks; F64Seconds mLastUpdateTime; - S64Seconds mDayLength; - S64Seconds mDayOffset; - - F32 secondsToKeyframe(S64Seconds seconds); - F64Seconds keyframeToSeconds(F32 keyframe); - void parseFromLLSD(LLSD &data); static CycleTrack_t::iterator getEntryAtOrBefore(CycleTrack_t &track, F32 keyframe); static CycleTrack_t::iterator getEntryAtOrAfter(CycleTrack_t &track, F32 keyframe); TrackBound_t getBoundingEntries(CycleTrack_t &track, F32 keyframe); - TrackBound_t getBoundingEntries(CycleTrack_t &track, F64Seconds time); - void onSkyTransitionDone(S32 track, const LLSettingsBlender::ptr_t &blender); - void onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender); +// void onSkyTransitionDone(S32 track, const LLSettingsBlender::ptr_t &blender); +// void onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender); }; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c02d99fb67..32b292e384 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -265,7 +265,7 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); - dfltsetting[SETTING_BLOOM_TEXTUREID] = LLUUID::null; + dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = LLUUID::null; dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! dfltsetting[SETTING_SUN_TEXUTUREID] = IMG_SUN; // gSunTextureID; -- cgit v1.2.3 From 148856721293c3fd4b7ec961aeecb9090c1dd189 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 30 Jan 2018 17:10:03 -0800 Subject: Unused function in llsettingsdaycycle --- indra/llinventory/llsettingsdaycycle.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 9b0a6c1127..3abf76175f 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -42,20 +42,6 @@ namespace LLTrace::BlockTimerStatHandle FTM_BLEND_WATERVALUES("Blending Water Environment"); LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERVALUES("Update Water Environment"); - inline F32 get_wrapping_distance(F32 begin, F32 end) - { - if (begin < end) - { - return end - begin; - } - else if (begin > end) - { - return 1.0 - (begin - end); - } - - return 0; - } - LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, F32 key) { if (collection.empty()) -- cgit v1.2.3 From f07e5ee2a4907b9488a67a13db794c770878e648 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 5 Feb 2018 15:12:23 -0800 Subject: Transitions between skys. 1 --- indra/llinventory/llsettingsbase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index f5146b1c27..073e4616a5 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -241,7 +241,7 @@ class LLSettingsBlender : public boost::enable_shared_from_this ptr_t; - typedef boost::signals2::signal finish_signal_t; + typedef boost::signals2::signal finish_signal_t; typedef boost::signals2::connection connection_t; static const F64Seconds DEFAULT_THRESHOLD; -- cgit v1.2.3 From 7838189843ff3b9c800e458b2452943edbc202ea Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 6 Feb 2018 17:27:56 -0800 Subject: boost->std & same level interp --- indra/llinventory/llsettingsbase.h | 9 ++++----- indra/llinventory/llsettingsdaycycle.h | 6 +++--- indra/llinventory/llsettingssky.cpp | 2 +- indra/llinventory/llsettingssky.h | 2 +- indra/llinventory/llsettingswater.cpp | 2 +- indra/llinventory/llsettingswater.h | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 073e4616a5..420bcb9943 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "llsd.h" @@ -44,7 +43,7 @@ #include "v3color.h" class LLSettingsBase : - public boost::enable_shared_from_this, + public std::enable_shared_from_this, private boost::noncopyable { friend class LLEnvironment; @@ -58,7 +57,7 @@ public: typedef std::map parammapping_t; - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; virtual ~LLSettingsBase() { }; @@ -237,10 +236,10 @@ private: }; -class LLSettingsBlender : public boost::enable_shared_from_this +class LLSettingsBlender : public std::enable_shared_from_this { public: - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; typedef boost::signals2::signal finish_signal_t; typedef boost::signals2::connection connection_t; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 8a1634d674..4c7ce011a1 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -33,8 +33,8 @@ class LLSettingsWater; class LLSettingsSky; -typedef boost::shared_ptr LLSettingsWaterPtr_t; -typedef boost::shared_ptr LLSettingsSkyPtr_t; +typedef std::shared_ptr LLSettingsWaterPtr_t; +typedef std::shared_ptr LLSettingsSkyPtr_t; class LLSettingsDay : public LLSettingsBase { @@ -60,7 +60,7 @@ public: typedef std::map CycleTrack_t; typedef std::vector CycleList_t; - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; typedef std::vector KeyframeList_t; typedef std::pair TrackBound_t; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 32b292e384..572b5703b3 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -98,7 +98,7 @@ LLSettingsSky::LLSettingsSky(): void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsSky::ptr_t other = boost::static_pointer_cast(end); + LLSettingsSky::ptr_t other = std::static_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 9947ffc022..e9ffbdb32c 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -62,7 +62,7 @@ public: static const std::string SETTING_SUN_ROTATION; static const std::string SETTING_SUN_TEXUTUREID; - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; typedef std::pair azimalt_t; //--------------------------------------------------------------------- diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 0fe3de44d3..a72cbc4136 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -163,7 +163,7 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsWater::ptr_t other = boost::static_pointer_cast(end); + LLSettingsWater::ptr_t other = std::static_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 4c61e2a34c..4d206a1be0 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -48,7 +48,7 @@ public: static const LLUUID DEFAULT_WATER_NORMAL_ID; - typedef boost::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; //--------------------------------------------------------------------- LLSettingsWater(const LLSD &data); -- cgit v1.2.3 From e9edd37cdb39639e1ab24e2e63d4f83432282c88 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 9 Feb 2018 10:10:13 -0800 Subject: Update a couple constructs --- indra/llinventory/llsettingsbase.cpp | 81 +++----------------------------- indra/llinventory/llsettingsdaycycle.cpp | 20 ++++---- 2 files changed, 16 insertions(+), 85 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index ffeae8677f..7ade345168 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -262,57 +262,6 @@ size_t LLSettingsBase::getHash() const return boost::hash{}(hash_settings); } -#ifdef VALIDATION_DEBUG -namespace -{ - bool compare_llsd(LLSD valA, LLSD valB) - { - if (valA.type() != valB.type()) - return false; - - switch (valA.type()) - { - // case LLSD::TypeMap: - // newSettings[key_name] = combineSDMaps(value, LLSD()); - // break; - case LLSD::TypeArray: - if (valA.size() != valB.size()) - return false; - - for (S32 idx = 0; idx < valA.size(); ++idx) - { - if (!compare_llsd(valA[idx], valB[idx])) - return false; - } - return true; - - case LLSD::TypeInteger: - return valA.asInteger() == valB.asInteger(); - - case LLSD::TypeReal: - return is_approx_equal(valA.asReal(), valB.asReal()); - - case LLSD::TypeBoolean: - return valA.asBoolean() == valB.asBoolean(); - - case LLSD::TypeString: - return valA.asString() == valB.asString(); - - case LLSD::TypeUUID: - return valA.asUUID() == valB.asUUID(); - - case LLSD::TypeURI: - return valA.asString() == valB.asString(); - - case LLSD::TypeDate: - return valA.asDate() == valB.asDate(); - } - - return true; - } -} -#endif - bool LLSettingsBase::validate() { validation_list_t validations = getValidationList(); @@ -378,35 +327,17 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida validated.insert(validateType.getName()); // Fields for specific settings. - for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) + for (auto &test: validations) { -#ifdef VALIDATION_DEBUG - LLSD oldvalue; - if (settings.has((*itv).getName())) - { - oldvalue = llsd_clone(mSettings[(*itv).getName()]); - } -#endif - - if (!(*itv).verify(settings)) + if (!test.verify(settings)) { std::stringstream errtext; - errtext << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!"; + errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!"; errors.append( errtext.str() ); isValid = false; } - validated.insert((*itv).getName()); - -#ifdef VALIDATION_DEBUG - if (!oldvalue.isUndefined()) - { - if (!compare_llsd(settings[(*itv).getName()], oldvalue)) - { - LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << settings[(*itv).getName()] << LL_ENDL; - } - } -#endif + validated.insert(test.getName()); } // strip extra entries @@ -422,9 +353,9 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } } - for (stringset_t::iterator its = strip.begin(); its != strip.end(); ++its) + for (const std::string &its: strip) { - settings.erase(*its); + settings.erase(its); } return LLSDMap("success", LLSD::Boolean(isValid)) diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 3abf76175f..a689dd3710 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -131,20 +131,20 @@ LLSD LLSettingsDay::getSettings() const LLSD tracks(LLSD::emptyArray()); - for (CycleList_t::const_iterator itTrack = mDayTracks.begin(); itTrack != mDayTracks.end(); ++itTrack) + for (auto &track: mDayTracks) { LLSD trackout(LLSD::emptyArray()); - for (CycleTrack_t::const_iterator itFrame = (*itTrack).begin(); itFrame != (*itTrack).end(); ++itFrame) + for (auto &frame: track) { - F32 frame = (*itFrame).first; - LLSettingsBase::ptr_t data = (*itFrame).second; + F32 frame_time = frame.first; + LLSettingsBase::ptr_t data = frame.second; size_t datahash = data->getHash(); std::stringstream keyname; keyname << datahash; - trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame))(SETTING_KEYNAME, keyname.str()))); + trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame_time))(SETTING_KEYNAME, keyname.str()))); in_use[keyname.str()] = data; } tracks.append(trackout); @@ -152,12 +152,12 @@ LLSD LLSettingsDay::getSettings() const settings[SETTING_TRACKS] = tracks; LLSD frames(LLSD::emptyMap()); - for (std::map::iterator itFrame = in_use.begin(); itFrame != in_use.end(); ++itFrame) + for (auto &used_frame: in_use) { - LLSD framesettings = llsd_clone((*itFrame).second->getSettings(), + LLSD framesettings = llsd_clone(used_frame.second->getSettings(), LLSDMap("*", true)(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)); - frames[(*itFrame).first] = framesettings; + frames[used_frame.first] = framesettings; } settings[SETTING_FRAMES] = frames; @@ -465,9 +465,9 @@ LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) keyframes.reserve(track.size()); - for (CycleTrack_t::iterator it = track.begin(); it != track.end(); ++it) + for (auto &frame: track) { - keyframes.push_back((*it).first); + keyframes.push_back(frame.first); } return keyframes; -- cgit v1.2.3 From 6cc4a091b3ba4dd4842cc06e3b34af3d04dc5796 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 22 Feb 2018 00:35:24 +0000 Subject: Add settings/validations for new advanced atmo settings. --- indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsbase.h | 1 + indra/llinventory/llsettingssky.cpp | 287 ++++++++++++++++++++++++++++++++++- indra/llinventory/llsettingssky.h | 30 +++- 4 files changed, 313 insertions(+), 7 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7ade345168..0918252fa0 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -333,7 +333,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida { std::stringstream errtext; - errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!"; + errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!\n"; errors.append( errtext.str() ); isValid = false; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 420bcb9943..4273e1d3a0 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -191,6 +191,7 @@ public: typedef std::vector validation_list_t; static LLSD settingValidation(LLSD &settings, validation_list_t &validations); + protected: LLSettingsBase(); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 572b5703b3..ff3f5224dd 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -79,12 +79,28 @@ const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id"); const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness"); const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color"); const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation"); -const std::string LLSettingsSky::SETTING_SUN_TEXUTUREID("sun_id"); +const std::string LLSettingsSky::SETTING_SUN_TEXTUREID("sun_id"); const std::string LLSettingsSky::SETTING_LEGACY_EAST_ANGLE("east_angle"); const std::string LLSettingsSky::SETTING_LEGACY_ENABLE_CLOUD_SCROLL("enable_cloud_scroll"); const std::string LLSettingsSky::SETTING_LEGACY_SUN_ANGLE("sun_angle"); +// these are new settings for the advanced atmospherics model +const std::string LLSettingsSky::SETTING_PLANET_RADIUS("planet_radius"); +const std::string LLSettingsSky::SETTING_SKY_BOTTOM_RADIUS("sky_bottom_radius"); +const std::string LLSettingsSky::SETTING_SKY_TOP_RADIUS("sky_top_radius"); +const std::string LLSettingsSky::SETTING_RAYLEIGH_CONFIG("rayleigh"); +const std::string LLSettingsSky::SETTING_MIE_CONFIG("mie"); +const std::string LLSettingsSky::SETTING_ABSORPTION_CONFIG("absorption"); +const std::string LLSettingsSky::KEY_DENSITY_PROFILE("density"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH("width"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM("exp_term"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_scale"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); +const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); +const std::string LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR("anisotropy"); +const std::string LLSettingsSky::SETTING_SUN_ARC_RADIANS("sun_arc_radians"); + //========================================================================= LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data) @@ -144,6 +160,78 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const return slepSet; } +LLSettingsSky::validation_list_t LLSettingsSky::rayleighValidationList() +{ + static validation_list_t rayleighValidation; + if (rayleighValidation.empty()) + { + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return rayleighValidation; +} + +LLSettingsSky::validation_list_t LLSettingsSky::absorptionValidationList() +{ + static validation_list_t absorptionValidation; + if (absorptionValidation.empty()) + { + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return absorptionValidation; +} + +LLSettingsSky::validation_list_t LLSettingsSky::mieValidationList() +{ + static validation_list_t mieValidation; + if (mieValidation.empty()) + { + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + + mieValidation.push_back(Validator(SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return mieValidation; +} + LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const { return LLSettingsSky::validationList(); @@ -224,7 +312,19 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_SUN_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); - validation.push_back(Validator(SETTING_SUN_TEXUTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID)); + + validation.push_back(Validator(SETTING_PLANET_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SKY_BOTTOM_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SKY_TOP_RADIUS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); + + validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); } return validation; @@ -268,13 +368,194 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = LLUUID::null; dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! - dfltsetting[SETTING_SUN_TEXUTUREID] = IMG_SUN; // gSunTextureID; + dfltsetting[SETTING_SUN_TEXTUREID] = IMG_SUN; // gSunTextureID; dfltsetting[SETTING_TYPE] = "sky"; + // defaults are for earth... + dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + + LLSD dflt_rayleigh; + dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + + dfltsetting[SETTING_RAYLEIGH_CONFIG] = dflt_rayleigh; + + LLSD dflt_mie; + dflt_mie[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; + dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR] = 0.9f; + + dfltsetting[SETTING_MIE_CONFIG] = dflt_mie; + + // absorption (ozone) has two linear ramping zones + LLSD dflt_absorption_a; + dflt_absorption_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere + dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; + dflt_absorption_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; + + LLSD dflt_absorption_b; + dflt_absorption_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere + dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; + dflt_absorption_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; + + LLSD wtf; + wtf.append(dflt_absorption_a); + wtf.append(dflt_absorption_b); + + dfltsetting[SETTING_ABSORPTION_CONFIG] = wtf; + return dfltsetting; } +#pragma optimize("", off) + +LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &validations) +{ + // Make a copy we can safely modify + LLSD settings = settingsIn; + + validation_list_t& rayleighValidations = rayleighValidationList(); + validation_list_t& absorptionValidations = absorptionValidationList(); + validation_list_t& mieValidations = mieValidationList(); + + bool isValid = true; + + LLSD& rayleighConfigs = settings[SETTING_RAYLEIGH_CONFIG]; + LLSD& mieConfigs = settings[SETTING_MIE_CONFIG]; + LLSD& absorptionConfigs = settings[SETTING_ABSORPTION_CONFIG]; + +// this is an attempt to handle a single defined layer (w/o array elem) +// but also handle an array of density profiles if they are specified thus. + if (rayleighConfigs.isArray()) + { + for (LLSD::array_iterator it = rayleighConfigs.beginArray(); it != rayleighConfigs.endArray(); ++it) + { + LLSD rayleighResults = LLSettingsBase::settingValidation(*it, rayleighValidations); + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD rayleighResults = LLSettingsBase::settingValidation(rayleighConfigs, rayleighValidations); + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + + if (mieConfigs.isArray()) + { + for (LLSD::array_iterator it = mieConfigs.beginArray(); it != mieConfigs.endArray(); ++it) + { + LLSD mieResults = LLSettingsBase::settingValidation(*it, mieValidations); + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD mieResults = LLSettingsBase::settingValidation(mieConfigs, mieValidations); + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + + if (absorptionConfigs.isArray()) + { + for (LLSD::array_iterator it = absorptionConfigs.beginArray(); it != absorptionConfigs.endArray(); ++it) + { + LLSD absorptionResults = LLSettingsBase::settingValidation(*it, absorptionValidations); + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + } + else + { + LLSD absorptionResults = LLSettingsBase::settingValidation(absorptionConfigs, absorptionValidations); + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + } + +#if 0 + LLSD& rayleigh = settings[SETTING_RAYLEIGH_CONFIG]; + LLSD& absorption = settings[SETTING_ABSORPTION_CONFIG]; + LLSD& mie = settings[SETTING_MIE_CONFIG]; + LLSD rayleighResults = LLSettingsBase::settingValidation(rayleigh, rayleighValidations); + LLSD absorptionResults = LLSettingsBase::settingValidation(absorption, absorptionValidations); + LLSD mieResults = LLSettingsBase::settingValidation(mie, mieValidations); + + if (!rayleighResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + + if (!absorptionResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } + + if (!mieResults["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; + LLSettingsSky::ptr_t(); + isValid = false; + } +#endif + + settings.erase(SETTING_RAYLEIGH_CONFIG); + settings.erase(SETTING_ABSORPTION_CONFIG); + settings.erase(SETTING_MIE_CONFIG); + + if (isValid) + { + return LLSettingsBase::settingValidation(settings, validations); + } + + return LLSDMap("success", LLSD::Boolean(false)); +} + +#pragma optimize("", on) + LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { LLSD newsettings(defaults()); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e9ffbdb32c..1d860016fb 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -60,7 +60,24 @@ public: static const std::string SETTING_STAR_BRIGHTNESS; static const std::string SETTING_SUNLIGHT_COLOR; static const std::string SETTING_SUN_ROTATION; - static const std::string SETTING_SUN_TEXUTUREID; + static const std::string SETTING_SUN_TEXTUREID; + + static const std::string SETTING_PLANET_RADIUS; + static const std::string SETTING_SKY_BOTTOM_RADIUS; + static const std::string SETTING_SKY_TOP_RADIUS; + static const std::string SETTING_SUN_ARC_RADIANS; + + static const std::string SETTING_RAYLEIGH_CONFIG; + static const std::string SETTING_MIE_CONFIG; + static const std::string SETTING_ABSORPTION_CONFIG; + + static const std::string KEY_DENSITY_PROFILE; + static const std::string SETTING_DENSITY_PROFILE_WIDTH; + static const std::string SETTING_DENSITY_PROFILE_EXP_TERM; + static const std::string SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR; + static const std::string SETTING_DENSITY_PROFILE_LINEAR_TERM; + static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; + static const std::string SETTING_MIE_ANISOTROPY_FACTOR; typedef std::shared_ptr ptr_t; typedef std::pair azimalt_t; @@ -345,7 +362,7 @@ public: LLUUID getSunTextureId() const { - return mSettings[SETTING_SUN_TEXUTUREID].asUUID(); + return mSettings[SETTING_SUN_TEXTUREID].asUUID(); } // Internal/calculated settings @@ -414,6 +431,8 @@ public: static LLSD translateLegacySettings(LLSD legacy); + static LLSD settingValidation(LLSD &settings, validation_list_t &validations); + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -423,9 +442,14 @@ protected: virtual stringset_t getSlerpKeys() const; - virtual void updateSettings(); + virtual void updateSettings(); private: + // validations for structured sections of sky settings data + static validation_list_t rayleighValidationList(); + static validation_list_t absorptionValidationList(); + static validation_list_t mieValidationList(); + static const F32 NIGHTTIME_ELEVATION; static const F32 NIGHTTIME_ELEVATION_COS; -- cgit v1.2.3 From b766466b3013e39831bcfcaef5d1089c07202afb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 26 Feb 2018 09:27:14 -0800 Subject: Added settings inventory object with subtype --- indra/llinventory/CMakeLists.txt | 1 + indra/llinventory/llinventorysettings.h | 43 ++++++++++++++++++++++++++++++++ indra/llinventory/llsettingsbase.cpp | 23 ++++++++++++++--- indra/llinventory/llsettingsbase.h | 29 +++++++++++++-------- indra/llinventory/llsettingsdaycycle.cpp | 1 + indra/llinventory/llsettingsdaycycle.h | 2 ++ indra/llinventory/llsettingssky.h | 4 ++- indra/llinventory/llsettingswater.h | 3 ++- 8 files changed, 90 insertions(+), 16 deletions(-) create mode 100644 indra/llinventory/llinventorysettings.h (limited to 'indra/llinventory') diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index 3eba746614..2d40dd6443 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -45,6 +45,7 @@ set(llinventory_HEADER_FILES llfoldertype.h llinventory.h llinventorydefines.h + llinventorysettings.h llinventorytype.h lllandmark.h llnotecard.h diff --git a/indra/llinventory/llinventorysettings.h b/indra/llinventory/llinventorysettings.h new file mode 100644 index 0000000000..0d15542fec --- /dev/null +++ b/indra/llinventory/llinventorysettings.h @@ -0,0 +1,43 @@ +/** +* @file llinventorysettings.h +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef LL_INVENTORY_SETTINGS_H +#define LL_INVENTORY_SETTINGS_H + + +enum class LLSettingsType +{ + ST_SKY = 0, + ST_WATER = 1, + ST_DAYCYCLE = 2, + + ST_INVALID = 255, + ST_NONE = -1 +}; + + +#endif diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7ade345168..3382716577 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -38,6 +38,14 @@ namespace const F64 BREAK_POINT = 0.5; } +//========================================================================= +std::ostream &::operator <<(std::ostream& os, LLSettingsBase &settings) +{ + LLSDSerialize::serialize(settings.getSettings(), os, LLSDSerialize::LLSD_NOTATION); + + return os; +} + //========================================================================= const std::string LLSettingsBase::SETTING_ID("id"); const std::string LLSettingsBase::SETTING_NAME("name"); @@ -49,13 +57,15 @@ const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); //========================================================================= LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), - mDirty(true) + mDirty(true), + mAssetID() { } LLSettingsBase::LLSettingsBase(const LLSD setting) : mSettings(setting), - mDirty(true) + mDirty(true), + mAssetID() { } @@ -368,8 +378,14 @@ bool LLSettingsBase::Validator::verify(LLSD &data) { if (!data.has(mName) || (data.has(mName) && data[mName].isUndefined())) { + if (!mDefault.isUndefined()) + { + LL_INFOS("SETTINGS") << "Inserting missing default for '" << mName << "'." << LL_ENDL; + data[mName] = mDefault; + return true; + } if (mRequired) - LL_WARNS("SETTINGS") << "Missing required setting '" << mName << "'" << LL_ENDL; + LL_WARNS("SETTINGS") << "Missing required setting '" << mName << "' with no default." << LL_ENDL; return !mRequired; } @@ -514,7 +530,6 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) } //========================================================================= - void LLSettingsBlender::update(F64Seconds timedelta) { mTimeSpent += timedelta; diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 420bcb9943..c7ed9e9e21 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -42,6 +42,8 @@ #include "v4color.h" #include "v3color.h" +#include "llinventorysettings.h" + class LLSettingsBase : public std::enable_shared_from_this, private boost::noncopyable @@ -49,6 +51,8 @@ class LLSettingsBase : friend class LLEnvironment; friend class LLSettingsDay; + friend std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings); + public: static const std::string SETTING_ID; static const std::string SETTING_NAME; @@ -64,6 +68,8 @@ public: //--------------------------------------------------------------------- virtual std::string getSettingType() const = 0; + virtual LLSettingsType getSettingTypeValue() const = 0; + //--------------------------------------------------------------------- // Settings status inline bool hasSetting(const std::string ¶m) const { return mSettings.has(param); } @@ -143,27 +149,28 @@ public: // Note this method is marked const but may modify the settings object. // (note the internal const cast). This is so that it may be called without // special consideration from getters. - inline void update() const + inline void update() const { if (!mDirty) return; (const_cast(this))->updateSettings(); } - virtual void blend(const ptr_t &end, F64 blendf) = 0; + virtual void blend(const ptr_t &end, F64 blendf) = 0; - virtual bool validate(); + virtual bool validate(); class Validator { public: typedef boost::function verify_pr; - Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr()) : + Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr(), LLSD defval = LLSD()) : mName(name), mRequired(required), mType(type), - mVerify(verify) + mVerify(verify), + mDefault(defval) { } std::string getName() const { return mName; } @@ -187,6 +194,7 @@ public: bool mRequired; LLSD::Type mType; verify_pr mVerify; + LLSD mDefault; }; typedef std::vector validation_list_t; @@ -223,15 +231,16 @@ protected: virtual parammapping_t getParameterMap() const { return parammapping_t(); } - LLSD mSettings; - bool mIsValid; + LLSD mSettings; + bool mIsValid; + LLAssetID mAssetID; - LLSD cloneSettings() const; + LLSD cloneSettings() const; private: - bool mDirty; + bool mDirty; - LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; + LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; }; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index a689dd3710..18add703cb 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -273,6 +273,7 @@ LLSD LLSettingsDay::defaults() (LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_"))); dfltsetting[SETTING_FRAMES] = LLSD::emptyMap(); + dfltsetting[SETTING_TYPE] = "daycycle"; return dfltsetting; } diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 4c7ce011a1..7703f7a0b4 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -72,6 +72,8 @@ public: virtual ptr_t buildClone() = 0; virtual LLSD getSettings() const; + virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_DAYCYCLE; } + //--------------------------------------------------------------------- virtual std::string getSettingType() const { return std::string("daycycle"); } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e9ffbdb32c..23daf0c5dc 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -72,7 +72,9 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const { return std::string("sky"); } + virtual std::string getSettingType() const override { return std::string("sky"); } + virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_SKY; } + // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf); diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 4d206a1be0..16d5b2353a 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -57,7 +57,8 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const { return std::string("water"); } + virtual std::string getSettingType() const override { return std::string("water"); } + virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_WATER; } // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf); -- cgit v1.2.3 From 87f56754556d9a7a3cf23f35c4ac163447799f98 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 27 Feb 2018 10:46:21 -0800 Subject: XCode now gets cranky about override (or lack there of) --- indra/llinventory/llsettingsdaycycle.h | 6 +++--- indra/llinventory/llsettingssky.h | 6 +++--- indra/llinventory/llsettingswater.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 7703f7a0b4..ce87e28367 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -71,7 +71,7 @@ public: bool initialize(); virtual ptr_t buildClone() = 0; - virtual LLSD getSettings() const; + virtual LLSD getSettings() const override; virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_DAYCYCLE; } @@ -104,13 +104,13 @@ public: void setInitialized(bool value = true) { mInitialized = value; } CycleTrack_t & getCycleTrack(S32 track); - virtual validation_list_t getValidationList() const; + virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); protected: LLSettingsDay(); - virtual void updateSettings(); + virtual void updateSettings() override; bool mInitialized; diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 23daf0c5dc..89186cf3a1 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -77,7 +77,7 @@ public: // Settings status - virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf); + virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) override; static LLSD defaults(); @@ -411,7 +411,7 @@ public: return mTotalAmbient; } - virtual validation_list_t getValidationList() const; + virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); static LLSD translateLegacySettings(LLSD legacy); @@ -425,7 +425,7 @@ protected: virtual stringset_t getSlerpKeys() const; - virtual void updateSettings(); + virtual void updateSettings() override; private: static const F32 NIGHTTIME_ELEVATION; diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 16d5b2353a..d4152acfa1 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -61,7 +61,7 @@ public: virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_WATER; } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf); + virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) override; static LLSD defaults(); @@ -199,7 +199,7 @@ public: return mWaterFogKS; } - virtual validation_list_t getValidationList() const; + virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); static LLSD translateLegacySettings(LLSD legacy); -- cgit v1.2.3 From edc12edaae2333810161fadc787920b252e5fec1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 27 Feb 2018 11:02:37 -0800 Subject: Missed two overrides. --- indra/llinventory/llsettingsdaycycle.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index ce87e28367..2d0fa4a840 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -76,10 +76,10 @@ public: //--------------------------------------------------------------------- - virtual std::string getSettingType() const { return std::string("daycycle"); } + virtual std::string getSettingType() const override { return std::string("daycycle"); } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix); + virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix) override; static LLSD defaults(); -- cgit v1.2.3 From 09a8b0e501bd0b204eceb43b7103bd1324302806 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 27 Feb 2018 12:27:21 -0800 Subject: Need to bring the mac in... --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 3382716577..901c8dbe8e 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -39,7 +39,7 @@ namespace } //========================================================================= -std::ostream &::operator <<(std::ostream& os, LLSettingsBase &settings) +std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings) { LLSDSerialize::serialize(settings.getSettings(), os, LLSDSerialize::LLSD_NOTATION); -- cgit v1.2.3 From 65cffb24e93ec12f1e5f4981c06df5610722eef1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 27 Feb 2018 13:01:45 -0800 Subject: More missing 'override's --- indra/llinventory/llsettingssky.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 89186cf3a1..3c6dbdb76d 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -423,7 +423,7 @@ protected: LLSettingsSky(); - virtual stringset_t getSlerpKeys() const; + virtual stringset_t getSlerpKeys() const override; virtual void updateSettings() override; -- cgit v1.2.3 From 72270213f5eebd019b10bdd6ec15020ba3d2ecf5 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 28 Feb 2018 21:46:30 +0000 Subject: Add 3p package for adv atmospherics to autobuild. Mark legacy atmospherics code with ifdefs. Fix up legacy uplift to include new atmospherics settings. --- indra/llinventory/llsettingsdaycycle.cpp | 54 +++++-- indra/llinventory/llsettingssky.cpp | 237 +++++++++++++++++++++---------- indra/llinventory/llsettingssky.h | 112 ++++++++------- 3 files changed, 264 insertions(+), 139 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index a689dd3710..409fcf28e3 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -268,10 +268,27 @@ LLSD LLSettingsDay::defaults() LLSD dfltsetting; dfltsetting[SETTING_NAME] = "_default_"; - dfltsetting[SETTING_TRACKS] = LLSDArray( - LLSDArray(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_")) - (LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f))(SETTING_KEYNAME, "_default_"))); - dfltsetting[SETTING_FRAMES] = LLSD::emptyMap(); + + LLSD waterTrack; + waterTrack[SETTING_KEYKFRAME] = 0.0f; + waterTrack[SETTING_KEYNAME] = "_default_"; + + LLSD skyTrack; + skyTrack[SETTING_KEYKFRAME] = 0.0f; + skyTrack[SETTING_KEYNAME] = "_default_"; + + LLSD tracks; + tracks.append(LLSDArray(waterTrack)); + tracks.append(LLSDArray(skyTrack)); + + dfltsetting[SETTING_TRACKS] = tracks; + + LLSD frames(LLSD::emptyMap()); + + frames["water:_defaults_"] = LLSettingsWater::defaults(); + frames["sky:_defaults_"] = LLSettingsSky::defaults(); + + dfltsetting[SETTING_FRAMES] = frames; return dfltsetting; } @@ -281,6 +298,8 @@ void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F64 mix) LL_ERRS("DAYCYCLE") << "Day cycles are not blendable!" << LL_ENDL; } +#pragma optimize("", off) + namespace { bool validateDayCycleTrack(LLSD &value) @@ -298,6 +317,8 @@ namespace S32 index = 0; while (index < (*track).size()) { + LLSD& elem = (*track)[index]; + ++framecount; if (index >= LLSettingsDay::FRAME_MAX) { @@ -305,40 +326,46 @@ namespace continue; } - if (!(*track)[index].has(LLSettingsDay::SETTING_KEYKFRAME) || - !(*track)[index][LLSettingsDay::SETTING_KEYKFRAME].isReal()) + if (!elem.has(LLSettingsDay::SETTING_KEYKFRAME)) + { + (*track).erase(index); + continue; + } + + if (!elem[LLSettingsDay::SETTING_KEYKFRAME].isReal()) { (*track).erase(index); continue; } - if (!(*track)[index].has(LLSettingsDay::SETTING_KEYNAME) && - !(*track)[index].has(LLSettingsDay::SETTING_KEYID)) + if (!elem.has(LLSettingsDay::SETTING_KEYNAME) && + !elem.has(LLSettingsDay::SETTING_KEYID)) { (*track).erase(index); continue; } - F32 frame = (*track)[index][LLSettingsDay::SETTING_KEYKFRAME].asReal(); + F32 frame = elem[LLSettingsDay::SETTING_KEYKFRAME].asReal(); if ((frame < 0.0) || (frame > 1.0)) { frame = llclamp(frame, 0.0f, 1.0f); - (*track)[index][LLSettingsDay::SETTING_KEYKFRAME] = frame; + elem[LLSettingsDay::SETTING_KEYKFRAME] = frame; } ++index; } } - framecount -= value[0].size(); + int waterTracks = value[0].size(); + int skyTracks = framecount - waterTracks; - if (value[0].size() < 1) + if (waterTracks < 1) { LL_WARNS("SETTINGS") << "Missing water track" << LL_ENDL; return false; } - if (framecount < 1) + if (skyTracks < 1) { LL_WARNS("SETTINGS") << "Missing sky tracks" << LL_ENDL; return false; @@ -404,6 +431,7 @@ namespace } } +#pragma optimize("", on) LLSettingsDay::validation_list_t LLSettingsDay::getValidationList() const { return LLSettingsDay::validationList(); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ff3f5224dd..c2d92fdd38 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -54,9 +54,14 @@ const F32 LLSettingsSky::NIGHTTIME_ELEVATION_COS((F32)sin(NIGHTTIME_ELEVATION*DE //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); -const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id"); const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); const std::string LLSettingsSky::SETTING_BLUE_HORIZON("blue_horizon"); +const std::string LLSettingsSky::SETTING_DENSITY_MULTIPLIER("density_multiplier"); +const std::string LLSettingsSky::SETTING_DISTANCE_MULTIPLIER("distance_multiplier"); +const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density"); +const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon"); + +const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id"); const std::string LLSettingsSky::SETTING_CLOUD_COLOR("cloud_color"); const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY1("cloud_pos_density1"); const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY2("cloud_pos_density2"); @@ -64,14 +69,12 @@ const std::string LLSettingsSky::SETTING_CLOUD_SCALE("cloud_scale"); const std::string LLSettingsSky::SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate"); const std::string LLSettingsSky::SETTING_CLOUD_SHADOW("cloud_shadow"); const std::string LLSettingsSky::SETTING_CLOUD_TEXTUREID("cloud_id"); -const std::string LLSettingsSky::SETTING_DENSITY_MULTIPLIER("density_multiplier"); -const std::string LLSettingsSky::SETTING_DISTANCE_MULTIPLIER("distance_multiplier"); + const std::string LLSettingsSky::SETTING_DOME_OFFSET("dome_offset"); const std::string LLSettingsSky::SETTING_DOME_RADIUS("dome_radius"); const std::string LLSettingsSky::SETTING_GAMMA("gamma"); const std::string LLSettingsSky::SETTING_GLOW("glow"); -const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density"); -const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon"); + const std::string LLSettingsSky::SETTING_LIGHT_NORMAL("lightnorm"); const std::string LLSettingsSky::SETTING_MAX_Y("max_y"); const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation"); @@ -246,12 +249,12 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() // copy constructor for LLSDArray. Directly binding the LLSDArray as // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] - + +#if SUPPORT_LEGACY_ATMOSPHERICS validation.push_back(Validator(SETTING_AMBIENT, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); - validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_BLUE_DENSITY, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -260,6 +263,18 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + validation.push_back(Validator(SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + +#endif + + validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -281,10 +296,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); - validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); - validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + validation.push_back(Validator(SETTING_DOME_OFFSET, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_DOME_RADIUS, false, LLSD::TypeReal, @@ -295,10 +307,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.2f)("*")(-2.5f)("*")), LLSD(LLSDArray(20.0f)("*")(0.0f)("*"))))); - validation.push_back(Validator(SETTING_HAZE_DENSITY, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); - validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_LIGHT_NORMAL, false, LLSD::TypeArray, boost::bind(&Validator::verifyVectorNormalized, _1, 3))); validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, @@ -330,6 +339,51 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() return validation; } +LLSD LLSettingsSky::rayleighConfigDefault() +{ + LLSD dflt_rayleigh; + dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + return dflt_rayleigh; +} + +LLSD LLSettingsSky::absorptionConfigDefault() +{ +// absorption (ozone) has two linear ramping zones + LLSD dflt_absorption_layer_a; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; + dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; + + LLSD dflt_absorption_layer_b; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; + dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; + + LLSD dflt_absorption; + dflt_absorption.append(dflt_absorption_layer_a); + dflt_absorption.append(dflt_absorption_layer_b); + return dflt_absorption; +} + +LLSD LLSettingsSky::mieConfigDefault() +{ + LLSD dflt_mie; + dflt_mie[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; + dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR] = 0.9f; + return dflt_mie; +} LLSD LLSettingsSky::defaults() { @@ -341,23 +395,28 @@ LLSD LLSettingsSky::defaults() LLQuaternion moonquat = ~sunquat; // Magic constants copied form dfltsetting.xml +#if SUPPORT_LEGACY_ATMOSPHERICS dfltsetting[SETTING_AMBIENT] = LLColor4::white.getValue(); dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue(); dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue(); + dfltsetting[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(0.0001); + dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); + dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); + dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); +#endif + dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); - dfltsetting[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(0.0001); - dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); + dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); - dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); - dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); + dfltsetting[SETTING_LIGHT_NORMAL] = LLVector3(0.0000, 0.9126, -0.4086).getValue(); dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); @@ -377,46 +436,9 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - - LLSD dflt_rayleigh; - dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - - dfltsetting[SETTING_RAYLEIGH_CONFIG] = dflt_rayleigh; - - LLSD dflt_mie; - dflt_mie[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; - dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR] = 0.9f; - - dfltsetting[SETTING_MIE_CONFIG] = dflt_mie; - - // absorption (ozone) has two linear ramping zones - LLSD dflt_absorption_a; - dflt_absorption_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere - dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; - dflt_absorption_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; - - LLSD dflt_absorption_b; - dflt_absorption_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere - dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; - dflt_absorption_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; - - LLSD wtf; - wtf.append(dflt_absorption_a); - wtf.append(dflt_absorption_b); - - dfltsetting[SETTING_ABSORPTION_CONFIG] = wtf; + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); + dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); return dfltsetting; } @@ -560,6 +582,9 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { LLSD newsettings(defaults()); +// AdvancedAtmospherics TODO +// These need to be translated into density profile info in the new settings format... +#if SUPPORT_LEGACY_ATMOSPHERICS if (legacy.has(SETTING_AMBIENT)) { newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); @@ -572,6 +597,39 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { 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)) + { + newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); + } +#endif + + if (!legacy.has(SETTING_RAYLEIGH_CONFIG)) + { + newsettings[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + } + + if (!legacy.has(SETTING_ABSORPTION_CONFIG)) + { + newsettings[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + } + + if (!legacy.has(SETTING_MIE_CONFIG)) + { + newsettings[SETTING_MIE_CONFIG] = mieConfigDefault(); + } + if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); @@ -607,14 +665,8 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_CLOUD_SHADOW] = LLSD::Real(legacy[SETTING_CLOUD_SHADOW][0].asReal()); } - 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_GAMMA)) { newsettings[SETTING_GAMMA] = legacy[SETTING_GAMMA][0].asReal(); @@ -623,14 +675,7 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_GLOW] = LLColor3(legacy[SETTING_GLOW]).getValue(); } - if (legacy.has(SETTING_HAZE_DENSITY)) - { - newsettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal()); - } - if (legacy.has(SETTING_HAZE_HORIZON)) - { - newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); - } + if (legacy.has(SETTING_LIGHT_NORMAL)) { newsettings[SETTING_LIGHT_NORMAL] = LLVector3(legacy[SETTING_LIGHT_NORMAL]).getValue(); @@ -648,6 +693,44 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) newsettings[SETTING_SUNLIGHT_COLOR] = LLColor4(legacy[SETTING_SUNLIGHT_COLOR]).getValue(); } + if (legacy.has(SETTING_PLANET_RADIUS)) + { + newsettings[SETTING_PLANET_RADIUS] = LLSD::Real(legacy[SETTING_PLANET_RADIUS].asReal()); + } + else + { + newsettings[SETTING_PLANET_RADIUS] = 6360.0f; + } + + if (legacy.has(SETTING_SKY_BOTTOM_RADIUS)) + { + newsettings[SETTING_SKY_BOTTOM_RADIUS] = LLSD::Real(legacy[SETTING_SKY_BOTTOM_RADIUS].asReal()); + } + else + { + newsettings[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + } + + if (legacy.has(SETTING_SKY_TOP_RADIUS)) + { + newsettings[SETTING_SKY_TOP_RADIUS] = LLSD::Real(legacy[SETTING_SKY_TOP_RADIUS].asReal()); + } + else + { + newsettings[SETTING_SKY_TOP_RADIUS] = 6420.0f; + } + + if (legacy.has(SETTING_SUN_ARC_RADIANS)) + { + newsettings[SETTING_SUN_ARC_RADIANS] = LLSD::Real(legacy[SETTING_SUN_ARC_RADIANS].asReal()); + } + else + { + newsettings[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + } + + + if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) { // convert the east and sun angles into a quaternion. F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); @@ -716,6 +799,8 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() void LLSettingsSky::calculateLightSettings() { + +#if SUPPORT_LEGACY_ATMOSPHERICS LLColor3 vary_HazeColor; LLColor3 vary_SunlightColor; LLColor3 vary_AmbientColor; @@ -804,6 +889,8 @@ void LLSettingsSky::calculateLightSettings() mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); +#endif + } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 1d860016fb..3c5e271d39 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -31,13 +31,20 @@ #include "llsettingsbase.h" #include "v4coloru.h" +#define SUPPORT_LEGACY_ATMOSPHERICS 1 + class LLSettingsSky: public LLSettingsBase { public: + static const std::string SETTING_AMBIENT; - static const std::string SETTING_BLOOM_TEXTUREID; static const std::string SETTING_BLUE_DENSITY; static const std::string SETTING_BLUE_HORIZON; + static const std::string SETTING_DENSITY_MULTIPLIER; + static const std::string SETTING_DISTANCE_MULTIPLIER; + static const std::string SETTING_HAZE_DENSITY; + static const std::string SETTING_HAZE_HORIZON; + static const std::string SETTING_BLOOM_TEXTUREID; static const std::string SETTING_CLOUD_COLOR; static const std::string SETTING_CLOUD_POS_DENSITY1; static const std::string SETTING_CLOUD_POS_DENSITY2; @@ -45,14 +52,10 @@ public: static const std::string SETTING_CLOUD_SCROLL_RATE; static const std::string SETTING_CLOUD_SHADOW; static const std::string SETTING_CLOUD_TEXTUREID; - static const std::string SETTING_DENSITY_MULTIPLIER; - static const std::string SETTING_DISTANCE_MULTIPLIER; static const std::string SETTING_DOME_OFFSET; static const std::string SETTING_DOME_RADIUS; static const std::string SETTING_GAMMA; - static const std::string SETTING_GLOW; - static const std::string SETTING_HAZE_DENSITY; - static const std::string SETTING_HAZE_HORIZON; + static const std::string SETTING_GLOW; static const std::string SETTING_LIGHT_NORMAL; static const std::string SETTING_MAX_Y; static const std::string SETTING_MOON_ROTATION; @@ -96,7 +99,13 @@ public: static LLSD defaults(); + LLUUID getBloomTextureId() const + { + return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); + } + //--------------------------------------------------------------------- +#if SUPPORT_LEGACY_ATMOSPHERICS LLColor3 getAmbientColor() const { return LLColor3(mSettings[SETTING_AMBIENT]); @@ -107,11 +116,6 @@ public: setValue(SETTING_AMBIENT, val); } - LLUUID getBloomTextureId() const - { - return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); - } - LLColor3 getBlueDensity() const { return LLColor3(mSettings[SETTING_BLUE_DENSITY]); @@ -132,6 +136,47 @@ public: setValue(SETTING_BLUE_HORIZON, val); } + F32 getDensityMultiplier() const + { + return mSettings[SETTING_DENSITY_MULTIPLIER].asReal(); + } + + void setDensityMultiplier(F32 val) + { + setValue(SETTING_DENSITY_MULTIPLIER, val); + } + + F32 getDistanceMultiplier() const + { + return mSettings[SETTING_DISTANCE_MULTIPLIER].asReal(); + } + + void setDistanceMultiplier(F32 val) + { + setValue(SETTING_DISTANCE_MULTIPLIER, val); + } + + F32 getHazeDensity() const + { + return mSettings[SETTING_HAZE_DENSITY].asReal(); + } + + void setHazeDensity(F32 val) + { + setValue(SETTING_HAZE_DENSITY, val); + } + + F32 getHazeHorizon() const + { + return mSettings[SETTING_HAZE_HORIZON].asReal(); + } + + void setHazeHorizon(F32 val) + { + setValue(SETTING_HAZE_HORIZON, val); + } +#endif + LLColor3 getCloudColor() const { return LLColor3(mSettings[SETTING_CLOUD_COLOR]); @@ -209,26 +254,7 @@ public: setValue(SETTING_CLOUD_SHADOW, val); } - F32 getDensityMultiplier() const - { - return mSettings[SETTING_DENSITY_MULTIPLIER].asReal(); - } - - void setDensityMultiplier(F32 val) - { - setValue(SETTING_DENSITY_MULTIPLIER, val); - } - - F32 getDistanceMultiplier() const - { - return mSettings[SETTING_DISTANCE_MULTIPLIER].asReal(); - } - - void setDistanceMultiplier(F32 val) - { - setValue(SETTING_DISTANCE_MULTIPLIER, val); - } - + F32 getDomeOffset() const { return DOME_OFFSET; @@ -262,26 +288,6 @@ public: setValue(SETTING_GLOW, val); } - F32 getHazeDensity() const - { - return mSettings[SETTING_HAZE_DENSITY].asReal(); - } - - void setHazeDensity(F32 val) - { - setValue(SETTING_HAZE_DENSITY, val); - } - - F32 getHazeHorizon() const - { - return mSettings[SETTING_HAZE_HORIZON].asReal(); - } - - void setHazeHorizon(F32 val) - { - setValue(SETTING_HAZE_HORIZON, val); - } - LLVector3 getLightNormal() const { return LLVector3(mSettings[SETTING_LIGHT_NORMAL]); @@ -450,6 +456,10 @@ private: static validation_list_t absorptionValidationList(); static validation_list_t mieValidationList(); + static LLSD rayleighConfigDefault(); + static LLSD absorptionConfigDefault(); + static LLSD mieConfigDefault(); + static const F32 NIGHTTIME_ELEVATION; static const F32 NIGHTTIME_ELEVATION_COS; -- cgit v1.2.3 From 73caf6f52d672a6c11c00326b6befefd145dff1d Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 28 Feb 2018 22:34:43 +0000 Subject: Fix accidental dups/deletes from merge and remove optimize pragmas. --- indra/llinventory/llsettingssky.cpp | 4 ---- indra/llinventory/llsettingssky.h | 11 ++--------- 2 files changed, 2 insertions(+), 13 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c2d92fdd38..f1124dce4b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -443,8 +443,6 @@ LLSD LLSettingsSky::defaults() return dfltsetting; } -#pragma optimize("", off) - LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &validations) { // Make a copy we can safely modify @@ -576,8 +574,6 @@ LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &valid return LLSDMap("success", LLSD::Boolean(false)); } -#pragma optimize("", on) - LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { LLSD newsettings(defaults()); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index df6a310647..87b1f95af6 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -44,7 +44,6 @@ public: static const std::string SETTING_DISTANCE_MULTIPLIER; static const std::string SETTING_HAZE_DENSITY; static const std::string SETTING_HAZE_HORIZON; - static const std::string SETTING_BLOOM_TEXTUREID; static const std::string SETTING_CLOUD_COLOR; static const std::string SETTING_CLOUD_POS_DENSITY1; static const std::string SETTING_CLOUD_POS_DENSITY2; @@ -52,8 +51,6 @@ public: static const std::string SETTING_CLOUD_SCROLL_RATE; static const std::string SETTING_CLOUD_SHADOW; static const std::string SETTING_CLOUD_TEXTUREID; - static const std::string SETTING_DENSITY_MULTIPLIER; - static const std::string SETTING_DISTANCE_MULTIPLIER; static const std::string SETTING_DOME_OFFSET; static const std::string SETTING_DOME_RADIUS; static const std::string SETTING_GAMMA; @@ -120,11 +117,6 @@ public: setValue(SETTING_AMBIENT, val); } - LLUUID getBloomTextureId() const - { - return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); - } - LLColor3 getBlueDensity() const { return LLColor3(mSettings[SETTING_BLUE_DENSITY]); @@ -444,7 +436,8 @@ public: virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); - static LLSD translateLegacySettings(LLSD legacy); + static LLSD translateLegacySettings(LLSD legacy); + static LLSD settingValidation(LLSD &settingsIn, validation_list_t &validations); protected: static const std::string SETTING_LEGACY_EAST_ANGLE; -- cgit v1.2.3 From 7951001081209855178b73a0092cc18b1a192397 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Fri, 2 Mar 2018 00:58:04 +0000 Subject: Rework density profile validation, eliminate custom LLSettingsSky::settingsValidation in favor of custom validator functor for each profile type (rayleigh, mie, absorption). --- indra/llinventory/llsettingsdaycycle.cpp | 4 +- indra/llinventory/llsettingssky.cpp | 398 +++++++++++++++---------------- indra/llinventory/llsettingssky.h | 6 - 3 files changed, 188 insertions(+), 220 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index b437ac57bd..0e0554d9d5 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -386,7 +386,7 @@ namespace if (ftype == "sky") { LLSettingsSky::validation_list_t valid_sky = LLSettingsSky::validationList(); - LLSD res_sky = LLSettingsSky::settingValidation(frame, valid_sky); + LLSD res_sky = LLSettingsBase::settingValidation(frame, valid_sky); if (res_sky["success"].asInteger() == 0) { @@ -399,7 +399,7 @@ namespace else if (ftype == "water") { LLSettingsWater::validation_list_t valid_h2o = LLSettingsWater::validationList(); - LLSD res_h2o = LLSettingsWater::settingValidation(frame, valid_h2o); + LLSD res_h2o = LLSettingsBase::settingValidation(frame, valid_h2o); if (res_h2o["success"].asInteger() == 0) { LL_WARNS("SETTINGS") << "Water setting named '" << (*itf).first << "' validation failed!: " << res_h2o << LL_ENDL; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f1124dce4b..30de842e2e 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -92,17 +92,188 @@ const std::string LLSettingsSky::SETTING_LEGACY_SUN_ANGLE("sun_angle"); const std::string LLSettingsSky::SETTING_PLANET_RADIUS("planet_radius"); const std::string LLSettingsSky::SETTING_SKY_BOTTOM_RADIUS("sky_bottom_radius"); const std::string LLSettingsSky::SETTING_SKY_TOP_RADIUS("sky_top_radius"); -const std::string LLSettingsSky::SETTING_RAYLEIGH_CONFIG("rayleigh"); -const std::string LLSettingsSky::SETTING_MIE_CONFIG("mie"); -const std::string LLSettingsSky::SETTING_ABSORPTION_CONFIG("absorption"); +const std::string LLSettingsSky::SETTING_SUN_ARC_RADIANS("sun_arc_radians"); + +const std::string LLSettingsSky::SETTING_RAYLEIGH_CONFIG("rayleigh_config"); +const std::string LLSettingsSky::SETTING_MIE_CONFIG("mie_config"); +const std::string LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR("anisotropy"); +const std::string LLSettingsSky::SETTING_ABSORPTION_CONFIG("absorption_config"); + const std::string LLSettingsSky::KEY_DENSITY_PROFILE("density"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH("width"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM("exp_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_scale"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); -const std::string LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR("anisotropy"); -const std::string LLSettingsSky::SETTING_SUN_ARC_RADIANS("sun_arc_radians"); + +namespace +{ + +LLSettingsSky::validation_list_t rayleighValidationList() +{ + static LLSettingsBase::validation_list_t rayleighValidation; + if (rayleighValidation.empty()) + { + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return rayleighValidation; +} + +LLSettingsSky::validation_list_t absorptionValidationList() +{ + static LLSettingsBase::validation_list_t absorptionValidation; + if (absorptionValidation.empty()) + { + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return absorptionValidation; +} + +LLSettingsSky::validation_list_t mieValidationList() +{ + static LLSettingsBase::validation_list_t mieValidation; + if (mieValidation.empty()) + { + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + } + return mieValidation; +} + +bool validateRayleighLayers(LLSD &value) +{ + LLSettingsSky::validation_list_t rayleighValidations = rayleighValidationList(); + if (value.isArray()) + { + bool allGood = true; + for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) + { + LLSD& layerConfig = (*itf); + if (!validateRayleighLayers(layerConfig)) + { + allGood = false; + } + } + return allGood; + } + llassert(value.type() == LLSD::Type::TypeMap); + LLSD result = LLSettingsBase::settingValidation(value, rayleighValidations); + if (result["errors"].size() > 0) + { + LL_WARNS("SETTINGS") << "Rayleigh Config Validation errors: " << result["errors"] << LL_ENDL; + return false; + } + if (result["warnings"].size() > 0) + { + LL_WARNS("SETTINGS") << "Rayleigh Config Validation warnings: " << result["errors"] << LL_ENDL; + return false; + } + return true; +} + +bool validateAbsorptionLayers(LLSD &value) +{ + LLSettingsBase::validation_list_t absorptionValidations = absorptionValidationList(); + if (value.isArray()) + { + bool allGood = true; + for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) + { + LLSD& layerConfig = (*itf); + if (!validateAbsorptionLayers(layerConfig)) + { + allGood = false; + } + } + return allGood; + } + llassert(value.type() == LLSD::Type::TypeMap); + LLSD result = LLSettingsBase::settingValidation(value, absorptionValidations); + if (result["errors"].size() > 0) + { + LL_WARNS("SETTINGS") << "Absorption Config Validation errors: " << result["errors"] << LL_ENDL; + return false; + } + if (result["warnings"].size() > 0) + { + LL_WARNS("SETTINGS") << "Absorption Config Validation warnings: " << result["errors"] << LL_ENDL; + return false; + } + return true; +} + +bool validateMieLayers(LLSD &value) +{ + LLSettingsBase::validation_list_t mieValidations = mieValidationList(); + if (value.isArray()) + { + bool allGood = true; + for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) + { + LLSD& layerConfig = (*itf); + if (!validateMieLayers(layerConfig)) + { + allGood = false; + } + } + return allGood; + } + LLSD result = LLSettingsBase::settingValidation(value, mieValidations); + if (result["errors"].size() > 0) + { + LL_WARNS("SETTINGS") << "Mie Config Validation errors: " << result["errors"] << LL_ENDL; + return false; + } + if (result["warnings"].size() > 0) + { + LL_WARNS("SETTINGS") << "Mie Config Validation warnings: " << result["errors"] << LL_ENDL; + return false; + } + return true; +} + +} //========================================================================= LLSettingsSky::LLSettingsSky(const LLSD &data) : @@ -163,77 +334,7 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const return slepSet; } -LLSettingsSky::validation_list_t LLSettingsSky::rayleighValidationList() -{ - static validation_list_t rayleighValidation; - if (rayleighValidation.empty()) - { - rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - - rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - - rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - } - return rayleighValidation; -} - -LLSettingsSky::validation_list_t LLSettingsSky::absorptionValidationList() -{ - static validation_list_t absorptionValidation; - if (absorptionValidation.empty()) - { - absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - - absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - - absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - } - return absorptionValidation; -} - -LLSettingsSky::validation_list_t LLSettingsSky::mieValidationList() -{ - static validation_list_t mieValidation; - if (mieValidation.empty()) - { - mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - - mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - - mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - - mieValidation.push_back(Validator(SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - } - return mieValidation; -} LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const { @@ -334,8 +435,11 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); - } + validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); + validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); + validation.push_back(Validator(SETTING_MIE_CONFIG, true, LLSD::TypeArray, &validateMieLayers)); + } return validation; } @@ -388,8 +492,6 @@ LLSD LLSettingsSky::mieConfigDefault() LLSD LLSettingsSky::defaults() { LLSD dfltsetting; - - LLQuaternion sunquat; sunquat.setEulerAngles(1.39626, 0.0, 0.0); // 80deg Azumith/0deg East LLQuaternion moonquat = ~sunquat; @@ -436,142 +538,14 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); - dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); - dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); - - return dfltsetting; -} - -LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &validations) -{ - // Make a copy we can safely modify - LLSD settings = settingsIn; - - validation_list_t& rayleighValidations = rayleighValidationList(); - validation_list_t& absorptionValidations = absorptionValidationList(); - validation_list_t& mieValidations = mieValidationList(); - - bool isValid = true; - - LLSD& rayleighConfigs = settings[SETTING_RAYLEIGH_CONFIG]; - LLSD& mieConfigs = settings[SETTING_MIE_CONFIG]; - LLSD& absorptionConfigs = settings[SETTING_ABSORPTION_CONFIG]; - -// this is an attempt to handle a single defined layer (w/o array elem) -// but also handle an array of density profiles if they are specified thus. - if (rayleighConfigs.isArray()) - { - for (LLSD::array_iterator it = rayleighConfigs.beginArray(); it != rayleighConfigs.endArray(); ++it) - { - LLSD rayleighResults = LLSettingsBase::settingValidation(*it, rayleighValidations); - if (!rayleighResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } - } - else - { - LLSD rayleighResults = LLSettingsBase::settingValidation(rayleighConfigs, rayleighValidations); - if (!rayleighResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } - if (mieConfigs.isArray()) - { - for (LLSD::array_iterator it = mieConfigs.beginArray(); it != mieConfigs.endArray(); ++it) - { - LLSD mieResults = LLSettingsBase::settingValidation(*it, mieValidations); - if (!mieResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } - } - else - { - LLSD mieResults = LLSettingsBase::settingValidation(mieConfigs, mieValidations); - if (!mieResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } + // These are technically capable of handling multiple layers of density config + // and so are expected to be an array, but we make an array of size 1 w/ each default density config + dfltsetting[SETTING_RAYLEIGH_CONFIG].append(rayleighConfigDefault()); + dfltsetting[SETTING_MIE_CONFIG].append(mieConfigDefault()); + dfltsetting[SETTING_ABSORPTION_CONFIG].append(absorptionConfigDefault()); - if (absorptionConfigs.isArray()) - { - for (LLSD::array_iterator it = absorptionConfigs.beginArray(); it != absorptionConfigs.endArray(); ++it) - { - LLSD absorptionResults = LLSettingsBase::settingValidation(*it, absorptionValidations); - if (!absorptionResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } - } - else - { - LLSD absorptionResults = LLSettingsBase::settingValidation(absorptionConfigs, absorptionValidations); - if (!absorptionResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - } - -#if 0 - LLSD& rayleigh = settings[SETTING_RAYLEIGH_CONFIG]; - LLSD& absorption = settings[SETTING_ABSORPTION_CONFIG]; - LLSD& mie = settings[SETTING_MIE_CONFIG]; - LLSD rayleighResults = LLSettingsBase::settingValidation(rayleigh, rayleighValidations); - LLSD absorptionResults = LLSettingsBase::settingValidation(absorption, absorptionValidations); - LLSD mieResults = LLSettingsBase::settingValidation(mie, mieValidations); - - if (!rayleighResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - - if (!absorptionResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } - - if (!mieResults["success"].asBoolean()) - { - LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL; - LLSettingsSky::ptr_t(); - isValid = false; - } -#endif - - settings.erase(SETTING_RAYLEIGH_CONFIG); - settings.erase(SETTING_ABSORPTION_CONFIG); - settings.erase(SETTING_MIE_CONFIG); - - if (isValid) - { - return LLSettingsBase::settingValidation(settings, validations); - } - - return LLSDMap("success", LLSD::Boolean(false)); + return dfltsetting; } LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 87b1f95af6..dec9467e8d 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -437,7 +437,6 @@ public: static validation_list_t validationList(); static LLSD translateLegacySettings(LLSD legacy); - static LLSD settingValidation(LLSD &settingsIn, validation_list_t &validations); protected: static const std::string SETTING_LEGACY_EAST_ANGLE; @@ -451,11 +450,6 @@ protected: virtual void updateSettings() override; private: - // validations for structured sections of sky settings data - static validation_list_t rayleighValidationList(); - static validation_list_t absorptionValidationList(); - static validation_list_t mieValidationList(); - static LLSD rayleighConfigDefault(); static LLSD absorptionConfigDefault(); static LLSD mieConfigDefault(); -- cgit v1.2.3 From acdead96cd194040f586c5a6e976beca7bb999c4 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Fri, 2 Mar 2018 23:29:28 +0000 Subject: Replace ifdefs with comments marking legacy atmo params. --- indra/llinventory/llsettingssky.cpp | 14 ++++---------- indra/llinventory/llsettingssky.h | 5 +---- 2 files changed, 5 insertions(+), 14 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 30de842e2e..b8a45a8d89 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -351,7 +351,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] -#if SUPPORT_LEGACY_ATMOSPHERICS +// LEGACY_ATMOSPHERICS validation.push_back(Validator(SETTING_AMBIENT, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -373,8 +373,6 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); -#endif - validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, @@ -497,7 +495,7 @@ LLSD LLSettingsSky::defaults() LLQuaternion moonquat = ~sunquat; // Magic constants copied form dfltsetting.xml -#if SUPPORT_LEGACY_ATMOSPHERICS +// LEGACY_ATMOSPHERICS dfltsetting[SETTING_AMBIENT] = LLColor4::white.getValue(); dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue(); dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue(); @@ -505,7 +503,6 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); -#endif dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); @@ -554,7 +551,7 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) // AdvancedAtmospherics TODO // These need to be translated into density profile info in the new settings format... -#if SUPPORT_LEGACY_ATMOSPHERICS +// LEGACY_ATMOSPHERICS if (legacy.has(SETTING_AMBIENT)) { newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); @@ -583,7 +580,6 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); } -#endif if (!legacy.has(SETTING_RAYLEIGH_CONFIG)) { @@ -770,7 +766,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() void LLSettingsSky::calculateLightSettings() { -#if SUPPORT_LEGACY_ATMOSPHERICS +// LEGACY_ATMOSPHERICS LLColor3 vary_HazeColor; LLColor3 vary_SunlightColor; LLColor3 vary_AmbientColor; @@ -859,8 +855,6 @@ void LLSettingsSky::calculateLightSettings() mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); -#endif - } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index dec9467e8d..4884f4f094 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -31,8 +31,6 @@ #include "llsettingsbase.h" #include "v4coloru.h" -#define SUPPORT_LEGACY_ATMOSPHERICS 1 - class LLSettingsSky: public LLSettingsBase { public: @@ -106,7 +104,7 @@ public: } //--------------------------------------------------------------------- -#if SUPPORT_LEGACY_ATMOSPHERICS +// LEGACY_ATMOSPHERICS LLColor3 getAmbientColor() const { return LLColor3(mSettings[SETTING_AMBIENT]); @@ -176,7 +174,6 @@ public: { setValue(SETTING_HAZE_HORIZON, val); } -#endif LLColor3 getCloudColor() const { -- cgit v1.2.3 From 98862a53a77cd1ce9a2cae596a743669cc32a2af Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Sat, 3 Mar 2018 00:53:39 +0000 Subject: Fix 16F enum for compat w/ SL gl headers on Mac. Make density profile/layer parsing handle when LLSD heard you liked arrays so it put an array in your array. --- indra/llinventory/llsettingssky.cpp | 51 +++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 8 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b8a45a8d89..91357a6e49 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,8 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#pragma optimize("", off) + //========================================================================= namespace { @@ -190,9 +192,20 @@ bool validateRayleighLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (!validateRayleighLayers(layerConfig)) + if (layerConfig.type() == LLSD::Type::TypeMap) + { + if (!validateRayleighLayers(layerConfig)) + { + allGood = false; + } + } + else if (layerConfig.type() == LLSD::Type::TypeArray) { - allGood = false; + return validateRayleighLayers(layerConfig); + } + else + { + return LLSettingsBase::settingValidation(value, rayleighValidations); } } return allGood; @@ -221,9 +234,20 @@ bool validateAbsorptionLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (!validateAbsorptionLayers(layerConfig)) + if (layerConfig.type() == LLSD::Type::TypeMap) + { + if (!validateAbsorptionLayers(layerConfig)) + { + allGood = false; + } + } + else if (layerConfig.type() == LLSD::Type::TypeArray) { - allGood = false; + return validateAbsorptionLayers(layerConfig); + } + else + { + return LLSettingsBase::settingValidation(value, absorptionValidations); } } return allGood; @@ -252,9 +276,20 @@ bool validateMieLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (!validateMieLayers(layerConfig)) + if (layerConfig.type() == LLSD::Type::TypeMap) + { + if (!validateMieLayers(layerConfig)) + { + allGood = false; + } + } + else if (layerConfig.type() == LLSD::Type::TypeArray) { - allGood = false; + return validateMieLayers(layerConfig); + } + else + { + return LLSettingsBase::settingValidation(value, mieValidations); } } return allGood; @@ -779,6 +814,7 @@ void LLSettingsSky::calculateLightSettings() LLColor3 blue_horizon = getBlueHorizon(); F32 haze_density = getHazeDensity(); F32 haze_horizon = getHazeHorizon(); + F32 density_multiplier = getDensityMultiplier(); F32 max_y = getMaxY(); F32 cloud_shadow = getCloudShadow(); @@ -786,8 +822,7 @@ void LLSettingsSky::calculateLightSettings() // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes - LLColor3 light_atten = - (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y); + LLColor3 light_atten = (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y); // Calculate relative weights LLColor3 temp2(0.f, 0.f, 0.f); -- cgit v1.2.3 From 5517eb3f6f06226fba0ffe510334f519a8a7d7b7 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Sat, 3 Mar 2018 01:08:58 +0000 Subject: Remove MSVC pragmas breaking OSX build. --- indra/llinventory/llsettingssky.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 91357a6e49..5d38deb229 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,8 +32,6 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#pragma optimize("", off) - //========================================================================= namespace { -- cgit v1.2.3 From 6e51714419a151dcc26e04319cc554187a905279 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Tue, 6 Mar 2018 20:16:49 +0000 Subject: Isolate atmospherics LLSD conversion code. Fix translateLegacySettings to add an array where an array is expected. --- indra/llinventory/llsettingssky.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 5d38deb229..cac363b510 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -616,17 +616,17 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) if (!legacy.has(SETTING_RAYLEIGH_CONFIG)) { - newsettings[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + newsettings[SETTING_RAYLEIGH_CONFIG].append(rayleighConfigDefault()); } if (!legacy.has(SETTING_ABSORPTION_CONFIG)) { - newsettings[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + newsettings[SETTING_ABSORPTION_CONFIG].append(absorptionConfigDefault()); } if (!legacy.has(SETTING_MIE_CONFIG)) { - newsettings[SETTING_MIE_CONFIG] = mieConfigDefault(); + newsettings[SETTING_MIE_CONFIG].append(mieConfigDefault()); } if (legacy.has(SETTING_CLOUD_COLOR)) @@ -728,8 +728,6 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) newsettings[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; } - - if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) { // convert the east and sun angles into a quaternion. F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); -- cgit v1.2.3 From cbe4cac78cf48cb9144dc2f6c194585cff87a1ce Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 6 Mar 2018 14:58:39 -0800 Subject: Settings type inventory objects and upload the assests. --- indra/llinventory/CMakeLists.txt | 2 + indra/llinventory/llinventorydefines.h | 11 ++- indra/llinventory/llinventorysettings.cpp | 110 ++++++++++++++++++++++++++++++ indra/llinventory/llinventorysettings.h | 24 +++++-- indra/llinventory/llinventorytype.cpp | 1 - indra/llinventory/llinventorytype.h | 2 + indra/llinventory/llinvtranslationbrdg.h | 41 +++++++++++ indra/llinventory/llsettingsbase.h | 2 +- indra/llinventory/llsettingsdaycycle.cpp | 2 + indra/llinventory/llsettingsdaycycle.h | 2 +- indra/llinventory/llsettingssky.h | 2 +- indra/llinventory/llsettingswater.h | 2 +- 12 files changed, 183 insertions(+), 18 deletions(-) create mode 100644 indra/llinventory/llinventorysettings.cpp create mode 100644 indra/llinventory/llinvtranslationbrdg.h (limited to 'indra/llinventory') diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index 2d40dd6443..f1bc28427d 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -23,6 +23,7 @@ set(llinventory_SOURCE_FILES llfoldertype.cpp llinventory.cpp llinventorydefines.cpp + llinventorysettings.cpp llinventorytype.cpp lllandmark.cpp llnotecard.cpp @@ -47,6 +48,7 @@ set(llinventory_HEADER_FILES llinventorydefines.h llinventorysettings.h llinventorytype.h + llinvtranslationbrdg.h lllandmark.h llnotecard.h llparcel.h diff --git a/indra/llinventory/llinventorydefines.h b/indra/llinventory/llinventorydefines.h index b420e98ecb..54562673f3 100644 --- a/indra/llinventory/llinventorydefines.h +++ b/indra/llinventory/llinventorydefines.h @@ -81,13 +81,10 @@ public: II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS = 0x200000, // Whether a returned object is composed of multiple items. - II_FLAGS_WEARABLES_MASK = 0xff, - // Wearables use the low order byte of flags to store the - // LLWearableType::EType enumeration found in newview/llwearable.h - // - II_FLAGS_SETTINGS_MASK = 0x0000ff, - // Settings (like wearables) use the low order byte of flags to store - // the settings type + II_FLAGS_SUBTYPE_MASK = 0x0000ff, + // Some items like Wearables and settings use the low order byte + // of flags to store the sub type of the inventory item. + // see LLWearableType::EType enumeration found in newview/llwearable.h II_FLAGS_PERM_OVERWRITE_MASK = (II_FLAGS_OBJECT_SLAM_PERM | II_FLAGS_OBJECT_SLAM_SALE | diff --git a/indra/llinventory/llinventorysettings.cpp b/indra/llinventory/llinventorysettings.cpp new file mode 100644 index 0000000000..0928e35e95 --- /dev/null +++ b/indra/llinventory/llinventorysettings.cpp @@ -0,0 +1,110 @@ +/** +* @file llinventorysettings.cpp +* @author optional +* @brief A base class for asset based settings groups. +* +* $LicenseInfo:2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2017, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "linden_common.h" +#include "llinventorysettings.h" +#include "llinventorytype.h" +#include "llinventorydefines.h" +#include "lldictionary.h" +#include "llsingleton.h" +#include "llinvtranslationbrdg.h" + +//========================================================================= +namespace { + LLTranslationBridge::ptr_t sTranslator; +} + +//========================================================================= +struct SettingsEntry : public LLDictionaryEntry +{ + SettingsEntry(const std::string &name, + const std::string& default_new_name, + LLInventoryType::EIconName iconName) : + LLDictionaryEntry(name), + mDefaultNewName(default_new_name), + mLabel(name), + mIconName(iconName) + { + std::string transdname = sTranslator->getString(mLabel); + if (!transdname.empty()) + { + mLabel = transdname; + } + } + + std::string mLabel; + std::string mDefaultNewName; //keep mLabel for backward compatibility + LLInventoryType::EIconName mIconName; +}; + +class LLSettingsDictionary : public LLSingleton, + public LLDictionary +{ + LLSINGLETON(LLSettingsDictionary); + + void initSingleton() override; +}; + +LLSettingsDictionary::LLSettingsDictionary() +{ +} + +void LLSettingsDictionary::initSingleton() +{ + addEntry(LLSettingsType::ST_SKY, new SettingsEntry("sky", "New Sky", LLInventoryType::ICONNAME_SETTINGS_SKY)); + addEntry(LLSettingsType::ST_WATER, new SettingsEntry("water", "New Water", LLInventoryType::ICONNAME_SETTINGS_WATER)); + addEntry(LLSettingsType::ST_DAYCYCLE, new SettingsEntry("day", "New Day", LLInventoryType::ICONNAME_SETTINGS_DAY)); + addEntry(LLSettingsType::ST_NONE, new SettingsEntry("none", "New Settings", LLInventoryType::ICONNAME_SETTINGS)); + addEntry(LLSettingsType::ST_INVALID, new SettingsEntry("invalid", "New Settings", LLInventoryType::ICONNAME_SETTINGS)); +} + +//========================================================================= + +LLSettingsType::type_e LLSettingsType::fromInventoryFlags(U32 flags) +{ + return (LLSettingsType::type_e)(flags & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK); +} + + +LLInventoryType::EIconName LLSettingsType::getIconName(LLSettingsType::type_e type) +{ + const SettingsEntry *entry = LLSettingsDictionary::instance().lookup(type); + if (!entry) + return getIconName(ST_INVALID); + return entry->mIconName; +} + + +void LLSettingsType::initClass(LLTranslationBridge::ptr_t &trans) +{ + sTranslator = trans; +} + +void LLSettingsType::cleanupClass() +{ + sTranslator.reset(); +} diff --git a/indra/llinventory/llinventorysettings.h b/indra/llinventory/llinventorysettings.h index 0d15542fec..fb08190ea9 100644 --- a/indra/llinventory/llinventorysettings.h +++ b/indra/llinventory/llinventorysettings.h @@ -28,15 +28,27 @@ #ifndef LL_INVENTORY_SETTINGS_H #define LL_INVENTORY_SETTINGS_H +#include "llinventorytype.h" +#include "llinvtranslationbrdg.h" -enum class LLSettingsType +class LLSettingsType { - ST_SKY = 0, - ST_WATER = 1, - ST_DAYCYCLE = 2, +public: + enum type_e + { + ST_SKY = 0, + ST_WATER = 1, + ST_DAYCYCLE = 2, - ST_INVALID = 255, - ST_NONE = -1 + ST_INVALID = 255, + ST_NONE = -1 + }; + + static type_e fromInventoryFlags(U32 flags); + static LLInventoryType::EIconName getIconName(type_e type); + + static void initClass(LLTranslationBridge::ptr_t &trans); + static void cleanupClass(); }; diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 20c0a12d9e..2b6b53556d 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -203,7 +203,6 @@ bool LLInventoryType::cannotRestrictPermissions(LLInventoryType::EType type) { case IT_CALLINGCARD: case IT_LANDMARK: - case IT_SETTINGS: return true; default: return false; diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index a45bcc364e..86486373b5 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -111,8 +111,10 @@ public: ICONNAME_LINKFOLDER, ICONNAME_MESH, + ICONNAME_SETTINGS, ICONNAME_SETTINGS_SKY, ICONNAME_SETTINGS_WATER, + ICONNAME_SETTINGS_DAY, ICONNAME_INVALID, ICONNAME_COUNT, diff --git a/indra/llinventory/llinvtranslationbrdg.h b/indra/llinventory/llinvtranslationbrdg.h new file mode 100644 index 0000000000..fbd887030a --- /dev/null +++ b/indra/llinventory/llinvtranslationbrdg.h @@ -0,0 +1,41 @@ +/** +* @file llinvtranslationbrdg.h +* @brief Translation adapter for inventory. +* +* $LicenseInfo:firstyear=2002&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2010, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#ifndef LL_TRANSLATIONBRDG_H +#define LL_TRANSLATIONBRDG_H + +class LLTranslationBridge +{ +public: + typedef std::shared_ptr ptr_t; + + // clang needs this to be happy + virtual ~LLTranslationBridge() {} + + virtual std::string getString(const std::string &xml_desc) = 0; +}; + +#endif diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index c7ed9e9e21..62a88cde73 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -68,7 +68,7 @@ public: //--------------------------------------------------------------------- virtual std::string getSettingType() const = 0; - virtual LLSettingsType getSettingTypeValue() const = 0; + virtual LLSettingsType::type_e getSettingTypeValue() const = 0; //--------------------------------------------------------------------- // Settings status diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 18add703cb..f236398ccd 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -127,6 +127,8 @@ LLSD LLSettingsDay::getSettings() const if (mSettings.has(SETTING_ID)) settings[SETTING_ID] = mSettings[SETTING_ID]; + settings[SETTING_TYPE] = getSettingType(); + std::map in_use; LLSD tracks(LLSD::emptyArray()); diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 2d0fa4a840..da572572c4 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -72,7 +72,7 @@ public: virtual ptr_t buildClone() = 0; virtual LLSD getSettings() const override; - virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_DAYCYCLE; } + virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_DAYCYCLE; } //--------------------------------------------------------------------- diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 3c6dbdb76d..8b2118fd84 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -73,7 +73,7 @@ public: //--------------------------------------------------------------------- virtual std::string getSettingType() const override { return std::string("sky"); } - virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_SKY; } + virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_SKY; } // Settings status diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index d4152acfa1..92190fa7b1 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -58,7 +58,7 @@ public: //--------------------------------------------------------------------- virtual std::string getSettingType() const override { return std::string("water"); } - virtual LLSettingsType getSettingTypeValue() const override { return LLSettingsType::ST_WATER; } + virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_WATER; } // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) override; -- cgit v1.2.3 From c11c17ed7b5c614a6c8505088aa709ddd9f1f1a4 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Tue, 6 Mar 2018 23:44:09 +0000 Subject: Remove override keyword not working with LL_SINGLETON pattern. --- indra/llinventory/llinventorysettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventorysettings.cpp b/indra/llinventory/llinventorysettings.cpp index 0928e35e95..8887c23a6c 100644 --- a/indra/llinventory/llinventorysettings.cpp +++ b/indra/llinventory/llinventorysettings.cpp @@ -66,7 +66,7 @@ class LLSettingsDictionary : public LLSingleton, { LLSINGLETON(LLSettingsDictionary); - void initSingleton() override; + void initSingleton(); }; LLSettingsDictionary::LLSettingsDictionary() -- cgit v1.2.3 From 62a0d579b5eb23ea306ade07afba76f7cba685c7 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 7 Mar 2018 18:37:09 +0000 Subject: Move legacy atmospherics code outside of llvosky (begin teasing apart). --- indra/llinventory/llsettingssky.cpp | 57 ++++++++----------------------------- 1 file changed, 12 insertions(+), 45 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cac363b510..3366f1a20a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -383,29 +383,27 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() // copy constructor for LLSDArray. Directly binding the LLSDArray as // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] - -// LEGACY_ATMOSPHERICS - validation.push_back(Validator(SETTING_AMBIENT, true, LLSD::TypeArray, - boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); - validation.push_back(Validator(SETTING_BLUE_DENSITY, true, LLSD::TypeArray, + validation.push_back(Validator(SETTING_BLUE_DENSITY, false, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - validation.push_back(Validator(SETTING_BLUE_HORIZON, true, LLSD::TypeArray, + validation.push_back(Validator(SETTING_BLUE_HORIZON, false, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); - validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); - validation.push_back(Validator(SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + validation.push_back(Validator(SETTING_HAZE_DENSITY, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); - validation.push_back(Validator(SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + validation.push_back(Validator(SETTING_HAZE_HORIZON, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_AMBIENT, false, LLSD::TypeArray, + boost::bind(&Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); + validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, @@ -614,21 +612,6 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); } - if (!legacy.has(SETTING_RAYLEIGH_CONFIG)) - { - newsettings[SETTING_RAYLEIGH_CONFIG].append(rayleighConfigDefault()); - } - - if (!legacy.has(SETTING_ABSORPTION_CONFIG)) - { - newsettings[SETTING_ABSORPTION_CONFIG].append(absorptionConfigDefault()); - } - - if (!legacy.has(SETTING_MIE_CONFIG)) - { - newsettings[SETTING_MIE_CONFIG].append(mieConfigDefault()); - } - if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); @@ -696,37 +679,21 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) { newsettings[SETTING_PLANET_RADIUS] = LLSD::Real(legacy[SETTING_PLANET_RADIUS].asReal()); } - else - { - newsettings[SETTING_PLANET_RADIUS] = 6360.0f; - } if (legacy.has(SETTING_SKY_BOTTOM_RADIUS)) { newsettings[SETTING_SKY_BOTTOM_RADIUS] = LLSD::Real(legacy[SETTING_SKY_BOTTOM_RADIUS].asReal()); } - else - { - newsettings[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; - } if (legacy.has(SETTING_SKY_TOP_RADIUS)) { newsettings[SETTING_SKY_TOP_RADIUS] = LLSD::Real(legacy[SETTING_SKY_TOP_RADIUS].asReal()); } - else - { - newsettings[SETTING_SKY_TOP_RADIUS] = 6420.0f; - } if (legacy.has(SETTING_SUN_ARC_RADIANS)) { newsettings[SETTING_SUN_ARC_RADIANS] = LLSD::Real(legacy[SETTING_SUN_ARC_RADIANS].asReal()); } - else - { - newsettings[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - } if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) { // convert the east and sun angles into a quaternion. -- cgit v1.2.3 From 0f33f0a6f356773ed69e4dcaffb7d589c9b47561 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 7 Mar 2018 18:46:40 +0000 Subject: Don't add old atmo params to new settings defaults. --- indra/llinventory/llsettingssky.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 3366f1a20a..972579b485 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -526,15 +526,6 @@ LLSD LLSettingsSky::defaults() LLQuaternion moonquat = ~sunquat; // Magic constants copied form dfltsetting.xml -// LEGACY_ATMOSPHERICS - dfltsetting[SETTING_AMBIENT] = LLColor4::white.getValue(); - dfltsetting[SETTING_BLUE_DENSITY] = LLColor4(0.2447, 0.4487, 0.7599, 0.0).getValue(); - dfltsetting[SETTING_BLUE_HORIZON] = LLColor4(0.4954, 0.4954, 0.6399, 0.0).getValue(); - dfltsetting[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(0.0001); - dfltsetting[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(0.8000); - dfltsetting[SETTING_HAZE_DENSITY] = LLSD::Real(0.6999); - dfltsetting[SETTING_HAZE_HORIZON] = LLSD::Real(0.1899); - dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); -- cgit v1.2.3 From 4235231b5adbb7f064cab732f761dd359ef4b648 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 7 Mar 2018 11:24:48 -0800 Subject: Fix for calculating azimuth and angle --- indra/llinventory/llsettingssky.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cac363b510..7da3a336cc 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -917,12 +917,22 @@ namespace LLVector3 body_al(0.f, body_vector[1], body_vector[2]); if (fabs(body_az.normalize()) > 0.001) + { azimuth = angle_between(DUE_EAST, body_az); + if (body_az[1] < 0.0f) + azimuth = F_TWO_PI - azimuth; + } else azimuth = 0.0f; if (fabs(body_al.normalize()) > 0.001) + { altitude = angle_between(DUE_EAST, body_al); + if (body_al[2] < 0.0f) + { + altitude = F_TWO_PI - altitude; + } + } else altitude = 0.0f; } -- cgit v1.2.3 From 6d77503542216ece1eecf82dce19ebd8d6be7327 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 7 Mar 2018 23:49:37 +0000 Subject: Isolate more legacy atmo param use in sky (convert to getLightAttenuation and getLightTransmittance). Optimize sky texture creation. --- indra/llinventory/llsettingssky.cpp | 149 ++++++++++++++++-------------------- indra/llinventory/llsettingssky.h | 3 + 2 files changed, 71 insertions(+), 81 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 972579b485..22f048bd0d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -752,101 +752,88 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() } } -void LLSettingsSky::calculateLightSettings() +// 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 { + LLColor3 blue_density = getBlueDensity(); + F32 haze_density = getHazeDensity(); + 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; +} -// LEGACY_ATMOSPHERICS - LLColor3 vary_HazeColor; - LLColor3 vary_SunlightColor; - LLColor3 vary_AmbientColor; - { - // Initialize temp variables - LLColor3 sunlight = getSunlightColor(); - LLColor3 ambient = getAmbientColor(); - F32 gamma = getGamma(); - LLColor3 blue_density = getBlueDensity(); - LLColor3 blue_horizon = getBlueHorizon(); - F32 haze_density = getHazeDensity(); - F32 haze_horizon = getHazeHorizon(); - - F32 density_multiplier = getDensityMultiplier(); - F32 max_y = getMaxY(); - F32 cloud_shadow = getCloudShadow(); - LLVector3 lightnorm = getLightDirection(); - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - LLColor3 light_atten = (blue_density * 1.0 + smear(haze_density * 0.25f)) * (density_multiplier * max_y); - - // Calculate relative weights - LLColor3 temp2(0.f, 0.f, 0.f); - LLColor3 temp1 = blue_density + smear(haze_density); - LLColor3 blue_weight = componentDiv(blue_density, temp1); - LLColor3 haze_weight = componentDiv(smear(haze_density), temp1); - - // Compute sunlight from P & lightnorm (for long rays like sky) - /// USE only lightnorm. - // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); - - // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; - if (lighty < NIGHTTIME_ELEVATION_COS) - { - lighty = -lighty; - } - - temp2.mV[1] = llmax(0.f, lighty); - if(temp2.mV[1] > 0.f) - { - temp2.mV[1] = 1.f / temp2.mV[1]; - } - componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1])); - - // Distance - temp2.mV[2] = density_multiplier; - - // Transparency (-> temp1) - temp1 = componentExp((temp1 * -1.f) * temp2.mV[2]); - - // vary_AtmosAttenuation = temp1; - - //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; +LLColor3 LLSettingsSky::getLightTransmittance() const +{ + LLColor3 blue_density = getBlueDensity(); + F32 haze_density = getHazeDensity(); + F32 density_multiplier = getDensityMultiplier(); + LLColor3 temp1 = blue_density + smear(haze_density); + // Transparency (-> temp1) + temp1 = componentExp((temp1 * -1.f) * density_multiplier); + return temp1; +} - //haze color - vary_HazeColor = - (blue_horizon * blue_weight * (sunlight*(1.f - cloud_shadow) + tmpAmbient) - + componentMult(haze_horizon * haze_weight, sunlight*(1.f - cloud_shadow) * temp2.mV[0] + tmpAmbient) - ); +LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const +{ + F32 gamma = getGamma(); + LLColor3 v(in); + v.clamp(); + v= smear(1.0f) - v; + v = componentPow(v, gamma); + v = smear(1.0f) - v; + return v; +} - //brightness of surface both sunlight and ambient - vary_SunlightColor = componentMult(sunlight, temp1) * 1.f; - vary_SunlightColor.clamp(); - vary_SunlightColor = smear(1.0f) - vary_SunlightColor; - vary_SunlightColor = componentPow(vary_SunlightColor, gamma); - vary_SunlightColor = smear(1.0f) - vary_SunlightColor; - vary_AmbientColor = componentMult(tmpAmbient, temp1) * 0.5; - vary_AmbientColor.clamp(); - vary_AmbientColor = smear(1.0f) - vary_AmbientColor; - vary_AmbientColor = componentPow(vary_AmbientColor, gamma); - vary_AmbientColor = smear(1.0f) - vary_AmbientColor; +void LLSettingsSky::calculateLightSettings() +{ +// LEGACY_ATMOSPHERICS + // Initialize temp variables + LLColor3 sunlight = getSunlightColor(); + LLColor3 ambient = getAmbientColor(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + F32 max_y = getMaxY(); + LLColor3 light_atten = getLightAttenuation(max_y); + LLColor3 light_transmittance = getLightTransmittance(); + + // Compute sunlight from P & lightnorm (for long rays like sky) + /// USE only lightnorm. + // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); - componentMultBy(vary_HazeColor, LLColor3(1.f, 1.f, 1.f) - temp1); + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; + if (lighty < NIGHTTIME_ELEVATION_COS) + { + lighty = -lighty; + } + lighty = llmax(0.f, lighty); + if(lighty > 0.f) + { + lighty = 1.f / lighty; } + componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); + + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; - mSunDiffuse = vary_SunlightColor; - mSunAmbient = vary_AmbientColor; - mMoonDiffuse = vary_SunlightColor; - mMoonAmbient = vary_AmbientColor; + //brightness of surface both sunlight and ambient + mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); - mTotalAmbient = LLColor4(vary_AmbientColor, 1.0f); + mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance)); + mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); + mTotalAmbient = mSunAmbient; mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); } - //========================================================================= namespace { diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index d08e2bbd03..ceb941bf7c 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -455,6 +455,9 @@ private: void calculateHeavnlyBodyPositions(); void calculateLightSettings(); + LLColor3 getLightAttenuation(F32 distance) const; + LLColor3 getLightTransmittance() const; + LLColor3 gammaCorrect(const LLColor3& in) const; LLVector3 mSunDirection; LLVector3 mMoonDirection; -- cgit v1.2.3 From 096ea05a936d178ce0533708edab27708e9e718f Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 8 Mar 2018 00:04:03 +0000 Subject: Rename getFogColor from water and sky settings to getWaterFogColor and getSkyFogColor. --- indra/llinventory/llsettingswater.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 92190fa7b1..e9d8cb9613 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -76,22 +76,22 @@ public: setValue(SETTING_BLUR_MULTIPILER, val); } - LLColor3 getFogColor() const + LLColor3 getWaterFogColor() const { return LLColor3(mSettings[SETTING_FOG_COLOR]); } - void setFogColor(LLColor3 val) + void setWaterFogColor(LLColor3 val) { setValue(SETTING_FOG_COLOR, val); } - F32 getFogDensity() const + F32 getWaterFogDensity() const { return mSettings[SETTING_FOG_DENSITY].asReal(); } - void setFogDensity(F32 val) + void setWaterFogDensity(F32 val) { setValue(SETTING_FOG_DENSITY, val); } -- cgit v1.2.3 From 087e21082512bce899e435537d7d60a09ef6eaca Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 8 Mar 2018 16:09:29 +0000 Subject: Add LLVoSky wrapper for current env sky light direction. Make LLVo classes use LLVoSky wrappers instead of direct access. Isolate more legacy haze param usage w/in settings. --- indra/llinventory/llsettingssky.cpp | 58 ++++++++++++++++++++----------------- indra/llinventory/llsettingssky.h | 50 +++++++------------------------- 2 files changed, 42 insertions(+), 66 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 9b9d10718c..e84939800b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,8 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#pragma optimize("", off) + //========================================================================= namespace { @@ -574,10 +576,7 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) // AdvancedAtmospherics TODO // These need to be translated into density profile info in the new settings format... // LEGACY_ATMOSPHERICS - if (legacy.has(SETTING_AMBIENT)) - { - newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); - } + if (legacy.has(SETTING_BLUE_DENSITY)) { newsettings[SETTING_BLUE_DENSITY] = LLColor3(legacy[SETTING_BLUE_DENSITY]).getValue(); @@ -603,6 +602,10 @@ LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) newsettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); } + if (legacy.has(SETTING_AMBIENT)) + { + newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); + } if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); @@ -756,6 +759,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() // this is used later for sunlight modulation at various altitudes LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const { +// LEGACY_ATMOSPHERICS LLColor3 blue_density = getBlueDensity(); F32 haze_density = getHazeDensity(); F32 density_multiplier = getDensityMultiplier(); @@ -766,6 +770,7 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const LLColor3 LLSettingsSky::getLightTransmittance() const { +// LEGACY_ATMOSPHERICS LLColor3 blue_density = getBlueDensity(); F32 haze_density = getHazeDensity(); F32 density_multiplier = getDensityMultiplier(); @@ -788,41 +793,40 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const void LLSettingsSky::calculateLightSettings() { -// LEGACY_ATMOSPHERICS - // Initialize temp variables - LLColor3 sunlight = getSunlightColor(); - LLColor3 ambient = getAmbientColor(); - F32 cloud_shadow = getCloudShadow(); - LLVector3 lightnorm = getLightDirection(); - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes + // Initialize temp variables + LLColor3 sunlight = getSunlightColor(); + LLColor3 ambient = getAmbientColor(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes F32 max_y = getMaxY(); LLColor3 light_atten = getLightAttenuation(max_y); LLColor3 light_transmittance = getLightTransmittance(); - // Compute sunlight from P & lightnorm (for long rays like sky) - /// USE only lightnorm. - // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); + // Compute sunlight from P & lightnorm (for long rays like sky) + /// USE only lightnorm. + // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); - // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; - if (lighty < NIGHTTIME_ELEVATION_COS) - { - lighty = -lighty; - } + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; + if (lighty < NIGHTTIME_ELEVATION_COS) + { + lighty = -lighty; + } lighty = llmax(0.f, lighty); if(lighty > 0.f) - { + { lighty = 1.f / lighty; - } + } componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); - //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; - //brightness of surface both sunlight and ambient + //brightness of surface both sunlight and ambient mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index ceb941bf7c..5c4cacdba0 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -114,64 +114,35 @@ public: setValue(SETTING_AMBIENT, val); } +// LEGACY_ATMOSPHERICS LLColor3 getBlueDensity() const { return LLColor3(mSettings[SETTING_BLUE_DENSITY]); } - void setBlueDensity(const LLColor3 &val) - { - setValue(SETTING_BLUE_DENSITY, val); - } - LLColor3 getBlueHorizon() const { return LLColor3(mSettings[SETTING_BLUE_HORIZON]); } - void setBlueHorizon(const LLColor3 &val) - { - setValue(SETTING_BLUE_HORIZON, val); - } - - F32 getDensityMultiplier() const - { - return mSettings[SETTING_DENSITY_MULTIPLIER].asReal(); - } - - void setDensityMultiplier(F32 val) - { - setValue(SETTING_DENSITY_MULTIPLIER, val); - } - - F32 getDistanceMultiplier() const - { - return mSettings[SETTING_DISTANCE_MULTIPLIER].asReal(); - } - - void setDistanceMultiplier(F32 val) - { - setValue(SETTING_DISTANCE_MULTIPLIER, val); - } - F32 getHazeDensity() const { return mSettings[SETTING_HAZE_DENSITY].asReal(); } - void setHazeDensity(F32 val) + F32 getHazeHorizon() const { - setValue(SETTING_HAZE_DENSITY, val); + return mSettings[SETTING_HAZE_HORIZON].asReal(); } - F32 getHazeHorizon() const + F32 getDensityMultiplier() const { - return mSettings[SETTING_HAZE_HORIZON].asReal(); + return mSettings[SETTING_DENSITY_MULTIPLIER].asReal(); } - void setHazeHorizon(F32 val) + F32 getDistanceMultiplier() const { - setValue(SETTING_HAZE_HORIZON, val); + return mSettings[SETTING_DISTANCE_MULTIPLIER].asReal(); } LLColor3 getCloudColor() const @@ -434,6 +405,10 @@ public: static LLSD translateLegacySettings(LLSD legacy); + LLColor3 getLightAttenuation(F32 distance) const; + LLColor3 getLightTransmittance() const; + LLColor3 gammaCorrect(const LLColor3& in) const; + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -455,9 +430,6 @@ private: void calculateHeavnlyBodyPositions(); void calculateLightSettings(); - LLColor3 getLightAttenuation(F32 distance) const; - LLColor3 getLightTransmittance() const; - LLColor3 gammaCorrect(const LLColor3& in) const; LLVector3 mSunDirection; LLVector3 mMoonDirection; -- cgit v1.2.3 From 89d71617f08825d8def694b3b0ef337d18ee5bf9 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 8 Mar 2018 17:45:43 +0000 Subject: Prepare for validation and storage of legacy haze settings (still pass-through for now). Isolate more use of legacy haze params behind wrapper funcs. --- indra/llinventory/llsettingssky.cpp | 88 ++++++++++++++++++++++++++++++++++--- indra/llinventory/llsettingssky.h | 5 ++- 2 files changed, 87 insertions(+), 6 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e84939800b..0981485e25 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -108,9 +108,36 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_s const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); +const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); + namespace { +LLSettingsSky::validation_list_t legacyHazeValidationList() +{ + static LLSettingsBase::validation_list_t legacyHazeValidation; + if (legacyHazeValidation.empty()) + { + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_DENSITY, true, LLSD::TypeArray, + boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_HORIZON, true, LLSD::TypeArray, + boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + } + return legacyHazeValidation; +} + LLSettingsSky::validation_list_t rayleighValidationList() { static LLSettingsBase::validation_list_t rayleighValidation; @@ -183,6 +210,24 @@ LLSettingsSky::validation_list_t mieValidationList() return mieValidation; } +bool validateLegacyHaze(LLSD &value) +{ + LLSettingsSky::validation_list_t legacyHazeValidations = legacyHazeValidationList(); + llassert(value.type() == LLSD::Type::TypeMap); + LLSD result = LLSettingsBase::settingValidation(value, legacyHazeValidations); + if (result["errors"].size() > 0) + { + LL_WARNS("SETTINGS") << "Legacy Haze Config Validation errors: " << result["errors"] << LL_ENDL; + return false; + } + if (result["warnings"].size() > 0) + { + LL_WARNS("SETTINGS") << "Legacy Haze Config Validation warnings: " << result["errors"] << LL_ENDL; + return false; + } + return true; +} + bool validateRayleighLayers(LLSD &value) { LLSettingsSky::validation_list_t rayleighValidations = rayleighValidationList(); @@ -404,8 +449,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + + validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, @@ -470,6 +516,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); validation.push_back(Validator(SETTING_MIE_CONFIG, true, LLSD::TypeArray, &validateMieLayers)); + validation.push_back(Validator(SETTING_LEGACY_HAZE, false, LLSD::TypeMap, &validateLegacyHaze)); } return validation; } @@ -569,14 +616,45 @@ LLSD LLSettingsSky::defaults() return dfltsetting; } -LLSD LLSettingsSky::translateLegacySettings(LLSD legacy) +LLSD LLSettingsSky::translateLegacyHazeSettings(const LLSD& legacy) { - LLSD newsettings(defaults()); + LLSD legacyhazesettings; // AdvancedAtmospherics TODO // These need to be translated into density profile info in the new settings format... -// LEGACY_ATMOSPHERICS - +// LEGACY_ATMOSPHERICS + if (legacy.has(SETTING_BLUE_DENSITY)) + { + legacyhazesettings[SETTING_BLUE_DENSITY] = LLColor3(legacy[SETTING_BLUE_DENSITY]).getValue(); + } + if (legacy.has(SETTING_BLUE_HORIZON)) + { + legacyhazesettings[SETTING_BLUE_HORIZON] = LLColor3(legacy[SETTING_BLUE_HORIZON]).getValue(); + } + if (legacy.has(SETTING_DENSITY_MULTIPLIER)) + { + legacyhazesettings[SETTING_DENSITY_MULTIPLIER] = LLSD::Real(legacy[SETTING_DENSITY_MULTIPLIER][0].asReal()); + } + if (legacy.has(SETTING_DISTANCE_MULTIPLIER)) + { + legacyhazesettings[SETTING_DISTANCE_MULTIPLIER] = LLSD::Real(legacy[SETTING_DISTANCE_MULTIPLIER][0].asReal()); + } + if (legacy.has(SETTING_HAZE_DENSITY)) + { + legacyhazesettings[SETTING_HAZE_DENSITY] = LLSD::Real(legacy[SETTING_HAZE_DENSITY][0].asReal()); + } + if (legacy.has(SETTING_HAZE_HORIZON)) + { + legacyhazesettings[SETTING_HAZE_HORIZON] = LLSD::Real(legacy[SETTING_HAZE_HORIZON][0].asReal()); + } + + return legacyhazesettings; +} + +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(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 5c4cacdba0..e424d7e3b9 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -79,6 +79,8 @@ public: static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; static const std::string SETTING_MIE_ANISOTROPY_FACTOR; + static const std::string SETTING_LEGACY_HAZE; + typedef std::shared_ptr ptr_t; typedef std::pair azimalt_t; @@ -403,7 +405,8 @@ public: virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); - static LLSD translateLegacySettings(LLSD legacy); + static LLSD translateLegacySettings(const LLSD& legacy); + static LLSD translateLegacyHazeSettings(const LLSD& legacy); LLColor3 getLightAttenuation(F32 distance) const; LLColor3 getLightTransmittance() const; -- cgit v1.2.3 From 54ee5bfc0557d301c0b29e45923a8ced959dbb66 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Thu, 8 Mar 2018 17:46:42 +0000 Subject: Remove MSVC-only debug pragma. --- indra/llinventory/llsettingssky.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0981485e25..940680baab 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,8 +32,6 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#pragma optimize("", off) - //========================================================================= namespace { -- cgit v1.2.3 From 057dda6afe59791f4a6fcf4c5ca8387b8aeda6a8 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Tue, 13 Mar 2018 17:21:10 +0100 Subject: Fix storing legacy haze parameters in inner map by fixing parameter update to not expect them at top level of LLSD for sky settings. --- indra/llinventory/llsettingssky.cpp | 84 +++++++++++++++++++++++++++---------- indra/llinventory/llsettingssky.h | 39 ++++------------- 2 files changed, 69 insertions(+), 54 deletions(-) (limited to 'indra/llinventory') 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; -- cgit v1.2.3 From 79e4a8c28ad29b028ddb907a6ea01f4ef71e822a Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Wed, 14 Mar 2018 00:11:19 +0100 Subject: Fix up atmospheric helpers and transport shader for adv atmo path. Basic hook-up of sky settings to llatmosphere model. Moved mie aniso to be a top-level setting instead of a per-mie-layer setting. --- indra/llinventory/llsettingsbase.cpp | 6 ++++- indra/llinventory/llsettingssky.cpp | 52 +++++++++++++++++++----------------- indra/llinventory/llsettingssky.h | 43 ++++++++++++++++++++++++++++- 3 files changed, 74 insertions(+), 27 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index abe1a1a04a..b763a06ab4 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -207,6 +207,11 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F LLQuaternion q = slerp(mix, LLQuaternion(value), LLQuaternion(other_value)); newvalue = q.getValue(); } + else if (value[0].type() == LLSD::TypeMap) + { + // TODO + // determine if lerping between maps is both feasible and reasonable + } 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. @@ -214,7 +219,6 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F for (size_t i = 0; i < len; ++i) { - newvalue[i] = lerp(value[i].asReal(), other_value[i].asReal(), mix); } } diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 37da95b95e..491381213f 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -200,10 +200,7 @@ LLSettingsSky::validation_list_t mieValidationList() boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); } return mieValidation; } @@ -511,6 +508,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); + validation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); validation.push_back(Validator(SETTING_MIE_CONFIG, true, LLSD::TypeArray, &validateMieLayers)); @@ -522,11 +522,13 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD LLSettingsSky::rayleighConfigDefault() { LLSD dflt_rayleigh; - dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + LLSD dflt_rayleigh_layer; + dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_rayleigh.append(dflt_rayleigh_layer); return dflt_rayleigh; } @@ -556,12 +558,13 @@ LLSD LLSettingsSky::absorptionConfigDefault() LLSD LLSettingsSky::mieConfigDefault() { LLSD dflt_mie; - dflt_mie[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; - dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR] = 0.9f; + LLSD dflt_mie_layer; + dflt_mie_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; + dflt_mie_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_mie_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_mie.append(dflt_mie_layer); return dflt_mie; } @@ -600,16 +603,15 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_TYPE] = "sky"; // defaults are for earth... - dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - - // These are technically capable of handling multiple layers of density config - // and so are expected to be an array, but we make an array of size 1 w/ each default density config - dfltsetting[SETTING_RAYLEIGH_CONFIG].append(rayleighConfigDefault()); - dfltsetting[SETTING_MIE_CONFIG].append(mieConfigDefault()); - dfltsetting[SETTING_ABSORPTION_CONFIG].append(absorptionConfigDefault()); + dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + dfltsetting[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; + + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); + dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); return dfltsetting; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 70d7a1c54f..4fb8c101ee 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -66,6 +66,7 @@ public: static const std::string SETTING_SKY_BOTTOM_RADIUS; static const std::string SETTING_SKY_TOP_RADIUS; static const std::string SETTING_SUN_ARC_RADIANS; + static const std::string SETTING_MIE_ANISOTROPY_FACTOR; static const std::string SETTING_RAYLEIGH_CONFIG; static const std::string SETTING_MIE_CONFIG; @@ -77,7 +78,7 @@ public: static const std::string SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR; static const std::string SETTING_DENSITY_PROFILE_LINEAR_TERM; static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; - static const std::string SETTING_MIE_ANISOTROPY_FACTOR; + static const std::string SETTING_LEGACY_HAZE; @@ -100,6 +101,46 @@ public: static LLSD defaults(); + F32 getPlanetRadius() const + { + return mSettings[SETTING_PLANET_RADIUS].asReal(); + } + + F32 getSkyBottomRadius() const + { + return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); + } + + F32 getSkyTopRadius() const + { + return mSettings[SETTING_SKY_TOP_RADIUS].asReal(); + } + + F32 getSunArcRadians() const + { + return mSettings[SETTING_SUN_ARC_RADIANS].asReal(); + } + + F32 getMieAnisotropy() const + { + return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); + } + + LLSD getRayleighConfigs() const + { + return mSettings[SETTING_RAYLEIGH_CONFIG]; + } + + LLSD getMieConfigs() const + { + return mSettings[SETTING_MIE_CONFIG]; + } + + LLSD getAbsorptionConfigs() const + { + return mSettings[SETTING_ABSORPTION_CONFIG]; + } + LLUUID getBloomTextureId() const { return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); -- cgit v1.2.3 From 03da2bc1a1c7674514c967b0e7408258dba25d77 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 2 May 2018 17:07:06 -0700 Subject: Fixed sky editing floater. --- indra/llinventory/llsettingssky.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index d08e2bbd03..1451162744 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -189,6 +189,11 @@ public: return mSettings[SETTING_CLOUD_TEXTUREID].asUUID(); } + void setCloudNoiseTextureId(const LLUUID &id) + { + setValue(SETTING_CLOUD_TEXTUREID, id); + } + LLColor3 getCloudPosDensity1() const { return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]); @@ -300,6 +305,11 @@ public: return mSettings[SETTING_MAX_Y].asReal(); } + void setMaxY(F32 val) + { + setValue(SETTING_MAX_Y, val); + } + LLQuaternion getMoonRotation() const { return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); @@ -324,6 +334,11 @@ public: return mSettings[SETTING_MOON_TEXTUREID].asUUID(); } + void setMoonTextureId(LLUUID id) + { + setValue(SETTING_MOON_TEXTUREID, id); + } + F32 getStarBrightness() const { return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); @@ -368,6 +383,11 @@ public: return mSettings[SETTING_SUN_TEXTUREID].asUUID(); } + void setSunTextureId(LLUUID id) + { + setValue(SETTING_SUN_TEXTUREID, id); + } + // Internal/calculated settings LLVector3 getLightDirection() const { -- cgit v1.2.3 From cef4e29b901c5a8964e53ec3eb6659faeea0059a Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 11 May 2018 20:10:08 +0300 Subject: MAINT-8344 Day cycle editor (part 1) --- indra/llinventory/llsettingsdaycycle.cpp | 49 +++++++++++++++++++++++++++++++- indra/llinventory/llsettingsdaycycle.h | 3 ++ 2 files changed, 51 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 70826d1410..3f60430715 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -483,7 +483,7 @@ void LLSettingsDay::updateSettings() //========================================================================= LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) { - if ((trackno < 1) || (trackno >= TRACK_MAX)) + if ((trackno < 0) || (trackno >= TRACK_MAX)) { LL_WARNS("DAYCYCLE") << "Attempt get track (#" << trackno << ") out of range!" << LL_ENDL; return KeyframeList_t(); @@ -508,6 +508,17 @@ void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 ke setDirtyFlag(true); } +const LLSettingsWaterPtr_t LLSettingsDay::getWaterAtKeyframe(F32 keyframe) +{ + // todo: better way to identify keyframes? + CycleTrack_t::iterator iter = mDayTracks[TRACK_WATER].find(keyframe); + if (iter != mDayTracks[TRACK_WATER].end()) + { + return std::dynamic_pointer_cast(iter->second); + } + + return LLSettingsWaterPtr_t(NULL); +} void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track) { @@ -521,6 +532,42 @@ void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe setDirtyFlag(true); } +const LLSettingsSkyPtr_t LLSettingsDay::getSkyAtKeyframe(F32 keyframe, S32 track) +{ + if ((track < 1) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL; + return LLSettingsSkyPtr_t(NULL); + } + + // todo: better way to identify keyframes? + CycleTrack_t::iterator iter = mDayTracks[track].find(keyframe); + if (iter != mDayTracks[track].end()) + { + return std::dynamic_pointer_cast(iter->second); + } + + return LLSettingsSkyPtr_t(NULL); +} + +const LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 track) +{ + if ((track < 0) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL; + return LLSettingsBase::ptr_t(NULL); + } + + // todo: better way to identify keyframes? + CycleTrack_t::iterator iter = mDayTracks[track].find(keyframe); + if (iter != mDayTracks[track].end()) + { + return iter->second; + } + + return LLSettingsSkyPtr_t(NULL); +} + LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F32 keyframe) { return TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index da572572c4..93c275bfb8 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -88,7 +88,10 @@ public: KeyframeList_t getTrackKeyframes(S32 track); void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe); + const LLSettingsWaterPtr_t getWaterAtKeyframe(F32 keyframe); void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track); + const LLSettingsSkyPtr_t getSkyAtKeyframe(F32 keyframe, S32 track); + const LLSettingsBase::ptr_t getSettingsAtKeyframe(F32 keyframe, S32 track); //--------------------------------------------------------------------- void startDayCycle(); -- cgit v1.2.3 From 3925e37532476c526375fd76143b2b5e1dcce9b9 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 15 May 2018 17:17:51 -0700 Subject: Fix the blend code to record the amount of the blend and to store what is being blended towards. --- indra/llinventory/llsettingsbase.cpp | 11 ++++++++--- indra/llinventory/llsettingsbase.h | 12 ++++++++++++ indra/llinventory/llsettingssky.cpp | 24 +++++++++++++++++++----- indra/llinventory/llsettingssky.h | 35 ++++++++++++++++++++++++++++++++--- indra/llinventory/llsettingswater.cpp | 8 ++++++-- indra/llinventory/llsettingswater.h | 9 ++++++++- 6 files changed, 85 insertions(+), 14 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index abe1a1a04a..f2dfeaf154 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -58,14 +58,16 @@ const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), mDirty(true), - mAssetID() + mAssetID(), + mBlendedFactor(0.0) { } LLSettingsBase::LLSettingsBase(const LLSD setting) : mSettings(setting), mDirty(true), - mAssetID() + mAssetID(), + mBlendedFactor(0.0) { } @@ -224,9 +226,12 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F break; + case LLSD::TypeUUID: + newSettings[key_name] = value.asUUID(); + break; + // case LLSD::TypeBoolean: // case LLSD::TypeString: -// case LLSD::TypeUUID: // case LLSD::TypeURI: // case LLSD::TypeBinary: // case LLSD::TypeDate: diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 62a88cde73..2220cca336 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -96,6 +96,7 @@ public: inline void replaceSettings(LLSD settings) { mSettings = settings; + mBlendedFactor = 0.0; setDirtyFlag(true); } @@ -146,6 +147,11 @@ public: setValue(name, value.getValue()); } + inline F64 getBlendFactor() const + { + return mBlendedFactor; + } + // Note this method is marked const but may modify the settings object. // (note the internal const cast). This is so that it may be called without // special consideration from getters. @@ -237,11 +243,17 @@ protected: LLSD cloneSettings() const; + inline void setBlendFactor(F64 blendfactor) + { + mBlendedFactor = blendfactor; + } + private: bool mDirty; LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; + F64 mBlendedFactor; }; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 7da3a336cc..45c1ca1d7f 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -106,6 +106,10 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_s const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); +const LLUUID LLSettingsSky::DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver +const LLUUID LLSettingsSky::DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver +const LLUUID LLSettingsSky::DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); + namespace { @@ -310,12 +314,18 @@ bool validateMieLayers(LLSD &value) //========================================================================= LLSettingsSky::LLSettingsSky(const LLSD &data) : - LLSettingsBase(data) + LLSettingsBase(data), + mNextSunTextureId(), + mNextMoonTextureId(), + mNextCloudTextureId() { } LLSettingsSky::LLSettingsSky(): - LLSettingsBase() + LLSettingsBase(), + mNextSunTextureId(), + mNextMoonTextureId(), + mNextCloudTextureId() { } @@ -325,6 +335,10 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); + setBlendFactor(blendf); + mNextSunTextureId = other->getSunTextureId(); + mNextMoonTextureId = other->getMoonTextureId(); + mNextCloudTextureId = other->getCloudNoiseTextureId(); } @@ -557,9 +571,9 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; - dfltsetting[SETTING_CLOUD_TEXTUREID] = LLUUID::null; - dfltsetting[SETTING_MOON_TEXTUREID] = IMG_MOON; // gMoonTextureID; // These two are returned by the login... wow! - dfltsetting[SETTING_SUN_TEXTUREID] = IMG_SUN; // gSunTextureID; + dfltsetting[SETTING_CLOUD_TEXTUREID] = DEFAULT_CLOUD_ID; + dfltsetting[SETTING_MOON_TEXTUREID] = DEFAULT_MOON_ID; // gMoonTextureID; // These two are returned by the login... wow! + dfltsetting[SETTING_SUN_TEXTUREID] = DEFAULT_SUN_ID; // gSunTextureID; dfltsetting[SETTING_TYPE] = "sky"; diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 1451162744..59a9dc9a43 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -79,6 +79,10 @@ public: static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; static const std::string SETTING_MIE_ANISOTROPY_FACTOR; + static const LLUUID DEFAULT_SUN_ID; + static const LLUUID DEFAULT_MOON_ID; + static const LLUUID DEFAULT_CLOUD_ID; + typedef std::shared_ptr ptr_t; typedef std::pair azimalt_t; @@ -449,10 +453,31 @@ public: return mTotalAmbient; } - virtual validation_list_t getValidationList() const override; - static validation_list_t validationList(); + //===================================================================== + virtual void loadTextures() { }; + + //===================================================================== + virtual validation_list_t getValidationList() const override; + static validation_list_t validationList(); + + static LLSD translateLegacySettings(LLSD legacy); + + //===================================================================== + // transient properties used in animations. + LLUUID getNextSunTextureId() const + { + return mNextSunTextureId; + } + + LLUUID getNextMoonTextureId() const + { + return mNextMoonTextureId; + } - static LLSD translateLegacySettings(LLSD legacy); + LLUUID getNextCloudNoiseTextureId() const + { + return mNextCloudTextureId; + } protected: static const std::string SETTING_LEGACY_EAST_ANGLE; @@ -492,6 +517,10 @@ private: LLColor4 mTotalAmbient; + LLUUID mNextSunTextureId; + LLUUID mNextMoonTextureId; + LLUUID mNextCloudTextureId; + typedef std::map mapNameToUniformId_t; static mapNameToUniformId_t sNameToUniformMapping; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index a72cbc4136..c6798945a3 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -72,12 +72,14 @@ const LLUUID LLSettingsWater::DEFAULT_WATER_NORMAL_ID(DEFAULT_WATER_NORMAL); //========================================================================= LLSettingsWater::LLSettingsWater(const LLSD &data) : - LLSettingsBase(data) + LLSettingsBase(data), + mNextNormalMapID() { } LLSettingsWater::LLSettingsWater() : - LLSettingsBase() + LLSettingsBase(), + mNextNormalMapID() { } @@ -167,6 +169,8 @@ void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); + setBlendFactor(blendf); + mNextNormalMapID = other->getNormalMapID(); } LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 92190fa7b1..64de4486ca 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -199,6 +199,13 @@ public: return mWaterFogKS; } + //------------------------------------------- + LLUUID getNextNormalMapID() const + { + return mNextNormalMapID; + } + + virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); @@ -224,7 +231,7 @@ protected: F32 mWaterFogKS; private: - + LLUUID mNextNormalMapID; }; #endif -- cgit v1.2.3 From 28d0fa0c69cc5d45844f9f542d99d04bbded16ad Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 16 May 2018 20:25:42 +0300 Subject: MAINT-8344 Day cycle editor (part 2) --- indra/llinventory/llsettingsdaycycle.cpp | 47 ++++++++++++++++++++++++++++++++ indra/llinventory/llsettingsdaycycle.h | 2 ++ 2 files changed, 49 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 3f60430715..5a6280884d 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -502,6 +502,53 @@ LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) return keyframes; } +bool LLSettingsDay::moveTrackKeyframe(S32 trackno, F32 old_frame, F32 new_frame) +{ + if ((trackno < 0) || (trackno >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt get track (#" << trackno << ") out of range!" << LL_ENDL; + return false; + } + + if (old_frame == new_frame) + { + return false; + } + + CycleTrack_t &track = mDayTracks[trackno]; + CycleTrack_t::iterator iter = track.find(old_frame); + if (iter != track.end()) + { + LLSettingsBase::ptr_t base = iter->second; + track.erase(iter); + track[llclamp(new_frame, 0.0f, 1.0f)] = base; + return true; + } + + return false; + +} + +bool LLSettingsDay::removeTrackKeyframe(S32 trackno, F32 frame) +{ + if ((trackno < 0) || (trackno >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt get track (#" << trackno << ") out of range!" << LL_ENDL; + return false; + } + + CycleTrack_t &track = mDayTracks[trackno]; + CycleTrack_t::iterator iter = track.find(frame); + if (iter != track.end()) + { + LLSettingsBase::ptr_t base = iter->second; + track.erase(iter); + return true; + } + + return false; +} + void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe) { mDayTracks[TRACK_WATER][llclamp(keyframe, 0.0f, 1.0f)] = water; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 93c275bfb8..a869d4970c 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -86,6 +86,8 @@ public: //--------------------------------------------------------------------- KeyframeList_t getTrackKeyframes(S32 track); + bool moveTrackKeyframe(S32 track, F32 old_frame, F32 new_frame); + bool removeTrackKeyframe(S32 track, F32 frame); void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe); const LLSettingsWaterPtr_t getWaterAtKeyframe(F32 keyframe); -- cgit v1.2.3 From 4975bd03c12673778616e1cca1811bf906bb42a6 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 16 May 2018 13:42:48 -0700 Subject: Splitting the blender up to support manual positioning as well as time. Phase1 --- indra/llinventory/llsettingsbase.cpp | 30 ++++++++++---- indra/llinventory/llsettingsbase.h | 79 ++++++++++++++++++++++++------------ 2 files changed, 74 insertions(+), 35 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index f2dfeaf154..daf42fc073 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -52,8 +52,6 @@ const std::string LLSettingsBase::SETTING_NAME("name"); const std::string LLSettingsBase::SETTING_HASH("hash"); const std::string LLSettingsBase::SETTING_TYPE("type"); -const F64Seconds LLSettingsBlender::DEFAULT_THRESHOLD(0.01); - //========================================================================= LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), @@ -535,21 +533,37 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) } //========================================================================= -void LLSettingsBlender::update(F64Seconds timedelta) +void LLSettingsBlender::update(F64 blendf) { - mTimeSpent += timedelta; - if (mTimeSpent >= mSeconds) +} + +F64 LLSettingsBlender::setPosition(F64 blendf) +{ + if (blendf >= 1.0) { + mTarget->replaceSettings(mFinal->getSettings()); LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon mOnFinished(shared_from_this()); - return; + return 1.0; } - - F64 blendf = fmod(mTimeSpent.value(), mSeconds.value()) / mSeconds.value(); + blendf = llclamp(blendf, 0.0, 1.0); //_WARNS("LAPRAS") << "blending at " << (blendf * 100.0f) << "%" << LL_ENDL; mTarget->replaceSettings(mInitial->getSettings()); mTarget->blend(mFinal, blendf); + + return blendf; } +//------------------------------------------------------------------------- +void LLSettingsBlenderTimeDelta::update(F64 timedelta) +{ + mTimeSpent += F64Seconds(timedelta); + + F64 blendf = fmod(mTimeSpent.value(), mBlendSpan.value()) / mBlendSpan.value(); + + // Note no clamp here. + + setPosition(blendf); +} diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 2220cca336..ee0a86010c 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -264,67 +264,92 @@ public: typedef boost::signals2::signal finish_signal_t; typedef boost::signals2::connection connection_t; - static const F64Seconds DEFAULT_THRESHOLD; - LLSettingsBlender(const LLSettingsBase::ptr_t &target, - const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds) : + const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0) : + mOnFinished(), mTarget(target), mInitial(initsetting), - mFinal(endsetting), - mSeconds(seconds), - mOnFinished(), - mLastUpdate(0.0f), - mTimeSpent(0.0f) + mFinal(endsetting) { mTarget->replaceSettings(mInitial->getSettings()); - mTimeStart = F64Seconds(LLDate::now().secondsSinceEpoch()); - mLastUpdate = mTimeStart; } - ~LLSettingsBlender() {} + virtual ~LLSettingsBlender() {} - void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds ) + virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0) { mInitial = initsetting; mFinal = endsetting; - mSeconds = seconds; mTarget->replaceSettings(mInitial->getSettings()); - mTimeStart.value(LLDate::now().secondsSinceEpoch()); - mLastUpdate = mTimeStart; - mTimeSpent.value(0.0f); - } - - connection_t setOnFinished(const finish_signal_t::slot_type &onfinished) - { - return mOnFinished.connect(onfinished); } - LLSettingsBase::ptr_t getTarget() const + LLSettingsBase::ptr_t getTarget() const { return mTarget; } - LLSettingsBase::ptr_t getInitial() const + LLSettingsBase::ptr_t getInitial() const { return mInitial; } - LLSettingsBase::ptr_t getFinal() const + LLSettingsBase::ptr_t getFinal() const { return mFinal; } - void update(F64Seconds time); + connection_t setOnFinished(const finish_signal_t::slot_type &onfinished) + { + return mOnFinished.connect(onfinished); + } + + virtual void update(F64 blendf); + virtual F64 setPosition(F64 blendf); private: + finish_signal_t mOnFinished; + LLSettingsBase::ptr_t mTarget; LLSettingsBase::ptr_t mInitial; LLSettingsBase::ptr_t mFinal; - F64Seconds mSeconds; - finish_signal_t mOnFinished; +}; + +class LLSettingsBlenderTimeDelta : public LLSettingsBlender +{ +public: + LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target, + const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds) : + LLSettingsBlender(target, initsetting, endsetting, seconds.value()), + mBlendSpan(seconds), + mLastUpdate(0.0f), + mTimeSpent(0.0f) + { + mTimeStart = F64Seconds(LLDate::now().secondsSinceEpoch()); + mLastUpdate = mTimeStart; + } + + virtual ~LLSettingsBlenderTimeDelta() + { + } + + virtual void reset(LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0) override + { + LLSettingsBlender::reset(initsetting, endsetting, span); + + mBlendSpan.value(span); + mTimeStart.value(LLDate::now().secondsSinceEpoch()); + mLastUpdate = mTimeStart; + mTimeSpent.value(0.0f); + } + + virtual void update(F64 timedelta) override; + +private: + F64Seconds mBlendSpan; F64Seconds mLastUpdate; F64Seconds mTimeSpent; F64Seconds mTimeStart; }; + #endif -- cgit v1.2.3 From b117a9ea197a084eeec1e8330dbe7c562423e248 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 17 May 2018 12:05:31 -0700 Subject: Fix end of cycle trigger for time blender. --- indra/llinventory/llsettingsbase.cpp | 17 ++++++++++++++--- indra/llinventory/llsettingsbase.h | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index daf42fc073..a6a7a9acf9 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -542,9 +542,7 @@ F64 LLSettingsBlender::setPosition(F64 blendf) { if (blendf >= 1.0) { - mTarget->replaceSettings(mFinal->getSettings()); - LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon - mOnFinished(shared_from_this()); + triggerComplete(); return 1.0; } blendf = llclamp(blendf, 0.0, 1.0); @@ -556,11 +554,24 @@ F64 LLSettingsBlender::setPosition(F64 blendf) return blendf; } +void LLSettingsBlender::triggerComplete() +{ + mTarget->replaceSettings(mFinal->getSettings()); + LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon + mOnFinished(shared_from_this()); +} + //------------------------------------------------------------------------- void LLSettingsBlenderTimeDelta::update(F64 timedelta) { mTimeSpent += F64Seconds(timedelta); + if (mTimeSpent > mBlendSpan) + { + triggerComplete(); + return; + } + F64 blendf = fmod(mTimeSpent.value(), mBlendSpan.value()) / mBlendSpan.value(); // Note no clamp here. diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index ee0a86010c..d304638d20 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -306,6 +306,9 @@ public: virtual void update(F64 blendf); virtual F64 setPosition(F64 blendf); +protected: + void triggerComplete(); + private: finish_signal_t mOnFinished; -- cgit v1.2.3 From 430c5cd23558ba42c7da0e31845a3677e66f1fed Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 17 May 2018 16:16:33 -0700 Subject: Self contained looping track blender. Will blend over time across an entire track in a day cycle. --- indra/llinventory/llsettingsbase.h | 6 +++--- indra/llinventory/llsettingsdaycycle.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index d304638d20..6ab3032a3d 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -271,7 +271,8 @@ public: mInitial(initsetting), mFinal(endsetting) { - mTarget->replaceSettings(mInitial->getSettings()); + if (mInitial) + mTarget->replaceSettings(mInitial->getSettings()); } virtual ~LLSettingsBlender() {} @@ -309,7 +310,6 @@ public: protected: void triggerComplete(); -private: finish_signal_t mOnFinished; LLSettingsBase::ptr_t mTarget; @@ -347,7 +347,7 @@ public: virtual void update(F64 timedelta) override; -private: +protected: F64Seconds mBlendSpan; F64Seconds mLastUpdate; F64Seconds mTimeSpent; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index a869d4970c..15a5b29f9f 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -60,7 +60,7 @@ public: typedef std::map CycleTrack_t; typedef std::vector CycleList_t; - typedef std::shared_ptr ptr_t; + typedef std::shared_ptr ptr_t; typedef std::vector KeyframeList_t; typedef std::pair TrackBound_t; -- cgit v1.2.3 From 39fb9cc9b4221b6fb715e9f59ae5512b76baa1ba Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Fri, 18 May 2018 00:23:58 +0100 Subject: Fix Mie Config validation in sky settings. Start cleanup of heavenly body rendering. --- indra/llinventory/llsettingssky.cpp | 16 ++++++++-------- indra/llinventory/llsettingssky.h | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8cf430292b..be26439cee 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -206,7 +206,10 @@ LLSettingsSky::validation_list_t mieValidationList() boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); } return mieValidation; } @@ -348,7 +351,7 @@ bool validateMieLayers(LLSD &value) } if (result["warnings"].size() > 0) { - LL_WARNS("SETTINGS") << "Mie Config Validation warnings: " << result["errors"] << LL_ENDL; + LL_WARNS("SETTINGS") << "Mie Config Validation warnings: " << result["warnings"] << LL_ENDL; return false; } return true; @@ -421,7 +424,6 @@ LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const skipSet.insert(SETTING_RAYLEIGH_CONFIG); skipSet.insert(SETTING_MIE_CONFIG); skipSet.insert(SETTING_ABSORPTION_CONFIG); - skipSet.insert(SETTING_MIE_ANISOTROPY_FACTOR); } return skipSet; @@ -538,9 +540,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); - - validation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); @@ -595,6 +595,7 @@ LLSD LLSettingsSky::mieConfigDefault() dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; dflt_mie_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; dflt_mie_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_mie_layer[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; dflt_mie.append(dflt_mie_layer); return dflt_mie; } @@ -637,8 +638,7 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - dfltsetting[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 7a02c944a3..63a20e0d48 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -31,6 +31,12 @@ #include "llsettingsbase.h" #include "v4coloru.h" +const F32 EARTH_RADIUS = 6.370e6f; +const F32 SUN_RADIUS = 695.508e6f; +const F32 SUN_DIST = 149598.260e6f; +const F32 MOON_RADIUS = 1.737e6f; +const F32 MOON_DIST = 384.400e6f; + class LLSettingsSky: public LLSettingsBase { public: -- cgit v1.2.3 From 8082cb86682c008389cb8127f295e6566ec368e5 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Fri, 18 May 2018 23:14:56 +0100 Subject: Make nighttime elev constant _SIN, since it uses a sin value. Put that constant in sky settings and eliminate dups. Fix up logic around when to use heavenly bodies (fix broken moon in basic sky). Remove unnecessary clip to horizon. Put in temp code to ena/dis sun/moon based on LLEnvironment::getIsDaytime(). --- indra/llinventory/llsettingssky.cpp | 14 ++++++++------ indra/llinventory/llsettingssky.h | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index be26439cee..c5dfd765f2 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -51,9 +51,6 @@ namespace const F32 LLSettingsSky::DOME_OFFSET(0.96f); const F32 LLSettingsSky::DOME_RADIUS(15000.f); -const F32 LLSettingsSky::NIGHTTIME_ELEVATION(-8.0f); // degrees -const F32 LLSettingsSky::NIGHTTIME_ELEVATION_COS((F32)sin(NIGHTTIME_ELEVATION*DEG_TO_RAD)); - //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); @@ -816,6 +813,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() { mSunDirection = DUE_EAST * getSunRotation(); mSunDirection.normalize(); + mMoonDirection = DUE_EAST * getMoonRotation(); mMoonDirection.normalize(); @@ -824,7 +822,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() { mLightDirection = mSunDirection; } - else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_COS) + else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_SIN) { // clamp v1 to 0 so sun never points up and causes weirdness on some machines LLVector3 vec(mSunDirection); @@ -834,7 +832,11 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() } else { - mLightDirection = mMoonDirection; + // clamp v1 to 0 so moon never points up and causes weirdness on some machines + LLVector3 vec(mMoonDirection); + vec.mV[1] = 0.0; + vec.normalize(); + mLightDirection = vec; } // calculate the clamp lightnorm for sky (to prevent ugly banding in sky @@ -993,7 +995,7 @@ void LLSettingsSky::calculateLightSettings() // and vary_sunlight will work properly with moon light F32 lighty = lightnorm[1]; - if (lighty < NIGHTTIME_ELEVATION_COS) + if (lighty < NIGHTTIME_ELEVATION_SIN) { lighty = -lighty; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 63a20e0d48..8e96735abf 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -37,6 +37,9 @@ const F32 SUN_DIST = 149598.260e6f; const F32 MOON_RADIUS = 1.737e6f; const F32 MOON_DIST = 384.400e6f; +const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees +const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); + class LLSettingsSky: public LLSettingsBase { public: @@ -504,9 +507,6 @@ private: static LLSD absorptionConfigDefault(); static LLSD mieConfigDefault(); - static const F32 NIGHTTIME_ELEVATION; - static const F32 NIGHTTIME_ELEVATION_COS; - void calculateHeavnlyBodyPositions(); void calculateLightSettings(); -- cgit v1.2.3 From 190fa8614c5630f7f360ce028ed08879af308511 Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Fri, 18 May 2018 23:16:56 +0100 Subject: Remove MSVC debug pragmas and comment out code to dump example grids.xml file w/ hard-coded grids. --- indra/llinventory/llsettingssky.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c5dfd765f2..25d197d9be 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,8 +32,6 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#pragma optimize("", off) - //========================================================================= namespace { -- cgit v1.2.3 From 044b80e4e1a7b55f46e6f3b52c9cae6d9c6df3eb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 22 May 2018 10:49:55 -0700 Subject: Manual blender for use in day editing dialog. --- indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsbase.h | 7 ++--- indra/llinventory/llsettingsdaycycle.cpp | 46 +++++++++++++++----------------- indra/llinventory/llsettingsdaycycle.h | 10 ++++--- 4 files changed, 32 insertions(+), 33 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index a6a7a9acf9..f870ec8904 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -535,7 +535,7 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) //========================================================================= void LLSettingsBlender::update(F64 blendf) { - + setPosition(blendf); } F64 LLSettingsBlender::setPosition(F64 blendf) diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 6ab3032a3d..d00e340b4b 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -265,7 +265,7 @@ public: typedef boost::signals2::connection connection_t; LLSettingsBlender(const LLSettingsBase::ptr_t &target, - const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0) : + const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting) : mOnFinished(), mTarget(target), mInitial(initsetting), @@ -277,8 +277,9 @@ public: virtual ~LLSettingsBlender() {} - virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0) + virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 /*span*/ = 1.0) { + // note: the 'span' reset parameter is unused by the base class. mInitial = initsetting; mFinal = endsetting; mTarget->replaceSettings(mInitial->getSettings()); @@ -322,7 +323,7 @@ class LLSettingsBlenderTimeDelta : public LLSettingsBlender public: LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target, const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds) : - LLSettingsBlender(target, initsetting, endsetting, seconds.value()), + LLSettingsBlender(target, initsetting, endsetting), mBlendSpan(seconds), mLastUpdate(0.0f), mTimeSpent(0.0f) diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 5a6280884d..aa3fd4e0e6 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -551,23 +551,15 @@ bool LLSettingsDay::removeTrackKeyframe(S32 trackno, F32 frame) void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe) { - mDayTracks[TRACK_WATER][llclamp(keyframe, 0.0f, 1.0f)] = water; - setDirtyFlag(true); + setSettingsAtKeyframe(water, keyframe, TRACK_WATER); } -const LLSettingsWaterPtr_t LLSettingsDay::getWaterAtKeyframe(F32 keyframe) +LLSettingsWater::ptr_t LLSettingsDay::getWaterAtKeyframe(F32 keyframe) const { - // todo: better way to identify keyframes? - CycleTrack_t::iterator iter = mDayTracks[TRACK_WATER].find(keyframe); - if (iter != mDayTracks[TRACK_WATER].end()) - { - return std::dynamic_pointer_cast(iter->second); - } - - return LLSettingsWaterPtr_t(NULL); + return std::dynamic_pointer_cast(getSettingsAtKeyframe(keyframe, TRACK_WATER)); } -void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track) +void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, F32 keyframe, S32 track) { if ((track < 1) || (track >= TRACK_MAX)) { @@ -575,44 +567,48 @@ void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe return; } - mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = sky; - setDirtyFlag(true); + setSettingsAtKeyframe(sky, keyframe, track); } -const LLSettingsSkyPtr_t LLSettingsDay::getSkyAtKeyframe(F32 keyframe, S32 track) +LLSettingsSky::ptr_t LLSettingsDay::getSkyAtKeyframe(F32 keyframe, S32 track) const { if ((track < 1) || (track >= TRACK_MAX)) { LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL; - return LLSettingsSkyPtr_t(NULL); + return LLSettingsSky::ptr_t(); } - // todo: better way to identify keyframes? - CycleTrack_t::iterator iter = mDayTracks[track].find(keyframe); - if (iter != mDayTracks[track].end()) + return std::dynamic_pointer_cast(getSettingsAtKeyframe(keyframe, track)); +} + +void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, F32 keyframe, S32 track) +{ + if ((track < 0) || (track >= TRACK_MAX)) { - return std::dynamic_pointer_cast(iter->second); + LL_WARNS("DAYCYCLE") << "Attempt to set track (#" << track << ") out of range!" << LL_ENDL; + return; } - return LLSettingsSkyPtr_t(NULL); + mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings; + setDirtyFlag(true); } -const LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 track) +LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 track) const { if ((track < 0) || (track >= TRACK_MAX)) { LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL; - return LLSettingsBase::ptr_t(NULL); + return LLSettingsBase::ptr_t(); } // todo: better way to identify keyframes? - CycleTrack_t::iterator iter = mDayTracks[track].find(keyframe); + CycleTrack_t::const_iterator iter = mDayTracks[track].find(keyframe); if (iter != mDayTracks[track].end()) { return iter->second; } - return LLSettingsSkyPtr_t(NULL); + return LLSettingsBase::ptr_t(); } LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F32 keyframe) diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 15a5b29f9f..9a89031aed 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -33,6 +33,8 @@ class LLSettingsWater; class LLSettingsSky; +// These are alias for LLSettingsWater::ptr_t and LLSettingsSky::ptr_t respectively. +// Here for definitions only. typedef std::shared_ptr LLSettingsWaterPtr_t; typedef std::shared_ptr LLSettingsSkyPtr_t; @@ -84,16 +86,16 @@ public: static LLSD defaults(); //--------------------------------------------------------------------- - KeyframeList_t getTrackKeyframes(S32 track); bool moveTrackKeyframe(S32 track, F32 old_frame, F32 new_frame); bool removeTrackKeyframe(S32 track, F32 frame); void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe); - const LLSettingsWaterPtr_t getWaterAtKeyframe(F32 keyframe); + LLSettingsWaterPtr_t getWaterAtKeyframe(F32 keyframe) const; void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track); - const LLSettingsSkyPtr_t getSkyAtKeyframe(F32 keyframe, S32 track); - const LLSettingsBase::ptr_t getSettingsAtKeyframe(F32 keyframe, S32 track); + LLSettingsSkyPtr_t getSkyAtKeyframe(F32 keyframe, S32 track) const; + void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, F32 keyframe, S32 track); + LLSettingsBase::ptr_t getSettingsAtKeyframe(F32 keyframe, S32 track) const; //--------------------------------------------------------------------- void startDayCycle(); -- cgit v1.2.3 From 13536bb273b7413aa4461c8eeaf5a6a865f4234d Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Tue, 22 May 2018 21:42:54 +0100 Subject: Remove some obsolete sky funcs. Remove Matrix3/4 funcs using LLQuat 4-float init incorrectly (they are redundant to angle/axis versions anyway). Fix up tests referring to removed funcs above. --- indra/llinventory/llsettingssky.cpp | 45 +++++++++++++++++++++++++------------ indra/llinventory/llsettingssky.h | 3 +++ 2 files changed, 34 insertions(+), 14 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 25d197d9be..6b8acac3da 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -35,6 +35,7 @@ //========================================================================= namespace { + // vectors in +x at, +y up, +z right coord sys const LLVector3 DUE_EAST(0.0f, 0.0f, 1.0); const LLVector3 VECT_ZENITH(0.f, 1.f, 0.f); const LLVector3 VECT_NORTHSOUTH(1.f, 0.f, 0.f); @@ -599,7 +600,12 @@ LLSD LLSettingsSky::defaults() { LLSD dfltsetting; LLQuaternion sunquat; + + // we're using the roll value of 80 degrees from horizon + // with an euler angle conversion meant for a +x right, +y up, +z at coord sys here sunquat.setEulerAngles(1.39626, 0.0, 0.0); // 80deg Azumith/0deg East + + // then we're using the conjugate which does not give the opposite direction LLQuaternion moonquat = ~sunquat; // Magic constants copied form dfltsetting.xml @@ -807,34 +813,41 @@ void LLSettingsSky::updateSettings() calculateLightSettings(); } +bool LLSettingsSky::getIsSunUp() const +{ + LLVector3 sunDir = getSunDirection(); + return sunDir.mV[1] > NIGHTTIME_ELEVATION_SIN; +} + +bool LLSettingsSky::getIsMoonUp() const +{ + LLVector3 moonDir = getMoonDirection(); + return moonDir.mV[1] > NIGHTTIME_ELEVATION_SIN; +} + void LLSettingsSky::calculateHeavnlyBodyPositions() { - mSunDirection = DUE_EAST * getSunRotation(); + LLQuaternion sunq = getSunRotation(); + LLQuaternion moonq = getMoonRotation(); + + mSunDirection = DUE_EAST * sunq; mSunDirection.normalize(); - mMoonDirection = DUE_EAST * getMoonRotation(); + mMoonDirection = DUE_EAST * moonq; mMoonDirection.normalize(); // is the normal from the sun or the moon - if (mSunDirection.mV[1] >= 0.0) + if (getIsSunUp()) { mLightDirection = mSunDirection; } - else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_SIN) + else if (getIsMoonUp()) { - // clamp v1 to 0 so sun never points up and causes weirdness on some machines - LLVector3 vec(mSunDirection); - vec.mV[1] = 0.0; - vec.normalize(); - mLightDirection = vec; + mLightDirection = mMoonDirection; } else { - // clamp v1 to 0 so moon never points up and causes weirdness on some machines - LLVector3 vec(mMoonDirection); - vec.mV[1] = 0.0; - vec.normalize(); - mLightDirection = vec; + mLightDirection = LLVector3::z_axis; } // calculate the clamp lightnorm for sky (to prevent ugly banding in sky @@ -846,6 +859,10 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() mClampedLightDirection.mV[1] = -0.1f; mClampedLightDirection.normalize(); } + + //LL_INFOS() << "Sun: " << mSunDirection << LL_ENDL; + //LL_INFOS() << "Moon: " << mMoonDirection << LL_ENDL; + //LL_INFOS() << "Light: " << mLightDirection << LL_ENDL; } LLColor3 LLSettingsSky::getBlueDensity() const diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 8e96735abf..bb8633d338 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -490,6 +490,9 @@ public: void setHazeDensity(F32 val); void setHazeHorizon(F32 val); + bool getIsSunUp() const; + bool getIsMoonUp() const; + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; -- cgit v1.2.3 From c75eeab8391859e0819de0afbf9acc2293864f1e Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 23 May 2018 19:01:52 +0300 Subject: MAINT-8344 Day Cycle Editor (playing) --- indra/llinventory/llsettingsdaycycle.cpp | 10 ++++++++++ indra/llinventory/llsettingsdaycycle.h | 3 +++ 2 files changed, 13 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index aa3fd4e0e6..577b12b031 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -611,6 +611,16 @@ LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 tra return LLSettingsBase::ptr_t(); } +F32 LLSettingsDay::getUpperBoundFrame(S32 track, F32 keyframe) +{ + return get_wrapping_atafter(mDayTracks[track], keyframe)->first; +} + +F32 LLSettingsDay::getLowerBoundFrame(S32 track, F32 keyframe) +{ + return get_wrapping_atbefore(mDayTracks[track], keyframe)->first; +} + LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F32 keyframe) { return TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 9a89031aed..2e48716488 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -114,6 +114,9 @@ public: virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); + F32 getUpperBoundFrame(S32 track, F32 keyframe); + F32 getLowerBoundFrame(S32 track, F32 keyframe); + protected: LLSettingsDay(); -- cgit v1.2.3 From fa4ac065cb332c8c90fb59eeff0b983a1fd56691 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 24 May 2018 13:11:33 -0700 Subject: Enable sky changes with altitude. --- indra/llinventory/llsettingsbase.cpp | 13 ++++++++++--- indra/llinventory/llsettingsbase.h | 22 +++++++++++++++++++++- indra/llinventory/llsettingsdaycycle.h | 2 ++ indra/llinventory/llsettingssky.h | 2 ++ indra/llinventory/llsettingswater.h | 2 ++ 5 files changed, 37 insertions(+), 4 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index f870ec8904..411eaff8e3 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -547,8 +547,11 @@ F64 LLSettingsBlender::setPosition(F64 blendf) } blendf = llclamp(blendf, 0.0, 1.0); - //_WARNS("LAPRAS") << "blending at " << (blendf * 100.0f) << "%" << LL_ENDL; mTarget->replaceSettings(mInitial->getSettings()); + if (mIsTrivial || (blendf == 0.0)) + { // this is a trivial blend. Results will be identical to the initial. + return blendf; + } mTarget->blend(mFinal, blendf); return blendf; @@ -562,6 +565,11 @@ void LLSettingsBlender::triggerComplete() } //------------------------------------------------------------------------- +F64 LLSettingsBlenderTimeDelta::calculateBlend(F64 spanpos, F64 spanlen) const +{ + return fmod(spanpos, spanlen) / spanlen; +} + void LLSettingsBlenderTimeDelta::update(F64 timedelta) { mTimeSpent += F64Seconds(timedelta); @@ -572,8 +580,7 @@ void LLSettingsBlenderTimeDelta::update(F64 timedelta) return; } - F64 blendf = fmod(mTimeSpent.value(), mBlendSpan.value()) / mBlendSpan.value(); - + F64 blendf = calculateBlend(mTimeSpent.value(), mBlendSpan.value()); // Note no clamp here. setPosition(blendf); diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index d00e340b4b..71358d6a49 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -166,6 +166,8 @@ public: virtual bool validate(); + virtual ptr_t buildDerivedClone() = 0; + class Validator { public: @@ -269,10 +271,15 @@ public: mOnFinished(), mTarget(target), mInitial(initsetting), - mFinal(endsetting) + mFinal(endsetting), + mIsTrivial(false) { if (mInitial) mTarget->replaceSettings(mInitial->getSettings()); + + if (!mFinal) + mFinal = mInitial; + mIsTrivial = (mFinal == mInitial); } virtual ~LLSettingsBlender() {} @@ -280,8 +287,16 @@ public: virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 /*span*/ = 1.0) { // note: the 'span' reset parameter is unused by the base class. + if (!mInitial) + LL_WARNS("BLENDER") << "Reseting blender with empty initial setting. Expect badness in the future." << LL_ENDL; + mInitial = initsetting; mFinal = endsetting; + + if (!mFinal) + mFinal = mInitial; + mIsTrivial = (mFinal == mInitial); + mTarget->replaceSettings(mInitial->getSettings()); } @@ -308,6 +323,8 @@ public: virtual void update(F64 blendf); virtual F64 setPosition(F64 blendf); + virtual void switchTrack(S32 trackno, F64 position = -1.0) { /*NoOp*/ } + protected: void triggerComplete(); @@ -316,6 +333,7 @@ protected: LLSettingsBase::ptr_t mTarget; LLSettingsBase::ptr_t mInitial; LLSettingsBase::ptr_t mFinal; + bool mIsTrivial; }; class LLSettingsBlenderTimeDelta : public LLSettingsBlender @@ -349,6 +367,8 @@ public: virtual void update(F64 timedelta) override; protected: + F64 calculateBlend(F64 spanpos, F64 spanlen) const; + F64Seconds mBlendSpan; F64Seconds mLastUpdate; F64Seconds mTimeSpent; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 9a89031aed..336a00f386 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -114,6 +114,8 @@ public: virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); + virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + protected: LLSettingsDay(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 59a9dc9a43..9379cd37c3 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -479,6 +479,8 @@ public: return mNextCloudTextureId; } + virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 64de4486ca..acae903e92 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -211,6 +211,8 @@ public: static LLSD translateLegacySettings(LLSD legacy); + virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + protected: static const std::string SETTING_LEGACY_BLUR_MULTIPILER; static const std::string SETTING_LEGACY_FOG_COLOR; -- cgit v1.2.3 From acaf57100eade61262d73cf5b318c4545e921bd5 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 24 May 2018 17:09:01 -0700 Subject: switch track based on altitudes sent from region. --- indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsbase.h | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 411eaff8e3..d8e337e231 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -548,7 +548,7 @@ F64 LLSettingsBlender::setPosition(F64 blendf) blendf = llclamp(blendf, 0.0, 1.0); mTarget->replaceSettings(mInitial->getSettings()); - if (mIsTrivial || (blendf == 0.0)) + if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) { // this is a trivial blend. Results will be identical to the initial. return blendf; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 71358d6a49..1ef7df79ad 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -271,15 +271,13 @@ public: mOnFinished(), mTarget(target), mInitial(initsetting), - mFinal(endsetting), - mIsTrivial(false) + mFinal(endsetting) { if (mInitial) mTarget->replaceSettings(mInitial->getSettings()); if (!mFinal) mFinal = mInitial; - mIsTrivial = (mFinal == mInitial); } virtual ~LLSettingsBlender() {} @@ -295,7 +293,6 @@ public: if (!mFinal) mFinal = mInitial; - mIsTrivial = (mFinal == mInitial); mTarget->replaceSettings(mInitial->getSettings()); } @@ -333,7 +330,6 @@ protected: LLSettingsBase::ptr_t mTarget; LLSettingsBase::ptr_t mInitial; LLSettingsBase::ptr_t mFinal; - bool mIsTrivial; }; class LLSettingsBlenderTimeDelta : public LLSettingsBlender -- cgit v1.2.3 From 64302d3000b69b31e72eb6a3bd8a981c80cb88de Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Jun 2018 00:18:36 +0100 Subject: Modify use of sky settings, reduce complexity, and name funcs to indicate coord systems in use. Fix class2 softenLightF shader. --- indra/llinventory/llsettingsbase.h | 2 +- indra/llinventory/llsettingssky.cpp | 177 +++++++++++++++++++++--------------- indra/llinventory/llsettingssky.h | 113 ++++++----------------- 3 files changed, 134 insertions(+), 158 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 5b44dc4666..264c6c6c49 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -251,7 +251,7 @@ protected: void markDirty() { mDirty = true; } private: - bool mDirty; + bool mDirty = true; LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e06cd7ca72..b8623c3ed3 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -42,13 +42,14 @@ namespace { LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); + static const LLVector3 DUE_EAST = LLVector3::x_axis; } -static LLQuaternion body_position_from_angles(F32 azimuth, F32 altitude) +static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { - LLQuaternion body_quat; - body_quat.setEulerAngles(0.0f, -altitude, azimuth); - return body_quat; + LLQuaternion quat; + quat.setEulerAngles(0.0f, -altitude, azimuth); + return quat; } const F32 LLSettingsSky::DOME_OFFSET(0.96f); @@ -487,8 +488,6 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.2f)("*")(-2.5f)("*")), LLSD(LLSDArray(20.0f)("*")(0.0f)("*"))))); - validation.push_back(Validator(SETTING_LIGHT_NORMAL, false, LLSD::TypeArray, - boost::bind(&Validator::verifyVectorNormalized, _1, 3))); validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4000.0f))))); validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); @@ -579,8 +578,8 @@ LLSD LLSettingsSky::defaults() LLQuaternion sunquat; LLQuaternion moonquat; - sunquat.setEulerAngles(0.0f, -1.39626, 0.0f); // 80 deg pitch / 0 deg azimuth from East - moonquat.setEulerAngles(0.0f, -1.39626, F_PI); // 80 deg pitch / 180 deg azimuth from East + sunquat = convert_azimuth_and_altitude_to_quat(0.0f, 80.0f * DEG_TO_RAD); + moonquat = convert_azimuth_and_altitude_to_quat(F_PI, 80.0f * DEG_TO_RAD); // Magic constants copied form dfltsetting.xml dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); @@ -595,7 +594,6 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); - dfltsetting[SETTING_LIGHT_NORMAL] = LLVector3(0.0000, 0.9126, -0.4086).getValue(); dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); @@ -657,7 +655,7 @@ LLSD LLSettingsSky::translateLegacyHazeSettings(const LLSD& legacy) return legacyhazesettings; } -LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy, const std::string* name) +LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) { LLSD newsettings(defaults()); @@ -719,11 +717,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy, const std::strin { newsettings[SETTING_GLOW] = LLColor3(legacy[SETTING_GLOW]).getValue(); } - - if (legacy.has(SETTING_LIGHT_NORMAL)) - { - newsettings[SETTING_LIGHT_NORMAL] = LLVector3(legacy[SETTING_LIGHT_NORMAL]).getValue(); - } + if (legacy.has(SETTING_MAX_Y)) { newsettings[SETTING_MAX_Y] = LLSD::Real(legacy[SETTING_MAX_Y][0].asReal()); @@ -762,16 +756,11 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy, const std::strin F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); - F32 pi_over_2 = F_PI * 0.5f; - LLQuaternion sunquat = body_position_from_angles(azimuth - pi_over_2, altitude); - LLQuaternion moonquat = body_position_from_angles(azimuth + pi_over_2, altitude); + LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude); - if (name) - { - LLVector3 sundir = LLVector3::x_axis * sunquat; - LLVector3 moondir = LLVector3::x_axis * moonquat; - LL_INFOS() << *name << " sun: " << sundir << " moon: " << moondir << LL_ENDL; - } + //LLVector3 sundir = DUE_EAST * sunquat; + //LLVector3 moondir = DUE_EAST * moonquat; newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); @@ -785,11 +774,11 @@ void LLSettingsSky::updateSettings() LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKYVALUES); //LL_INFOS("WINDLIGHT", "SKY", "EEP") << "WL Parameters are dirty. Reticulating Splines..." << LL_ENDL; + mPositionsDirty = isDirty(); + mLightingDirty = isDirty(); + // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); - - calculateHeavnlyBodyPositions(); - calculateLightSettings(); } bool LLSettingsSky::getIsSunUp() const @@ -804,44 +793,42 @@ bool LLSettingsSky::getIsMoonUp() const return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; } -void LLSettingsSky::calculateHeavnlyBodyPositions() +void LLSettingsSky::calculateHeavnlyBodyPositions() const { + if (!mPositionsDirty) + { + return; + } + + mPositionsDirty = false; + LLQuaternion sunq = getSunRotation(); LLQuaternion moonq = getMoonRotation(); - mSunDirection = LLVector3::x_axis * sunq; - mSunDirection.normalize(); + mSunDirection = DUE_EAST * sunq; + mMoonDirection = DUE_EAST * moonq; - mMoonDirection = LLVector3::x_axis * moonq; + mSunDirection.normalize(); mMoonDirection.normalize(); +} + +LLVector3 LLSettingsSky::getLightDirection() const +{ + calculateHeavnlyBodyPositions(); // is the normal from the sun or the moon if (getIsSunUp()) { - mLightDirection = mSunDirection; + llassert(mSunDirection.length() > 0.01f); + return mSunDirection; } else if (getIsMoonUp()) { - mLightDirection = mMoonDirection; + llassert(mMoonDirection.length() > 0.01f); + return mMoonDirection; } - else - { - mLightDirection = LLVector3::z_axis; - } - - // calculate the clamp lightnorm for sky (to prevent ugly banding in sky - // when haze goes below the horizon - mClampedLightDirection = mLightDirection; - if (mClampedLightDirection.mV[1] < -0.1f) - { - mClampedLightDirection.mV[1] = -0.1f; - mClampedLightDirection.normalize(); - } - - //LL_INFOS() << "Sun: " << mSunDirection << LL_ENDL; - //LL_INFOS() << "Moon: " << mMoonDirection << LL_ENDL; - //LL_INFOS() << "Light: " << mLightDirection << LL_ENDL; + return LLVector3::z_axis; } LLColor3 LLSettingsSky::getBlueDensity() const @@ -969,42 +956,91 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const return v; } -void LLSettingsSky::calculateLightSettings() +LLVector3 LLSettingsSky::getSunDirection() const +{ + calculateHeavnlyBodyPositions(); + return mSunDirection; +} + +LLVector3 LLSettingsSky::getMoonDirection() const +{ + calculateHeavnlyBodyPositions(); + return mMoonDirection; +} + +LLColor4U LLSettingsSky::getFadeColor() const +{ + calculateLightSettings(); + return mFadeColor; +} + +LLColor4 LLSettingsSky::getMoonAmbient() const +{ + calculateLightSettings(); + return mMoonAmbient; +} + +LLColor3 LLSettingsSky::getMoonDiffuse() const +{ + calculateLightSettings(); + return mMoonDiffuse; +} + +LLColor4 LLSettingsSky::getSunAmbient() const +{ + calculateLightSettings(); + return mSunAmbient; +} + +LLColor3 LLSettingsSky::getSunDiffuse() const +{ + calculateLightSettings(); + return mSunDiffuse; +} + +LLColor4 LLSettingsSky::getTotalAmbient() const { + calculateLightSettings(); + return mTotalAmbient; +} + +void LLSettingsSky::calculateLightSettings() const +{ + if (!mLightingDirty) + { + return; + } + + calculateHeavnlyBodyPositions(); + + mLightingDirty = false; + // Initialize temp variables LLColor3 sunlight = getSunlightColor(); LLColor3 ambient = getAmbientColor(); - F32 cloud_shadow = getCloudShadow(); - LLVector3 lightnorm = getLightDirection(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes F32 max_y = getMaxY(); LLColor3 light_atten = getLightAttenuation(max_y); LLColor3 light_transmittance = getLightTransmittance(); - - // Compute sunlight from P & lightnorm (for long rays like sky) - /// USE only lightnorm. - // temp2[1] = llmax(0.f, llmax(0.f, Pn[1]) * 1.0f + lightnorm[1] ); - // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; - if (lighty < NIGHTTIME_ELEVATION_SIN) - { - lighty = -lighty; - } + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; lighty = llmax(0.f, lighty); if(lighty > 0.f) - { + { lighty = 1.f / lighty; - } + } componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); - //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; - //brightness of surface both sunlight and ambient + //brightness of surface both sunlight and ambient mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); @@ -1015,4 +1051,3 @@ void LLSettingsSky::calculateLightSettings() mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); } - diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 4c8a5e4016..3084cadd57 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -281,16 +281,6 @@ public: setValue(SETTING_GLOW, val); } - LLVector3 getLightNormal() const - { - return LLVector3(mSettings[SETTING_LIGHT_NORMAL]); - } - - void setLightNormal(const LLVector3 &val) - { - setValue(SETTING_LIGHT_NORMAL, val); - } - F32 getMaxY() const { return mSettings[SETTING_MAX_Y].asReal(); @@ -361,68 +351,7 @@ public: setValue(SETTING_SUN_TEXTUREID, id); } - // Internal/calculated settings - LLVector3 getLightDirection() const - { - update(); - return mLightDirection; - }; - - LLVector3 getClampedLightDirection() const - { - update(); - return mClampedLightDirection; - }; - - LLVector3 getSunDirection() const - { - update(); - return mSunDirection; - } - - LLVector3 getMoonDirection() const - { - update(); - return mMoonDirection; - } - - LLColor4U getFadeColor() const - { - update(); - return mFadeColor; - } - - LLColor4 getMoonAmbient() const - { - update(); - return mMoonAmbient; - } - - LLColor3 getMoonDiffuse() const - { - update(); - return mMoonDiffuse; - } - - LLColor4 getSunAmbient() const - { - update(); - return mSunAmbient; - } - - LLColor3 getSunDiffuse() const - { - update(); - return mSunDiffuse; - } - - LLColor4 getTotalAmbient() const - { - update(); - return mTotalAmbient; - } - -//===================================================================== + //===================================================================== // transient properties used in animations. LLUUID getNextSunTextureId() const { @@ -446,7 +375,7 @@ public: virtual validation_list_t getValidationList() const override; static validation_list_t validationList(); - static LLSD translateLegacySettings(const LLSD& legacy, const std::string* name = nullptr); + static LLSD translateLegacySettings(const LLSD& legacy); static LLSD translateLegacyHazeSettings(const LLSD& legacy); LLColor3 getLightAttenuation(F32 distance) const; @@ -468,9 +397,20 @@ public: void setHazeDensity(F32 val); void setHazeHorizon(F32 val); +// Internal/calculated settings bool getIsSunUp() const; bool getIsMoonUp() const; + LLVector3 getLightDirection() const; + LLVector3 getSunDirection() const; + LLVector3 getMoonDirection() const; + LLColor4U getFadeColor() const; + LLColor4 getMoonAmbient() const; + LLColor3 getMoonDiffuse() const; + LLColor4 getSunAmbient() const; + LLColor3 getSunDiffuse() const; + LLColor4 getTotalAmbient() const; + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -484,28 +424,29 @@ protected: virtual void updateSettings() override; private: + mutable bool mPositionsDirty = true; + mutable bool mLightingDirty = true; + static LLSD rayleighConfigDefault(); static LLSD absorptionConfigDefault(); static LLSD mieConfigDefault(); - void calculateHeavnlyBodyPositions(); - void calculateLightSettings(); + void calculateHeavnlyBodyPositions() const; + void calculateLightSettings() const; - LLVector3 mSunDirection; - LLVector3 mMoonDirection; - LLVector3 mLightDirection; - LLVector3 mClampedLightDirection; + mutable LLVector3 mSunDirection; + mutable LLVector3 mMoonDirection; + mutable LLVector3 mLightDirection; static const F32 DOME_RADIUS; static const F32 DOME_OFFSET; - LLColor4U mFadeColor; - LLColor4 mMoonAmbient; - LLColor3 mMoonDiffuse; - LLColor4 mSunAmbient; - LLColor3 mSunDiffuse; - - LLColor4 mTotalAmbient; + mutable LLColor4U mFadeColor; + mutable LLColor4 mMoonAmbient; + mutable LLColor3 mMoonDiffuse; + mutable LLColor4 mSunAmbient; + mutable LLColor3 mSunDiffuse; + mutable LLColor4 mTotalAmbient; LLUUID mNextSunTextureId; LLUUID mNextMoonTextureId; -- cgit v1.2.3 From 8dd85013865cc5b426234cd71b605d7208bcfe01 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Jun 2018 15:50:25 +0100 Subject: Fix mis-merge of LLSettingsBase and remove optimize pragmas. --- indra/llinventory/llsettingsbase.h | 2 ++ indra/llinventory/llsettingssky.cpp | 7 ++----- indra/llinventory/llsettingssky.h | 4 +++- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 29ed50419a..0b99166a86 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -166,6 +166,8 @@ public: virtual bool validate(); + virtual ptr_t buildDerivedClone() = 0; + class Validator { public: diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b8623c3ed3..6c5ed8f12b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,17 +32,14 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#pragma optimize("", off) - static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); - +static const LLVector3 DUE_EAST = LLVector3::x_axis; //========================================================================= namespace { LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); - LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); - static const LLVector3 DUE_EAST = LLVector3::x_axis; + LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); } static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 9b50f5a4b6..ee201f4122 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -376,13 +376,15 @@ public: static validation_list_t validationList(); static LLSD translateLegacySettings(const LLSD& legacy); + +// LEGACY_ATMOSPHERICS static LLSD translateLegacyHazeSettings(const LLSD& legacy); LLColor3 getLightAttenuation(F32 distance) const; LLColor3 getLightTransmittance() const; LLColor3 gammaCorrect(const LLColor3& in) const; -// LEGACY_ATMOSPHERICS + LLColor3 getBlueDensity() const; LLColor3 getBlueHorizon() const; F32 getHazeDensity() const; -- cgit v1.2.3 From 8cfdc07e790a557e881fadaa1b6258e5b16751f4 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Jun 2018 23:32:30 +0100 Subject: Code cleanup and move to using typedefs of S64Seconds/F64Seconds for ease in sync w/ sim side which has not llunits types. --- indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsbase.h | 13 ++++++++----- indra/llinventory/llsettingsdaycycle.cpp | 14 +++++++------- indra/llinventory/llsettingsdaycycle.h | 21 ++++++++++----------- indra/llinventory/llsettingssky.cpp | 10 +++++----- indra/llinventory/llsettingssky.h | 4 ++-- indra/llinventory/llsettingswater.h | 8 ++++---- 7 files changed, 37 insertions(+), 35 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index d8e337e231..a661d52b7f 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -572,7 +572,7 @@ F64 LLSettingsBlenderTimeDelta::calculateBlend(F64 spanpos, F64 spanlen) const void LLSettingsBlenderTimeDelta::update(F64 timedelta) { - mTimeSpent += F64Seconds(timedelta); + mTimeSpent += LLSettingsBase::Seconds(timedelta); if (mTimeSpent > mBlendSpan) { diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 0b99166a86..6f072a4e50 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -41,6 +41,7 @@ #include "llquaternion.h" #include "v4color.h" #include "v3color.h" +#include "llunits.h" #include "llinventorysettings.h" @@ -54,6 +55,8 @@ class LLSettingsBase : friend std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings); public: + typedef F64Seconds Seconds; + static const std::string SETTING_ID; static const std::string SETTING_NAME; static const std::string SETTING_HASH; @@ -344,7 +347,7 @@ public: mLastUpdate(0.0f), mTimeSpent(0.0f) { - mTimeStart = F64Seconds(LLDate::now().secondsSinceEpoch()); + mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; } @@ -367,10 +370,10 @@ public: protected: F64 calculateBlend(F64 spanpos, F64 spanlen) const; - F64Seconds mBlendSpan; - F64Seconds mLastUpdate; - F64Seconds mTimeSpent; - F64Seconds mTimeStart; + LLSettingsBase::Seconds mBlendSpan; + LLSettingsBase::Seconds mLastUpdate; + LLSettingsBase::Seconds mTimeSpent; + LLSettingsBase::Seconds mTimeStart; }; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 577b12b031..6f4e70e98f 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -89,13 +89,13 @@ const std::string LLSettingsDay::SETTING_KEYHASH("key_hash"); const std::string LLSettingsDay::SETTING_TRACKS("tracks"); const std::string LLSettingsDay::SETTING_FRAMES("frames"); -const S64Seconds LLSettingsDay::MINIMUM_DAYLENGTH(300); // 5 mins -const S64Seconds LLSettingsDay::DEFAULT_DAYLENGTH(14400); // 4 hours -const S64Seconds LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days +const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYLENGTH(300); // 5 mins +const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYLENGTH(14400); // 4 hours +const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days -const S64Seconds LLSettingsDay::MINIMUM_DAYOFFSET(0); -const S64Seconds LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset) -const S64Seconds LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours +const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYOFFSET(0); +const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 hours == -8 hours (SLT time offset) +const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water @@ -465,7 +465,7 @@ LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track) //========================================================================= void LLSettingsDay::startDayCycle() { - F64Seconds now(LLDate::now().secondsSinceEpoch()); + LLSettingsBase::Seconds now(LLDate::now().secondsSinceEpoch()); if (!mInitialized) { diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 5e6fc7f21d..0929cff87c 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -48,13 +48,16 @@ public: static const std::string SETTING_TRACKS; static const std::string SETTING_FRAMES; - static const S64Seconds MINIMUM_DAYLENGTH; - static const S64Seconds DEFAULT_DAYLENGTH; - static const S64Seconds MAXIMUM_DAYLENGTH; + // 32-bit as LLSD only supports that width at present + typedef S32Seconds Seconds; - static const S64Seconds MINIMUM_DAYOFFSET; - static const S64Seconds DEFAULT_DAYOFFSET; - static const S64Seconds MAXIMUM_DAYOFFSET; + static const Seconds MINIMUM_DAYLENGTH; + static const Seconds DEFAULT_DAYLENGTH; + static const Seconds MAXIMUM_DAYLENGTH; + + static const Seconds MINIMUM_DAYOFFSET; + static const Seconds DEFAULT_DAYOFFSET; + static const Seconds MAXIMUM_DAYOFFSET; static const S32 TRACK_WATER; static const S32 TRACK_MAX; @@ -129,7 +132,7 @@ protected: private: CycleList_t mDayTracks; - F64Seconds mLastUpdateTime; + LLSettingsBase::Seconds mLastUpdateTime; void parseFromLLSD(LLSD &data); @@ -137,10 +140,6 @@ private: static CycleTrack_t::iterator getEntryAtOrAfter(CycleTrack_t &track, F32 keyframe); TrackBound_t getBoundingEntries(CycleTrack_t &track, F32 keyframe); - -// void onSkyTransitionDone(S32 track, const LLSettingsBlender::ptr_t &blender); -// void onWaterTransitionDone(const LLSettingsBlender::ptr_t &blender); - }; #endif diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 6c5ed8f12b..b6320e0942 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -790,7 +790,7 @@ bool LLSettingsSky::getIsMoonUp() const return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; } -void LLSettingsSky::calculateHeavnlyBodyPositions() const +void LLSettingsSky::calculateHeavenlyBodyPositions() const { if (!mPositionsDirty) { @@ -811,7 +811,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() const LLVector3 LLSettingsSky::getLightDirection() const { - calculateHeavnlyBodyPositions(); + calculateHeavenlyBodyPositions(); // is the normal from the sun or the moon if (getIsSunUp()) @@ -955,13 +955,13 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const LLVector3 LLSettingsSky::getSunDirection() const { - calculateHeavnlyBodyPositions(); + calculateHeavenlyBodyPositions(); return mSunDirection; } LLVector3 LLSettingsSky::getMoonDirection() const { - calculateHeavnlyBodyPositions(); + calculateHeavenlyBodyPositions(); return mMoonDirection; } @@ -1008,7 +1008,7 @@ void LLSettingsSky::calculateLightSettings() const return; } - calculateHeavnlyBodyPositions(); + calculateHeavenlyBodyPositions(); mLightingDirty = false; diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index ee201f4122..6e532eba55 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -423,7 +423,7 @@ protected: LLSettingsSky(); virtual stringset_t getSlerpKeys() const override; - + virtual stringset_t getSkipInterpolateKeys() const; virtual void updateSettings() override; private: @@ -434,7 +434,7 @@ private: static LLSD absorptionConfigDefault(); static LLSD mieConfigDefault(); - void calculateHeavnlyBodyPositions() const; + void calculateHeavenlyBodyPositions() const; void calculateLightSettings() const; mutable LLVector3 mSunDirection; diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index acae903e92..35e5b7bcf6 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -76,22 +76,22 @@ public: setValue(SETTING_BLUR_MULTIPILER, val); } - LLColor3 getFogColor() const + LLColor3 getWaterFogColor() const { return LLColor3(mSettings[SETTING_FOG_COLOR]); } - void setFogColor(LLColor3 val) + void setWaterFogColor(LLColor3 val) { setValue(SETTING_FOG_COLOR, val); } - F32 getFogDensity() const + F32 getWaterFogDensity() const { return mSettings[SETTING_FOG_DENSITY].asReal(); } - void setFogDensity(F32 val) + void setWaterFogDensity(F32 val) { setValue(SETTING_FOG_DENSITY, val); } -- cgit v1.2.3 From f87cf83a2bcca87f33c3f94cd09438fb7b65529c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Jun 2018 23:54:01 +0100 Subject: Mark LLSettingsSky::skipInterpolateKeys as override to silence Clang fail. --- indra/llinventory/llsettingssky.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 6e532eba55..93da1e6dd0 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -423,7 +423,7 @@ protected: LLSettingsSky(); virtual stringset_t getSlerpKeys() const override; - virtual stringset_t getSkipInterpolateKeys() const; + virtual stringset_t getSkipInterpolateKeys() const override; virtual void updateSettings() override; private: -- cgit v1.2.3 From 2a613d7363c4e91a7258d4f0ea3971db1569e788 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 1 Jun 2018 16:24:36 -0700 Subject: Rework preset loading and context menu from inventory. --- indra/llinventory/llsettingsdaycycle.cpp | 15 +++++++++------ indra/llinventory/llsettingsdaycycle.h | 7 +++---- indra/llinventory/llsettingssky.cpp | 7 +++++-- indra/llinventory/llsettingssky.h | 2 ++ indra/llinventory/llsettingswater.cpp | 3 +++ indra/llinventory/llsettingswater.h | 2 ++ 6 files changed, 24 insertions(+), 12 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 577b12b031..e67da95a6c 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -101,6 +101,9 @@ const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water const S32 LLSettingsDay::FRAME_MAX(56); +// *LAPRAS* Change when Agni +const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("94d296c2-6e05-963c-6b62-671199121dbb"); + //========================================================================= LLSettingsDay::LLSettingsDay(const LLSD &data) : LLSettingsBase(data), @@ -218,22 +221,18 @@ bool LLSettingsDay::initialize() if (i == TRACK_WATER) { setting = used[(*it)[SETTING_KEYNAME]]; - if (!setting) - setting = getNamedWater((*it)[SETTING_KEYNAME]); if (setting && setting->getSettingType() != "water") { - LL_WARNS("DAYCYCLE") << "Water track referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; + LL_WARNS("SETTINGS", "DAYCYCLE") << "Water track referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; setting.reset(); } } else { setting = used[(*it)[SETTING_KEYNAME]]; - if (!setting) - setting = getNamedSky((*it)[SETTING_KEYNAME]); if (setting && setting->getSettingType() != "sky") { - LL_WARNS("DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; + LL_WARNS("SETTINGS", "DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; setting.reset(); } } @@ -247,6 +246,10 @@ bool LLSettingsDay::initialize() hassky |= true; mDayTracks[i][keyframe] = setting; } + else + { + LL_WARNS("SETTINGS", "DAYCYCLE") << "Skipping frame on track #" << i << " at time index " << keyframe << LL_ENDL; + } } } diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 5e6fc7f21d..101cacc3a2 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -60,6 +60,8 @@ public: static const S32 TRACK_MAX; static const S32 FRAME_MAX; + static const LLUUID DEFAULT_ASSET_ID; + typedef std::map CycleTrack_t; typedef std::vector CycleList_t; typedef std::shared_ptr ptr_t; @@ -105,10 +107,7 @@ public: virtual LLSettingsSkyPtr_t buildSky(LLSD) const = 0; virtual LLSettingsWaterPtr_t buildWater(LLSD) const = 0; - virtual LLSettingsSkyPtr_t getNamedSky(const std::string &) const = 0; - virtual LLSettingsWaterPtr_t getNamedWater(const std::string &) const = 0; - - void setInitialized(bool value = true) { mInitialized = value; } + void setInitialized(bool value = true) { mInitialized = value; } CycleTrack_t & getCycleTrack(S32 track); virtual validation_list_t getValidationList() const override; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 45c1ca1d7f..f578660095 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -110,6 +110,9 @@ const LLUUID LLSettingsSky::DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271 const LLUUID LLSettingsSky::DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver const LLUUID LLSettingsSky::DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); +// *LAPRAS* Change when Agni! +const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); + namespace { @@ -572,8 +575,8 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = DEFAULT_CLOUD_ID; - dfltsetting[SETTING_MOON_TEXTUREID] = DEFAULT_MOON_ID; // gMoonTextureID; // These two are returned by the login... wow! - dfltsetting[SETTING_SUN_TEXTUREID] = DEFAULT_SUN_ID; // gSunTextureID; + dfltsetting[SETTING_MOON_TEXTUREID] = DEFAULT_MOON_ID; + dfltsetting[SETTING_SUN_TEXTUREID] = LLUUID::null; // DEFAULT_SUN_ID; dfltsetting[SETTING_TYPE] = "sky"; diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 9379cd37c3..82c2d6a804 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -83,6 +83,8 @@ public: static const LLUUID DEFAULT_MOON_ID; static const LLUUID DEFAULT_CLOUD_ID; + static const LLUUID DEFAULT_ASSET_ID; + typedef std::shared_ptr ptr_t; typedef std::pair azimalt_t; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index c6798945a3..aa1f0f1935 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -69,6 +69,9 @@ const std::string LLSettingsWater::SETTING_LEGACY_WAVE2_DIR("wave2Dir"); const LLUUID LLSettingsWater::DEFAULT_WATER_NORMAL_ID(DEFAULT_WATER_NORMAL); +// *LAPRAS* Change when Agni +const LLUUID LLSettingsWater::DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661"); + //========================================================================= LLSettingsWater::LLSettingsWater(const LLSD &data) : diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index acae903e92..ca32a46430 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -48,6 +48,8 @@ public: static const LLUUID DEFAULT_WATER_NORMAL_ID; + static const LLUUID DEFAULT_ASSET_ID; + typedef std::shared_ptr ptr_t; //--------------------------------------------------------------------- -- cgit v1.2.3 From 7136956b90614bbd236be0e30231781c04346220 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Sat, 2 Jun 2018 23:28:48 +0100 Subject: Use more typedefs to simplify sync between viewer and sim env settings code. --- indra/llinventory/llsettingsbase.cpp | 51 ++++++++++++------ indra/llinventory/llsettingsbase.h | 64 ++++++++++++++-------- indra/llinventory/llsettingsdaycycle.cpp | 93 ++++++++++++++++++++------------ indra/llinventory/llsettingsdaycycle.h | 65 +++++++++++----------- indra/llinventory/llsettingssky.cpp | 40 +++++++------- indra/llinventory/llsettingssky.h | 30 +++++------ indra/llinventory/llsettingswater.cpp | 19 ++++--- indra/llinventory/llsettingswater.h | 25 +++++---- 8 files changed, 225 insertions(+), 162 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index a661d52b7f..23afbdfa3a 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -35,7 +35,7 @@ //========================================================================= namespace { - const F64 BREAK_POINT = 0.5; + const LLSettingsBase::BlendFactor BREAK_POINT = 0.5; } //========================================================================= @@ -272,7 +272,8 @@ size_t LLSettingsBase::getHash() const LLSD hash_settings = llsd_shallow(getSettings(), LLSDMap(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)("*", true)); - return boost::hash{}(hash_settings); + boost::hash hasher; + return hasher(hash_settings); } bool LLSettingsBase::validate() @@ -340,17 +341,35 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida validated.insert(validateType.getName()); // Fields for specific settings. - for (auto &test: validations) + for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) { - if (!test.verify(settings)) +#ifdef VALIDATION_DEBUG + LLSD oldvalue; + if (settings.has((*itv).getName())) + { + oldvalue = llsd_clone(mSettings[(*itv).getName()]); + } +#endif + + if (!(*itv).verify(settings)) { std::stringstream errtext; - errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!\n"; + errtext << "Settings LLSD fails validation and could not be corrected for '" << (*itv).getName() << "'!\n"; errors.append( errtext.str() ); isValid = false; } - validated.insert(test.getName()); + validated.insert((*itv).getName()); + +#ifdef VALIDATION_DEBUG + if (!oldvalue.isUndefined()) + { + if (!compare_llsd(settings[(*itv).getName()], oldvalue)) + { + LL_WARNS("SETTINGS") << "Setting '" << (*itv).getName() << "' was changed: " << oldvalue << " -> " << settings[(*itv).getName()] << LL_ENDL; + } + } +#endif } // strip extra entries @@ -366,9 +385,9 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } } - for (const std::string &its: strip) + for (stringset_t::iterator its = strip.begin(); its != strip.end(); ++its) { - settings.erase(its); + settings.erase(*its); } return LLSDMap("success", LLSD::Boolean(isValid)) @@ -533,13 +552,14 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) } //========================================================================= -void LLSettingsBlender::update(F64 blendf) +void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { setPosition(blendf); } -F64 LLSettingsBlender::setPosition(F64 blendf) +F64 LLSettingsBlender::setPosition(const LLSettingsBase::TrackPosition& blendf_in) { + LLSettingsBase::TrackPosition blendf = blendf_in; if (blendf >= 1.0) { triggerComplete(); @@ -565,14 +585,14 @@ void LLSettingsBlender::triggerComplete() } //------------------------------------------------------------------------- -F64 LLSettingsBlenderTimeDelta::calculateBlend(F64 spanpos, F64 spanlen) const +LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const { - return fmod(spanpos, spanlen) / spanlen; + return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen); } -void LLSettingsBlenderTimeDelta::update(F64 timedelta) +void LLSettingsBlenderTimeDelta::advance(const LLSettingsBase::Seconds& timedelta) { - mTimeSpent += LLSettingsBase::Seconds(timedelta); + mTimeSpent += timedelta; if (mTimeSpent > mBlendSpan) { @@ -580,8 +600,7 @@ void LLSettingsBlenderTimeDelta::update(F64 timedelta) return; } - F64 blendf = calculateBlend(mTimeSpent.value(), mBlendSpan.value()); - // Note no clamp here. + LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); setPosition(blendf); } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 6f072a4e50..a8e1cc5eea 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -45,8 +45,14 @@ #include "llinventorysettings.h" +#define PTR_NAMESPACE std +#define SETTINGS_OVERRIDE override + +//#define PTR_NAMESPACE boost +//#define SETTINGS_OVERRIDE + class LLSettingsBase : - public std::enable_shared_from_this, + public PTR_NAMESPACE::enable_shared_from_this, private boost::noncopyable { friend class LLEnvironment; @@ -56,6 +62,8 @@ class LLSettingsBase : public: typedef F64Seconds Seconds; + typedef F64 BlendFactor; + typedef F64 TrackPosition; static const std::string SETTING_ID; static const std::string SETTING_NAME; @@ -64,7 +72,7 @@ public: typedef std::map parammapping_t; - typedef std::shared_ptr ptr_t; + typedef PTR_NAMESPACE::shared_ptr ptr_t; virtual ~LLSettingsBase() { }; @@ -107,12 +115,17 @@ public: //--------------------------------------------------------------------- // - inline void setValue(const std::string &name, const LLSD &value) + inline void setLLSD(const std::string &name, const LLSD &value) { mSettings[name] = value; mDirty = true; } + inline void setValue(const std::string &name, const LLSD &value) + { + setLLSD(name, value); + } + inline LLSD getValue(const std::string &name, const LLSD &deflt = LLSD()) const { if (!mSettings.has(name)) @@ -120,6 +133,11 @@ public: return mSettings[name]; } + inline void setValue(const std::string &name, F32 v) + { + setLLSD(name, LLSD::Real(v)); + } + inline void setValue(const std::string &name, const LLVector2 &value) { setValue(name, value.getValue()); @@ -150,7 +168,7 @@ public: setValue(name, value.getValue()); } - inline F64 getBlendFactor() const + inline BlendFactor getBlendFactor() const { return mBlendedFactor; } @@ -165,7 +183,7 @@ public: (const_cast(this))->updateSettings(); } - virtual void blend(const ptr_t &end, F64 blendf) = 0; + virtual void blend(const ptr_t &end, BlendFactor blendf) = 0; virtual bool validate(); @@ -220,8 +238,8 @@ protected: typedef std::set stringset_t; // combining settings objects. Customize for specific setting types - virtual void lerpSettings(const LLSettingsBase &other, F64 mix); - LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, F64 mix) const; + virtual void lerpSettings(const LLSettingsBase &other, BlendFactor mix); + LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, BlendFactor mix) const; /// when lerping between settings, some may require special handling. /// Get a list of these key to be skipped by the default settings lerp. @@ -248,7 +266,7 @@ protected: LLSD cloneSettings() const; - inline void setBlendFactor(F64 blendfactor) + inline void setBlendFactor(BlendFactor blendfactor) { mBlendedFactor = blendfactor; } @@ -256,18 +274,18 @@ protected: void markDirty() { mDirty = true; } private: - bool mDirty = true; + bool mDirty; LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; - F64 mBlendedFactor; + BlendFactor mBlendedFactor; }; -class LLSettingsBlender : public std::enable_shared_from_this +class LLSettingsBlender : public PTR_NAMESPACE::enable_shared_from_this { public: - typedef std::shared_ptr ptr_t; + typedef PTR_NAMESPACE::shared_ptr ptr_t; typedef boost::signals2::signal finish_signal_t; typedef boost::signals2::connection connection_t; @@ -287,7 +305,7 @@ public: virtual ~LLSettingsBlender() {} - virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 /*span*/ = 1.0) + virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::Seconds& span) { // note: the 'span' reset parameter is unused by the base class. if (!mInitial) @@ -322,10 +340,10 @@ public: return mOnFinished.connect(onfinished); } - virtual void update(F64 blendf); - virtual F64 setPosition(F64 blendf); + virtual void update(const LLSettingsBase::BlendFactor& blendf); + virtual F64 setPosition(const LLSettingsBase::TrackPosition& position); - virtual void switchTrack(S32 trackno, F64 position = -1.0) { /*NoOp*/ } + virtual void switchTrack(S32 trackno, const LLSettingsBase::BlendFactor& position) { /*NoOp*/ } protected: void triggerComplete(); @@ -341,7 +359,7 @@ class LLSettingsBlenderTimeDelta : public LLSettingsBlender { public: LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target, - const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds) : + const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, LLSettingsBase::Seconds seconds) : LLSettingsBlender(target, initsetting, endsetting), mBlendSpan(seconds), mLastUpdate(0.0f), @@ -355,20 +373,20 @@ public: { } - virtual void reset(LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0) override + virtual void reset(LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::Seconds& span) SETTINGS_OVERRIDE { LLSettingsBlender::reset(initsetting, endsetting, span); - mBlendSpan.value(span); - mTimeStart.value(LLDate::now().secondsSinceEpoch()); + mBlendSpan = span; + mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; - mTimeSpent.value(0.0f); + mTimeSpent = LLSettingsBase::Seconds(0.0); } - virtual void update(F64 timedelta) override; + virtual void advance(const LLSettingsBase::Seconds& timedelta); protected: - F64 calculateBlend(F64 spanpos, F64 spanlen) const; + LLSettingsBase::BlendFactor calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const; LLSettingsBase::Seconds mBlendSpan; LLSettingsBase::Seconds mLastUpdate; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 3f2238bf7a..cd2102a527 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -42,7 +42,22 @@ namespace LLTrace::BlockTimerStatHandle FTM_BLEND_WATERVALUES("Blending Water Environment"); LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERVALUES("Update Water Environment"); - LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, F32 key) + template + inline T get_wrapping_distance(T begin, T end) + { + if (begin < end) + { + return end - begin; + } + else if (begin > end) + { + return 1.0 - (begin - end); + } + + return 0; + } + + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, const LLSettingsBase::TrackPosition& key) { if (collection.empty()) return collection.end(); @@ -57,7 +72,7 @@ namespace return it; } - LLSettingsDay::CycleTrack_t::iterator get_wrapping_atbefore(LLSettingsDay::CycleTrack_t &collection, F32 key) + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atbefore(LLSettingsDay::CycleTrack_t &collection, const LLSettingsBase::TrackPosition& key) { if (collection.empty()) return collection.end(); @@ -102,7 +117,7 @@ const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water const S32 LLSettingsDay::FRAME_MAX(56); // *LAPRAS* Change when Agni -const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("94d296c2-6e05-963c-6b62-671199121dbb"); +static const LLUUID DEFAULT_ASSET_ID("94d296c2-6e05-963c-6b62-671199121dbb"); //========================================================================= LLSettingsDay::LLSettingsDay(const LLSD &data) : @@ -136,20 +151,20 @@ LLSD LLSettingsDay::getSettings() const LLSD tracks(LLSD::emptyArray()); - for (auto &track: mDayTracks) + for (CycleList_t::const_iterator itTrack = mDayTracks.begin(); itTrack != mDayTracks.end(); ++itTrack) { LLSD trackout(LLSD::emptyArray()); - for (auto &frame: track) + for (CycleTrack_t::const_iterator itFrame = (*itTrack).begin(); itFrame != (*itTrack).end(); ++itFrame) { - F32 frame_time = frame.first; - LLSettingsBase::ptr_t data = frame.second; + F32 frame = (*itFrame).first; + LLSettingsBase::ptr_t data = (*itFrame).second; size_t datahash = data->getHash(); std::stringstream keyname; keyname << datahash; - trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame_time))(SETTING_KEYNAME, keyname.str()))); + trackout.append(LLSD(LLSDMap(SETTING_KEYKFRAME, LLSD::Real(frame))(SETTING_KEYNAME, keyname.str()))); in_use[keyname.str()] = data; } tracks.append(trackout); @@ -157,12 +172,12 @@ LLSD LLSettingsDay::getSettings() const settings[SETTING_TRACKS] = tracks; LLSD frames(LLSD::emptyMap()); - for (auto &used_frame: in_use) + for (std::map::iterator itFrame = in_use.begin(); itFrame != in_use.end(); ++itFrame) { - LLSD framesettings = llsd_clone(used_frame.second->getSettings(), + LLSD framesettings = llsd_clone((*itFrame).second->getSettings(), LLSDMap("*", true)(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)); - frames[used_frame.first] = framesettings; + frames[(*itFrame).first] = framesettings; } settings[SETTING_FRAMES] = frames; @@ -212,8 +227,9 @@ bool LLSettingsDay::initialize() LLSD curtrack = tracks[i]; for (LLSD::array_const_iterator it = curtrack.beginArray(); it != curtrack.endArray(); ++it) { - F32 keyframe = (*it)[SETTING_KEYKFRAME].asReal(); - keyframe = llclamp(keyframe, 0.0f, 1.0f); + LLSettingsBase::Seconds keyframe = LLSettingsBase::Seconds((*it)[SETTING_KEYKFRAME].asReal()); + // is this supposed to be a blend factor or a time value? + //keyframe = llclamp((F32)keyframe, 0.0f, 1.0f); LLSettingsBase::ptr_t setting; if ((*it).has(SETTING_KEYNAME)) @@ -223,7 +239,7 @@ bool LLSettingsDay::initialize() setting = used[(*it)[SETTING_KEYNAME]]; if (setting && setting->getSettingType() != "water") { - LL_WARNS("SETTINGS", "DAYCYCLE") << "Water track referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; + LL_WARNS("DAYCYCLE") << "Water track referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; setting.reset(); } } @@ -232,7 +248,7 @@ bool LLSettingsDay::initialize() setting = used[(*it)[SETTING_KEYNAME]]; if (setting && setting->getSettingType() != "sky") { - LL_WARNS("SETTINGS", "DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; + LL_WARNS("DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; setting.reset(); } } @@ -296,7 +312,6 @@ LLSD LLSettingsDay::defaults() dfltsetting[SETTING_FRAMES] = frames; dfltsetting[SETTING_TYPE] = "daycycle"; - return dfltsetting; } @@ -475,7 +490,6 @@ void LLSettingsDay::startDayCycle() LL_WARNS("DAYCYCLE") << "Attempt to start day cycle on uninitialized object." << LL_ENDL; return; } - } @@ -497,15 +511,15 @@ LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) keyframes.reserve(track.size()); - for (auto &frame: track) + for (CycleTrack_t::iterator it = track.begin(); it != track.end(); ++it) { - keyframes.push_back(frame.first); + keyframes.push_back((*it).first); } return keyframes; } -bool LLSettingsDay::moveTrackKeyframe(S32 trackno, F32 old_frame, F32 new_frame) +bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::Seconds& old_frame, const LLSettingsBase::Seconds& new_frame) { if ((trackno < 0) || (trackno >= TRACK_MAX)) { @@ -524,7 +538,9 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, F32 old_frame, F32 new_frame) { LLSettingsBase::ptr_t base = iter->second; track.erase(iter); - track[llclamp(new_frame, 0.0f, 1.0f)] = base; + // why are we clamping a time value as if its a blend factor + //track[llclamp(new_frame, 0.0f, 1.0f)] = base; + track[new_frame] = base; return true; } @@ -532,7 +548,7 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, F32 old_frame, F32 new_frame) } -bool LLSettingsDay::removeTrackKeyframe(S32 trackno, F32 frame) +bool LLSettingsDay::removeTrackKeyframe(S32 trackno, const LLSettingsBase::Seconds& frame) { if ((trackno < 0) || (trackno >= TRACK_MAX)) { @@ -552,17 +568,18 @@ bool LLSettingsDay::removeTrackKeyframe(S32 trackno, F32 frame) return false; } -void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe) +void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, const LLSettingsBase::Seconds& keyframe) { setSettingsAtKeyframe(water, keyframe, TRACK_WATER); } -LLSettingsWater::ptr_t LLSettingsDay::getWaterAtKeyframe(F32 keyframe) const +LLSettingsWater::ptr_t LLSettingsDay::getWaterAtKeyframe(const LLSettingsBase::Seconds& keyframe) const { - return std::dynamic_pointer_cast(getSettingsAtKeyframe(keyframe, TRACK_WATER)); + LLSettingsBase* p = getSettingsAtKeyframe(keyframe, TRACK_WATER).get(); + return LLSettingsWater::ptr_t((LLSettingsWater*)p); } -void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, F32 keyframe, S32 track) +void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, const LLSettingsBase::Seconds& keyframe, S32 track) { if ((track < 1) || (track >= TRACK_MAX)) { @@ -573,18 +590,18 @@ void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, F32 keyfra setSettingsAtKeyframe(sky, keyframe, track); } -LLSettingsSky::ptr_t LLSettingsDay::getSkyAtKeyframe(F32 keyframe, S32 track) const +LLSettingsSky::ptr_t LLSettingsDay::getSkyAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const { if ((track < 1) || (track >= TRACK_MAX)) { LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL; return LLSettingsSky::ptr_t(); } - - return std::dynamic_pointer_cast(getSettingsAtKeyframe(keyframe, track)); + LLSettingsBase* p = getSettingsAtKeyframe(keyframe, track).get(); + return LLSettingsSky::ptr_t((LLSettingsSky*)p); } -void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, F32 keyframe, S32 track) +void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::Seconds& keyframe, S32 track) { if ((track < 0) || (track >= TRACK_MAX)) { @@ -592,11 +609,12 @@ void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, return; } - mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings; + //mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings; + mDayTracks[track][keyframe] = settings; setDirtyFlag(true); } -LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 track) const +LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const { if ((track < 0) || (track >= TRACK_MAX)) { @@ -614,19 +632,24 @@ LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 tra return LLSettingsBase::ptr_t(); } -F32 LLSettingsDay::getUpperBoundFrame(S32 track, F32 keyframe) +LLSettingsBase::TrackPosition LLSettingsDay::getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe) { return get_wrapping_atafter(mDayTracks[track], keyframe)->first; } -F32 LLSettingsDay::getLowerBoundFrame(S32 track, F32 keyframe) +LLSettingsBase::TrackPosition LLSettingsDay::getLowerBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe) { return get_wrapping_atbefore(mDayTracks[track], keyframe)->first; } -LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F32 keyframe) +LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe) { return TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); } +LLUUID LLSettingsDay::GetDefaultAssetId() +{ + return DEFAULT_ASSET_ID; +} + //========================================================================= diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index f7e5710dc1..b9038506d1 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -35,12 +35,15 @@ class LLSettingsSky; // These are alias for LLSettingsWater::ptr_t and LLSettingsSky::ptr_t respectively. // Here for definitions only. -typedef std::shared_ptr LLSettingsWaterPtr_t; -typedef std::shared_ptr LLSettingsSkyPtr_t; +typedef PTR_NAMESPACE::shared_ptr LLSettingsWaterPtr_t; +typedef PTR_NAMESPACE::shared_ptr LLSettingsSkyPtr_t; class LLSettingsDay : public LLSettingsBase { public: + // 32-bit as LLSD only supports that width at present + typedef S32Seconds Seconds; + static const std::string SETTING_KEYID; static const std::string SETTING_KEYNAME; static const std::string SETTING_KEYKFRAME; @@ -63,13 +66,12 @@ public: static const S32 TRACK_MAX; static const S32 FRAME_MAX; - static const LLUUID DEFAULT_ASSET_ID; - - typedef std::map CycleTrack_t; - typedef std::vector CycleList_t; - typedef std::shared_ptr ptr_t; - typedef std::vector KeyframeList_t; - typedef std::pair TrackBound_t; + typedef std::map CycleTrack_t; + typedef std::vector CycleList_t; + typedef PTR_NAMESPACE::shared_ptr ptr_t; + typedef PTR_NAMESPACE::weak_ptr wptr_t; + typedef std::vector KeyframeList_t; + typedef std::pair TrackBound_t; //--------------------------------------------------------------------- LLSettingsDay(const LLSD &data); @@ -78,29 +80,29 @@ public: bool initialize(); virtual ptr_t buildClone() = 0; - virtual LLSD getSettings() const override; - virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_DAYCYCLE; } + virtual LLSD getSettings() const SETTINGS_OVERRIDE; + virtual LLSettingsType::type_e getSettingTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_DAYCYCLE; } //--------------------------------------------------------------------- - virtual std::string getSettingType() const override { return std::string("daycycle"); } + virtual std::string getSettingType() const SETTINGS_OVERRIDE { return std::string("daycycle"); } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix) override; + virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix) SETTINGS_OVERRIDE; static LLSD defaults(); //--------------------------------------------------------------------- KeyframeList_t getTrackKeyframes(S32 track); - bool moveTrackKeyframe(S32 track, F32 old_frame, F32 new_frame); - bool removeTrackKeyframe(S32 track, F32 frame); - - void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe); - LLSettingsWaterPtr_t getWaterAtKeyframe(F32 keyframe) const; - void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track); - LLSettingsSkyPtr_t getSkyAtKeyframe(F32 keyframe, S32 track) const; - void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, F32 keyframe, S32 track); - LLSettingsBase::ptr_t getSettingsAtKeyframe(F32 keyframe, S32 track) const; + bool moveTrackKeyframe(S32 track, const LLSettingsBase::Seconds& old_frame, const LLSettingsBase::Seconds& new_frame); + bool removeTrackKeyframe(S32 track, const LLSettingsBase::Seconds& frame); + + void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, const LLSettingsBase::Seconds& keyframe); + LLSettingsWaterPtr_t getWaterAtKeyframe(const LLSettingsBase::Seconds& keyframe) const; + void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, const LLSettingsBase::Seconds& keyframe, S32 track); + LLSettingsSkyPtr_t getSkyAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const; + void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::Seconds& keyframe, S32 track); + LLSettingsBase::ptr_t getSettingsAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const; //--------------------------------------------------------------------- void startDayCycle(); @@ -113,18 +115,20 @@ public: void setInitialized(bool value = true) { mInitialized = value; } CycleTrack_t & getCycleTrack(S32 track); - virtual validation_list_t getValidationList() const override; + virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; static validation_list_t validationList(); - virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } - F32 getUpperBoundFrame(S32 track, F32 keyframe); - F32 getLowerBoundFrame(S32 track, F32 keyframe); + LLSettingsBase::TrackPosition getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe); + LLSettingsBase::TrackPosition getLowerBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe); + + static LLUUID GetDefaultAssetId(); protected: LLSettingsDay(); - virtual void updateSettings() override; + virtual void updateSettings() SETTINGS_OVERRIDE; bool mInitialized; @@ -135,10 +139,9 @@ private: void parseFromLLSD(LLSD &data); - static CycleTrack_t::iterator getEntryAtOrBefore(CycleTrack_t &track, F32 keyframe); - static CycleTrack_t::iterator getEntryAtOrAfter(CycleTrack_t &track, F32 keyframe); - - TrackBound_t getBoundingEntries(CycleTrack_t &track, F32 keyframe); + static CycleTrack_t::iterator getEntryAtOrBefore(CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe); + static CycleTrack_t::iterator getEntryAtOrAfter(CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe); + TrackBound_t getBoundingEntries(CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe); }; #endif diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cdd5b156d2..95502f47c3 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -106,12 +106,11 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_s const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); -const LLUUID LLSettingsSky::DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver -const LLUUID LLSettingsSky::DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver -const LLUUID LLSettingsSky::DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); - // *LAPRAS* Change when Agni! -const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); +static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver +static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver +static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); +static const LLUUID DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); @@ -218,7 +217,7 @@ LLSettingsSky::validation_list_t mieValidationList() bool validateLegacyHaze(LLSD &value) { LLSettingsSky::validation_list_t legacyHazeValidations = legacyHazeValidationList(); - llassert(value.type() == LLSD::Type::TypeMap); + llassert(value.type() == LLSD::TypeMap); LLSD result = LLSettingsBase::settingValidation(value, legacyHazeValidations); if (result["errors"].size() > 0) { @@ -242,14 +241,14 @@ bool validateRayleighLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (layerConfig.type() == LLSD::Type::TypeMap) + if (layerConfig.type() == LLSD::TypeMap) { if (!validateRayleighLayers(layerConfig)) { allGood = false; } } - else if (layerConfig.type() == LLSD::Type::TypeArray) + else if (layerConfig.type() == LLSD::TypeArray) { return validateRayleighLayers(layerConfig); } @@ -260,7 +259,7 @@ bool validateRayleighLayers(LLSD &value) } return allGood; } - llassert(value.type() == LLSD::Type::TypeMap); + llassert(value.type() == LLSD::TypeMap); LLSD result = LLSettingsBase::settingValidation(value, rayleighValidations); if (result["errors"].size() > 0) { @@ -284,14 +283,14 @@ bool validateAbsorptionLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (layerConfig.type() == LLSD::Type::TypeMap) + if (layerConfig.type() == LLSD::TypeMap) { if (!validateAbsorptionLayers(layerConfig)) { allGood = false; } } - else if (layerConfig.type() == LLSD::Type::TypeArray) + else if (layerConfig.type() == LLSD::TypeArray) { return validateAbsorptionLayers(layerConfig); } @@ -302,7 +301,7 @@ bool validateAbsorptionLayers(LLSD &value) } return allGood; } - llassert(value.type() == LLSD::Type::TypeMap); + llassert(value.type() == LLSD::TypeMap); LLSD result = LLSettingsBase::settingValidation(value, absorptionValidations); if (result["errors"].size() > 0) { @@ -326,14 +325,14 @@ bool validateMieLayers(LLSD &value) for (LLSD::array_iterator itf = value.beginArray(); itf != value.endArray(); ++itf) { LLSD& layerConfig = (*itf); - if (layerConfig.type() == LLSD::Type::TypeMap) + if (layerConfig.type() == LLSD::TypeMap) { if (!validateMieLayers(layerConfig)) { allGood = false; } } - else if (layerConfig.type() == LLSD::Type::TypeArray) + else if (layerConfig.type() == LLSD::TypeArray) { return validateMieLayers(layerConfig); } @@ -379,7 +378,7 @@ LLSettingsSky::LLSettingsSky(): void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsSky::ptr_t other = std::static_pointer_cast(end); + LLSettingsSky::ptr_t other((LLSettingsSky*)end.get()); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); @@ -416,8 +415,6 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const return slepSet; } - - LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const { return LLSettingsSky::validationList(); @@ -512,7 +509,6 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); - validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); @@ -771,9 +767,6 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKYVALUES); - //LL_INFOS("WINDLIGHT", "SKY", "EEP") << "WL Parameters are dirty. Reticulating Splines..." << LL_ENDL; - mPositionsDirty = isDirty(); mLightingDirty = isDirty(); @@ -1051,3 +1044,8 @@ void LLSettingsSky::calculateLightSettings() const mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; mFadeColor.setAlpha(0); } + +LLUUID LLSettingsSky::GetDefaultAssetId() +{ + return DEFAULT_ASSET_ID; +} \ No newline at end of file diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 839de033b3..fd613e4299 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -88,13 +88,7 @@ public: static const std::string SETTING_LEGACY_HAZE; - static const LLUUID DEFAULT_SUN_ID; - static const LLUUID DEFAULT_MOON_ID; - static const LLUUID DEFAULT_CLOUD_ID; - - static const LLUUID DEFAULT_ASSET_ID; - - typedef std::shared_ptr ptr_t; + typedef PTR_NAMESPACE::shared_ptr ptr_t; //--------------------------------------------------------------------- LLSettingsSky(const LLSD &data); @@ -103,11 +97,11 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const override { return std::string("sky"); } - virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_SKY; } + virtual std::string getSettingType() const SETTINGS_OVERRIDE { return std::string("sky"); } + virtual LLSettingsType::type_e getSettingTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_SKY; } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) override; + virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; static LLSD defaults(); @@ -374,7 +368,7 @@ public: virtual void loadTextures() { }; //===================================================================== - virtual validation_list_t getValidationList() const override; + virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; static validation_list_t validationList(); static LLSD translateLegacySettings(const LLSD& legacy); @@ -415,7 +409,9 @@ public: LLColor3 getSunDiffuse() const; LLColor4 getTotalAmbient() const; - virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } + + static LLUUID GetDefaultAssetId(); protected: static const std::string SETTING_LEGACY_EAST_ANGLE; @@ -424,13 +420,13 @@ protected: LLSettingsSky(); - virtual stringset_t getSlerpKeys() const override; - virtual stringset_t getSkipInterpolateKeys() const override; - virtual void updateSettings() override; + virtual stringset_t getSlerpKeys() const SETTINGS_OVERRIDE; + virtual stringset_t getSkipInterpolateKeys() const SETTINGS_OVERRIDE; + virtual void updateSettings() SETTINGS_OVERRIDE; private: - mutable bool mPositionsDirty = true; - mutable bool mLightingDirty = true; + mutable bool mPositionsDirty; + mutable bool mLightingDirty; static LLSD rayleighConfigDefault(); static LLSD absorptionConfigDefault(); diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index aa1f0f1935..03e174b454 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -67,11 +67,8 @@ const std::string LLSettingsWater::SETTING_LEGACY_SCALE_BELOW("scaleBelow"); const std::string LLSettingsWater::SETTING_LEGACY_WAVE1_DIR("wave1Dir"); const std::string LLSettingsWater::SETTING_LEGACY_WAVE2_DIR("wave2Dir"); -const LLUUID LLSettingsWater::DEFAULT_WATER_NORMAL_ID(DEFAULT_WATER_NORMAL); - // *LAPRAS* Change when Agni -const LLUUID LLSettingsWater::DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661"); - +static const LLUUID DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661"); //========================================================================= LLSettingsWater::LLSettingsWater(const LLSD &data) : @@ -98,7 +95,7 @@ LLSD LLSettingsWater::defaults() dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f); dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f); dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999); - dfltsetting[SETTING_NORMAL_MAP] = LLSD::UUID(DEFAULT_WATER_NORMAL_ID); + dfltsetting[SETTING_NORMAL_MAP] = LLSD::UUID(DEFAULT_WATER_NORMAL); dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f, 2.0f, 2.0f).getValue(); dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f); dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f); @@ -168,7 +165,7 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsWater::ptr_t other = std::static_pointer_cast(end); + LLSettingsWater::ptr_t other((LLSettingsWater*)end.get()); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); @@ -227,3 +224,13 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() return validation; } +LLUUID LLSettingsWater::GetDefaultAssetId() +{ + return DEFAULT_ASSET_ID; +} + +LLUUID LLSettingsWater::GetDefaultWaterNormalAssetId() +{ + return DEFAULT_WATER_NORMAL; +} + diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index a85a471bc5..92e9869e45 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -46,11 +46,7 @@ public: static const std::string SETTING_WAVE1_DIR; static const std::string SETTING_WAVE2_DIR; - static const LLUUID DEFAULT_WATER_NORMAL_ID; - - static const LLUUID DEFAULT_ASSET_ID; - - typedef std::shared_ptr ptr_t; + typedef PTR_NAMESPACE::shared_ptr ptr_t; //--------------------------------------------------------------------- LLSettingsWater(const LLSD &data); @@ -59,11 +55,11 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const override { return std::string("water"); } - virtual LLSettingsType::type_e getSettingTypeValue() const override { return LLSettingsType::ST_WATER; } + virtual std::string getSettingType() const SETTINGS_OVERRIDE { return std::string("water"); } + virtual LLSettingsType::type_e getSettingTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_WATER; } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) override; + virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; static LLSD defaults(); @@ -208,12 +204,15 @@ public: } - virtual validation_list_t getValidationList() const override; + virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; static validation_list_t validationList(); static LLSD translateLegacySettings(LLSD legacy); - virtual LLSettingsBase::ptr_t buildDerivedClone() override { return buildClone(); } + virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } + + static LLUUID GetDefaultAssetId(); + static LLUUID GetDefaultWaterNormalAssetId(); protected: static const std::string SETTING_LEGACY_BLUR_MULTIPILER; @@ -231,11 +230,11 @@ protected: LLSettingsWater(); - LLVector4 mWaterPlane; - F32 mWaterFogKS; + LLVector4 mWaterPlane; + F32 mWaterFogKS; private: - LLUUID mNextNormalMapID; + LLUUID mNextNormalMapID; }; #endif -- cgit v1.2.3 From 38271e9980f2ccb6b80b27cd063933748247a7be Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Sun, 3 Jun 2018 00:35:17 +0100 Subject: Remove redundant typedef hosing OSX build. --- indra/llinventory/llsettingsdaycycle.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index b9038506d1..6f54833c74 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -51,9 +51,6 @@ public: static const std::string SETTING_TRACKS; static const std::string SETTING_FRAMES; - // 32-bit as LLSD only supports that width at present - typedef S32Seconds Seconds; - static const Seconds MINIMUM_DAYLENGTH; static const Seconds DEFAULT_DAYLENGTH; static const Seconds MAXIMUM_DAYLENGTH; -- cgit v1.2.3 From cd8f0da2d187df69a99a665ea11faaa4e13b7a12 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 4 Jun 2018 23:12:21 +0100 Subject: Fix use of new typedefs in inventory settings code in llenvironment. --- indra/llinventory/llsettingsbase.cpp | 12 ++++----- indra/llinventory/llsettingsbase.h | 31 ++++++++++++----------- indra/llinventory/llsettingsdaycycle.cpp | 42 +++++++++++++------------------- indra/llinventory/llsettingsdaycycle.h | 24 +++++++++--------- indra/llinventory/llsettingswater.cpp | 2 +- 5 files changed, 53 insertions(+), 58 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 23afbdfa3a..76b1e0b2a6 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -35,7 +35,7 @@ //========================================================================= namespace { - const LLSettingsBase::BlendFactor BREAK_POINT = 0.5; + const LLSettingsBase::TrackPosition BREAK_POINT = 0.5; } //========================================================================= @@ -554,10 +554,10 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) //========================================================================= void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { - setPosition(blendf); + setBlendFactor(blendf); } -F64 LLSettingsBlender::setPosition(const LLSettingsBase::TrackPosition& blendf_in) +F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_in) { LLSettingsBase::TrackPosition blendf = blendf_in; if (blendf >= 1.0) @@ -565,7 +565,7 @@ F64 LLSettingsBlender::setPosition(const LLSettingsBase::TrackPosition& blendf_i triggerComplete(); return 1.0; } - blendf = llclamp(blendf, 0.0, 1.0); + blendf = llclamp(blendf, 0.0f, 1.0f); mTarget->replaceSettings(mInitial->getSettings()); if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) @@ -590,7 +590,7 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen); } -void LLSettingsBlenderTimeDelta::advance(const LLSettingsBase::Seconds& timedelta) +void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { mTimeSpent += timedelta; @@ -602,5 +602,5 @@ void LLSettingsBlenderTimeDelta::advance(const LLSettingsBase::Seconds& timedelt LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); - setPosition(blendf); + update(blendf); } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index a8e1cc5eea..374a2ec246 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -48,9 +48,6 @@ #define PTR_NAMESPACE std #define SETTINGS_OVERRIDE override -//#define PTR_NAMESPACE boost -//#define SETTINGS_OVERRIDE - class LLSettingsBase : public PTR_NAMESPACE::enable_shared_from_this, private boost::noncopyable @@ -63,7 +60,7 @@ class LLSettingsBase : public: typedef F64Seconds Seconds; typedef F64 BlendFactor; - typedef F64 TrackPosition; + typedef F32 TrackPosition; // 32-bit as these are stored in LLSD as such static const std::string SETTING_ID; static const std::string SETTING_NAME; @@ -305,7 +302,7 @@ public: virtual ~LLSettingsBlender() {} - virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::Seconds& span) + virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::TrackPosition&) { // note: the 'span' reset parameter is unused by the base class. if (!mInitial) @@ -341,9 +338,15 @@ public: } virtual void update(const LLSettingsBase::BlendFactor& blendf); - virtual F64 setPosition(const LLSettingsBase::TrackPosition& position); + virtual void applyTimeDelta(const LLSettingsBase::Seconds& delta) + { + llassert(false); + // your derived class needs to implement an override of this func + } + + virtual F64 setBlendFactor(const LLSettingsBase::BlendFactor& position); - virtual void switchTrack(S32 trackno, const LLSettingsBase::BlendFactor& position) { /*NoOp*/ } + virtual void switchTrack(S32 trackno, const LLSettingsBase::TrackPosition& position) { /*NoOp*/ } protected: void triggerComplete(); @@ -359,9 +362,9 @@ class LLSettingsBlenderTimeDelta : public LLSettingsBlender { public: LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target, - const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, LLSettingsBase::Seconds seconds) : + const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, LLSettingsBase::Seconds blend_span) : LLSettingsBlender(target, initsetting, endsetting), - mBlendSpan(seconds), + mBlendSpan(blend_span), mLastUpdate(0.0f), mTimeSpent(0.0f) { @@ -373,22 +376,22 @@ public: { } - virtual void reset(LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::Seconds& span) SETTINGS_OVERRIDE + virtual void reset(LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::TrackPosition& blend_span) SETTINGS_OVERRIDE { - LLSettingsBlender::reset(initsetting, endsetting, span); + LLSettingsBlender::reset(initsetting, endsetting, blend_span); - mBlendSpan = span; + mBlendSpan = blend_span; mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; mTimeSpent = LLSettingsBase::Seconds(0.0); } - virtual void advance(const LLSettingsBase::Seconds& timedelta); + virtual void applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE; protected: LLSettingsBase::BlendFactor calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const; - LLSettingsBase::Seconds mBlendSpan; + LLSettingsBase::TrackPosition mBlendSpan; LLSettingsBase::Seconds mLastUpdate; LLSettingsBase::Seconds mTimeSpent; LLSettingsBase::Seconds mTimeStart; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index cd2102a527..00391ca82d 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -51,7 +51,7 @@ namespace } else if (begin > end) { - return 1.0 - (begin - end); + return T(1.0) - (begin - end); } return 0; @@ -227,9 +227,8 @@ bool LLSettingsDay::initialize() LLSD curtrack = tracks[i]; for (LLSD::array_const_iterator it = curtrack.beginArray(); it != curtrack.endArray(); ++it) { - LLSettingsBase::Seconds keyframe = LLSettingsBase::Seconds((*it)[SETTING_KEYKFRAME].asReal()); - // is this supposed to be a blend factor or a time value? - //keyframe = llclamp((F32)keyframe, 0.0f, 1.0f); + LLSettingsBase::TrackPosition keyframe = LLSettingsBase::TrackPosition((*it)[SETTING_KEYKFRAME].asReal()); + keyframe = llclamp(keyframe, 0.0f, 1.0f); LLSettingsBase::ptr_t setting; if ((*it).has(SETTING_KEYNAME)) @@ -262,10 +261,6 @@ bool LLSettingsDay::initialize() hassky |= true; mDayTracks[i][keyframe] = setting; } - else - { - LL_WARNS("SETTINGS", "DAYCYCLE") << "Skipping frame on track #" << i << " at time index " << keyframe << LL_ENDL; - } } } @@ -312,6 +307,7 @@ LLSD LLSettingsDay::defaults() dfltsetting[SETTING_FRAMES] = frames; dfltsetting[SETTING_TYPE] = "daycycle"; + return dfltsetting; } @@ -365,7 +361,7 @@ namespace continue; } - F32 frame = elem[LLSettingsDay::SETTING_KEYKFRAME].asReal(); + LLSettingsBase::TrackPosition frame = elem[LLSettingsDay::SETTING_KEYKFRAME].asReal(); if ((frame < 0.0) || (frame > 1.0)) { frame = llclamp(frame, 0.0f, 1.0f); @@ -483,8 +479,6 @@ LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track) //========================================================================= void LLSettingsDay::startDayCycle() { - LLSettingsBase::Seconds now(LLDate::now().secondsSinceEpoch()); - if (!mInitialized) { LL_WARNS("DAYCYCLE") << "Attempt to start day cycle on uninitialized object." << LL_ENDL; @@ -519,7 +513,7 @@ LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) return keyframes; } -bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::Seconds& old_frame, const LLSettingsBase::Seconds& new_frame) +bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::TrackPosition& old_frame, const LLSettingsBase::TrackPosition& new_frame) { if ((trackno < 0) || (trackno >= TRACK_MAX)) { @@ -538,8 +532,7 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::Seconds { LLSettingsBase::ptr_t base = iter->second; track.erase(iter); - // why are we clamping a time value as if its a blend factor - //track[llclamp(new_frame, 0.0f, 1.0f)] = base; + track[llclamp(new_frame, 0.0f, 1.0f)] = base; track[new_frame] = base; return true; } @@ -548,7 +541,7 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::Seconds } -bool LLSettingsDay::removeTrackKeyframe(S32 trackno, const LLSettingsBase::Seconds& frame) +bool LLSettingsDay::removeTrackKeyframe(S32 trackno, const LLSettingsBase::TrackPosition& frame) { if ((trackno < 0) || (trackno >= TRACK_MAX)) { @@ -568,18 +561,18 @@ bool LLSettingsDay::removeTrackKeyframe(S32 trackno, const LLSettingsBase::Secon return false; } -void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, const LLSettingsBase::Seconds& keyframe) +void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, const LLSettingsBase::TrackPosition& keyframe) { setSettingsAtKeyframe(water, keyframe, TRACK_WATER); } -LLSettingsWater::ptr_t LLSettingsDay::getWaterAtKeyframe(const LLSettingsBase::Seconds& keyframe) const +LLSettingsWater::ptr_t LLSettingsDay::getWaterAtKeyframe(const LLSettingsBase::TrackPosition& keyframe) const { LLSettingsBase* p = getSettingsAtKeyframe(keyframe, TRACK_WATER).get(); return LLSettingsWater::ptr_t((LLSettingsWater*)p); } -void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, const LLSettingsBase::Seconds& keyframe, S32 track) +void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, const LLSettingsBase::TrackPosition& keyframe, S32 track) { if ((track < 1) || (track >= TRACK_MAX)) { @@ -590,18 +583,18 @@ void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, const LLSe setSettingsAtKeyframe(sky, keyframe, track); } -LLSettingsSky::ptr_t LLSettingsDay::getSkyAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const +LLSettingsSky::ptr_t LLSettingsDay::getSkyAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const { if ((track < 1) || (track >= TRACK_MAX)) { LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL; return LLSettingsSky::ptr_t(); } - LLSettingsBase* p = getSettingsAtKeyframe(keyframe, track).get(); - return LLSettingsSky::ptr_t((LLSettingsSky*)p); + + return PTR_NAMESPACE::dynamic_pointer_cast(getSettingsAtKeyframe(keyframe, track)); } -void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::Seconds& keyframe, S32 track) +void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::TrackPosition& keyframe, S32 track) { if ((track < 0) || (track >= TRACK_MAX)) { @@ -609,12 +602,11 @@ void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, return; } - //mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings; - mDayTracks[track][keyframe] = settings; + mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings; setDirtyFlag(true); } -LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const +LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const { if ((track < 0) || (track >= TRACK_MAX)) { diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 6f54833c74..6635bc0c5a 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -59,9 +59,9 @@ public: static const Seconds DEFAULT_DAYOFFSET; static const Seconds MAXIMUM_DAYOFFSET; - static const S32 TRACK_WATER; - static const S32 TRACK_MAX; - static const S32 FRAME_MAX; + static const S32 TRACK_WATER; + static const S32 TRACK_MAX; + static const S32 FRAME_MAX; typedef std::map CycleTrack_t; typedef std::vector CycleList_t; @@ -91,15 +91,15 @@ public: //--------------------------------------------------------------------- KeyframeList_t getTrackKeyframes(S32 track); - bool moveTrackKeyframe(S32 track, const LLSettingsBase::Seconds& old_frame, const LLSettingsBase::Seconds& new_frame); - bool removeTrackKeyframe(S32 track, const LLSettingsBase::Seconds& frame); - - void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, const LLSettingsBase::Seconds& keyframe); - LLSettingsWaterPtr_t getWaterAtKeyframe(const LLSettingsBase::Seconds& keyframe) const; - void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, const LLSettingsBase::Seconds& keyframe, S32 track); - LLSettingsSkyPtr_t getSkyAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const; - void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::Seconds& keyframe, S32 track); - LLSettingsBase::ptr_t getSettingsAtKeyframe(const LLSettingsBase::Seconds& keyframe, S32 track) const; + bool moveTrackKeyframe(S32 track, const LLSettingsBase::TrackPosition& old_frame, const LLSettingsBase::TrackPosition& new_frame); + bool removeTrackKeyframe(S32 track, const LLSettingsBase::TrackPosition& frame); + + void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, const LLSettingsBase::TrackPosition& keyframe); + LLSettingsWaterPtr_t getWaterAtKeyframe(const LLSettingsBase::TrackPosition& keyframe) const; + void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, const LLSettingsBase::TrackPosition& keyframe, S32 track); + LLSettingsSkyPtr_t getSkyAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const; + void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::TrackPosition& keyframe, S32 track); + LLSettingsBase::ptr_t getSettingsAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const; //--------------------------------------------------------------------- void startDayCycle(); diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 03e174b454..ba147baed7 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -165,7 +165,7 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsWater::ptr_t other((LLSettingsWater*)end.get()); + LLSettingsWater::ptr_t other = PTR_NAMESPACE::static_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); -- cgit v1.2.3 From b06803225bff30e863ea18cae1d33f42a4fd937e Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 4 Jun 2018 16:50:13 -0700 Subject: Reconnect apply to region and parcel reconnected to interface. --- indra/llinventory/llsettingsdaycycle.cpp | 12 ++++++++++++ indra/llinventory/llsettingsdaycycle.h | 1 + 2 files changed, 13 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index e67da95a6c..60e962b612 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -614,6 +614,18 @@ LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 tra return LLSettingsBase::ptr_t(); } +void LLSettingsDay::clearTrack(S32 track) +{ + if ((track < 0) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to clear track (#" << track << ") out of range!" << LL_ENDL; + return; + } + + mDayTracks[track].clear(); +} + + F32 LLSettingsDay::getUpperBoundFrame(S32 track, F32 keyframe) { return get_wrapping_atafter(mDayTracks[track], keyframe)->first; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 101cacc3a2..6fb48225c7 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -98,6 +98,7 @@ public: LLSettingsSkyPtr_t getSkyAtKeyframe(F32 keyframe, S32 track) const; void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, F32 keyframe, S32 track); LLSettingsBase::ptr_t getSettingsAtKeyframe(F32 keyframe, S32 track) const; + void clearTrack(S32 track); //--------------------------------------------------------------------- void startDayCycle(); -- cgit v1.2.3 From 499993e3aa89f49412861a6b7daff8e0e6f1c196 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 5 Jun 2018 17:29:58 +0100 Subject: Restore dropped header include and make constness match sim code. --- indra/llinventory/llsettingsbase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 374a2ec246..0920af4726 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -362,7 +362,7 @@ class LLSettingsBlenderTimeDelta : public LLSettingsBlender { public: LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target, - const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, LLSettingsBase::Seconds blend_span) : + const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::Seconds& blend_span) : LLSettingsBlender(target, initsetting, endsetting), mBlendSpan(blend_span), mLastUpdate(0.0f), -- cgit v1.2.3 From 6ea2847b58164f0ea315f7b2b9c34e663a07e60e Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 5 Jun 2018 17:58:09 +0100 Subject: Fix uninit data from deleting c++11-style init and not putting it in the ctor. Replace dynamic_pointer_cast so instance isn't accidentally deleted on func exit. --- indra/llinventory/llsettingssky.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 95502f47c3..a6f0d06e7d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -364,7 +364,9 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId() + mNextCloudTextureId(), + mPositionsDirty(true), + mLightingDirty(true) { } @@ -372,13 +374,15 @@ LLSettingsSky::LLSettingsSky(): LLSettingsBase(), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId() + mNextCloudTextureId(), + mPositionsDirty(true), + mLightingDirty(true) { } void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { - LLSettingsSky::ptr_t other((LLSettingsSky*)end.get()); + LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); -- cgit v1.2.3 From 610a793aa8fb9f918fc25eeab02b7415ac18b33b Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 5 Jun 2018 11:19:22 -0700 Subject: EOL in llsetingssky.cpp and llrender.cpp. const on ptr_t & in llenvironment --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index a6f0d06e7d..263e721d00 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1052,4 +1052,4 @@ void LLSettingsSky::calculateLightSettings() const LLUUID LLSettingsSky::GetDefaultAssetId() { return DEFAULT_ASSET_ID; -} \ No newline at end of file +} -- cgit v1.2.3 From caa5bd3cb9f22a42de9fc1f37bb98b17e2405b5b Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 6 Jun 2018 19:48:12 +0100 Subject: Fix legacy haze validation returning warnings as errors. Add assert that calculated spans are > 0 to avoid div by 0 NaNs. Make span calc return 1.0 for case where begin == end. Fix order of ops in LLTrackBlenderLoopingTime ctor causing skies to be init'd with water instances. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 263e721d00..4763215cff 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -226,7 +226,7 @@ bool validateLegacyHaze(LLSD &value) } if (result["warnings"].size() > 0) { - LL_WARNS("SETTINGS") << "Legacy Haze Config Validation warnings: " << result["errors"] << LL_ENDL; + LL_WARNS("SETTINGS") << "Legacy Haze Config Validation warnings: " << result["warnings"] << LL_ENDL; return false; } return true; -- cgit v1.2.3 From bff5049b9262e703c3ae583962552ea416212e8b Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 6 Jun 2018 17:10:58 -0700 Subject: Various editor fixes. Start adding a settings picker. --- indra/llinventory/llsettingsbase.cpp | 2 ++ indra/llinventory/llsettingsbase.h | 1 + indra/llinventory/llsettingsdaycycle.cpp | 39 ++++++++++++++++++++++++++++++++ indra/llinventory/llsettingsdaycycle.h | 1 + 4 files changed, 43 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 76b1e0b2a6..b677eb36df 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -38,6 +38,8 @@ namespace const LLSettingsBase::TrackPosition BREAK_POINT = 0.5; } +const LLSettingsBase::TrackPosition LLSettingsBase::INVALID_TRACKPOS(-1.0); + //========================================================================= std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings) { diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 0920af4726..4ebec4a99d 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -61,6 +61,7 @@ public: typedef F64Seconds Seconds; typedef F64 BlendFactor; typedef F32 TrackPosition; // 32-bit as these are stored in LLSD as such + static const TrackPosition INVALID_TRACKPOS; static const std::string SETTING_ID; static const std::string SETTING_NAME; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index e000b8f03f..807d8218a1 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -530,6 +530,14 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::TrackPo CycleTrack_t::iterator iter = track.find(old_frame); if (iter != track.end()) { + /*TODO check that we are not moving too close to another keyframe */ +// CycleTrack_t::value_type existing = getSettingsNearKeyfarme(new_frame, trackno, 2.5f); +// if ((*iter).first != existing.first) +// { +// LL_WARNS("DAYCYCLE") << "Track too close to existing track. Not moving." << LL_ENDL; +// return false; +// } + LLSettingsBase::ptr_t base = iter->second; track.erase(iter); track[llclamp(new_frame, 0.0f, 1.0f)] = base; @@ -624,6 +632,37 @@ LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(const LLSettingsBase: return LLSettingsBase::ptr_t(); } +LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyfarme(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const +{ + if ((track < 0) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to get track (#" << track << ") out of range!" << LL_ENDL; + return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); + } + + if (mDayTracks[track].empty()) + { + LL_INFOS("DAYCYCLE") << "Empty track" << LL_ENDL; + return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); + } + + TrackPosition startframe(keyframe - fudge); + if (startframe < 0.0f) + startframe = 1.0f + startframe; + + CycleTrack_t::iterator it = get_wrapping_atafter(const_cast(mDayTracks[track]), startframe); + + F32 dist = get_wrapping_distance(startframe, (*it).first); + + LL_WARNS("LAPRAS") << "[" << startframe << " ... " << keyframe << " -> " << (*it).first << "@" << dist << LL_ENDL; + + + if (dist <= (fudge * 2.0f)) + return (*it); + + return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); +} + void LLSettingsDay::clearTrack(S32 track) { if ((track < 0) || (track >= TRACK_MAX)) diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index cc6e27b296..5aa6e91183 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -100,6 +100,7 @@ public: LLSettingsSkyPtr_t getSkyAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const; void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::TrackPosition& keyframe, S32 track); LLSettingsBase::ptr_t getSettingsAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const; + CycleTrack_t::value_type getSettingsNearKeyfarme(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const; void clearTrack(S32 track); //--------------------------------------------------------------------- -- cgit v1.2.3 From 8b9ff4487bdc4becef270197f86c6f0bbfd324d1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 19 Jun 2018 12:04:35 -0700 Subject: Adding some timers for tracking --- indra/llinventory/llsettingssky.cpp | 103 ++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 47 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c25f9a5b2c..5de8c7bad6 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -35,8 +35,7 @@ //========================================================================= namespace { - LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); - LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); + const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); @@ -51,6 +50,11 @@ namespace } +static LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); +static LLTrace::BlockTimerStatHandle FTM_RECALCULATE_SKYVALUES("Recalculate Sky"); +static LLTrace::BlockTimerStatHandle FTM_RECALCULATE_BODIES("Recalculate Heavenly Bodies"); +static LLTrace::BlockTimerStatHandle FTM_RECALCULATE_LIGHTING("Recalculate Lighting"); + //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); @@ -784,6 +788,8 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { + LL_RECORD_BLOCK_TIME(FTM_RECALCULATE_SKYVALUES); + mPositionsDirty |= isVeryDirty(); mLightingDirty |= isVeryDirty(); @@ -811,29 +817,31 @@ bool LLSettingsSky::getIsMoonUp() const void LLSettingsSky::calculateHeavenlyBodyPositions() const { - /* can't do this as it gets defeated during animation of env panel settings if (!mPositionsDirty) { return; - }*/ + } + { + LL_RECORD_BLOCK_TIME(FTM_RECALCULATE_BODIES); - mPositionsDirty = false; - mLightingDirty = true; // changes light direction + mPositionsDirty = false; + mLightingDirty = true; // changes light direction - LLQuaternion sunq = getSunRotation(); - LLQuaternion moonq = getMoonRotation(); + LLQuaternion sunq = getSunRotation(); + LLQuaternion moonq = getMoonRotation(); - mSunDirection = DUE_EAST * sunq; - mMoonDirection = DUE_EAST * moonq; + mSunDirection = DUE_EAST * sunq; + mMoonDirection = DUE_EAST * moonq; - mSunDirection.normalize(); - mMoonDirection.normalize(); + mSunDirection.normalize(); + mMoonDirection.normalize(); - LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; - LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; + LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; + LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; - llassert(mSunDirection.lengthSquared() > 0.0); - llassert(mMoonDirection.lengthSquared() > 0.0); + llassert(mSunDirection.lengthSquared() > 0.0); + llassert(mMoonDirection.lengthSquared() > 0.0); + } } LLVector3 LLSettingsSky::getLightDirection() const @@ -1037,51 +1045,52 @@ LLColor4 LLSettingsSky::getTotalAmbient() const void LLSettingsSky::calculateLightSettings() const { - /* can't do this as it gets defeated during animation of env panel settings if (!mLightingDirty) { return; } - calculateHeavenlyBodyPositions();*/ + { + LL_RECORD_BLOCK_TIME(FTM_RECALCULATE_LIGHTING); - mLightingDirty = false; + mLightingDirty = false; - // Initialize temp variables - LLColor3 sunlight = getSunlightColor(); - LLColor3 ambient = getAmbientColor(); - F32 cloud_shadow = getCloudShadow(); - LLVector3 lightnorm = getLightDirection(); + // Initialize temp variables + LLColor3 sunlight = getSunlightColor(); + LLColor3 ambient = getAmbientColor(); + F32 cloud_shadow = getCloudShadow(); + LLVector3 lightnorm = getLightDirection(); - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - F32 max_y = getMaxY(); - LLColor3 light_atten = getLightAttenuation(max_y); - LLColor3 light_transmittance = getLightTransmittance(); + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + F32 max_y = getMaxY(); + LLColor3 light_atten = getLightAttenuation(max_y); + LLColor3 light_transmittance = getLightTransmittance(); - // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; + // and vary_sunlight will work properly with moon light + F32 lighty = lightnorm[1]; - lighty = llmax(0.f, lighty); - if(lighty > 0.f) - { - lighty = 1.f / lighty; - } - componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); + lighty = llmax(0.f, lighty); + if (lighty > 0.f) + { + lighty = 1.f / lighty; + } + componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); - //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + //increase ambient when there are more clouds + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; - //brightness of surface both sunlight and ambient - mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); - mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); + //brightness of surface both sunlight and ambient + mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); - mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance)); - mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); - mTotalAmbient = mSunAmbient; + mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance)); + mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); + mTotalAmbient = mSunAmbient; - mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; - mFadeColor.setAlpha(0); + mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; + mFadeColor.setAlpha(0); + } } LLUUID LLSettingsSky::GetDefaultAssetId() -- cgit v1.2.3 From 1f9b8f59afceeb8201780b679659f64845dcd7c1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 19 Jun 2018 16:46:12 -0700 Subject: Don't recalculate lighting every frame. Fix altitude transitions. On track switch ignore time threshold on blender. --- indra/llinventory/llsettingsbase.cpp | 4 +++- indra/llinventory/llsettingsbase.h | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 24e808c92a..db30a25a4c 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -610,10 +610,12 @@ void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& t if (mTimeSpent > mBlendSpan) { + mIgnoreTimeDelta = false; triggerComplete(); return; } - if (mTimeDeltaPassed < mTimeDeltaThreshold) + + if ((mTimeDeltaPassed < mTimeDeltaThreshold) && (!mIgnoreTimeDelta)) { return; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index f2fa78e41f..81158d64a7 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -387,7 +387,8 @@ public: mLastUpdate(0.0f), mTimeSpent(0.0f), mTimeDeltaThreshold(0.0f), - mTimeDeltaPassed(0.0f) + mTimeDeltaPassed(0.0f), + mIgnoreTimeDelta(false) { mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; @@ -421,6 +422,9 @@ public: return mTimeDeltaThreshold; } + inline void setIgnoreTimeDeltaThreshold(bool val) { mIgnoreTimeDelta = val; } + inline bool getIgnoreTimeDeltaThreshold() const { return mIgnoreTimeDelta; } + protected: LLSettingsBase::BlendFactor calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const; @@ -430,6 +434,7 @@ protected: LLSettingsBase::Seconds mTimeStart; LLSettingsBase::Seconds mTimeDeltaThreshold; LLSettingsBase::Seconds mTimeDeltaPassed; + bool mIgnoreTimeDelta; }; -- cgit v1.2.3 From 8365945f8af6e27e7180b40aae79f210f99bb7c8 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 8 Jun 2018 16:40:01 -0700 Subject: Settings inventory picker. --- indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsbase.h | 4 ++-- indra/llinventory/llsettingsdaycycle.cpp | 10 +++++----- indra/llinventory/llsettingsdaycycle.h | 4 ++-- indra/llinventory/llsettingssky.h | 4 ++-- indra/llinventory/llsettingswater.h | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index b677eb36df..1b3b5d2576 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -284,7 +284,7 @@ bool LLSettingsBase::validate() if (!mSettings.has(SETTING_TYPE)) { - mSettings[SETTING_TYPE] = getSettingType(); + mSettings[SETTING_TYPE] = getSettingsType(); } LLSD result = LLSettingsBase::settingValidation(mSettings, validations); diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 4ebec4a99d..5e40d185a1 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -75,9 +75,9 @@ public: virtual ~LLSettingsBase() { }; //--------------------------------------------------------------------- - virtual std::string getSettingType() const = 0; + virtual std::string getSettingsType() const = 0; - virtual LLSettingsType::type_e getSettingTypeValue() const = 0; + virtual LLSettingsType::type_e getSettingsTypeValue() const = 0; //--------------------------------------------------------------------- // Settings status diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 807d8218a1..54cf5302fa 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -145,7 +145,7 @@ LLSD LLSettingsDay::getSettings() const if (mSettings.has(SETTING_ID)) settings[SETTING_ID] = mSettings[SETTING_ID]; - settings[SETTING_TYPE] = getSettingType(); + settings[SETTING_TYPE] = getSettingsType(); std::map in_use; @@ -236,18 +236,18 @@ bool LLSettingsDay::initialize() if (i == TRACK_WATER) { setting = used[(*it)[SETTING_KEYNAME]]; - if (setting && setting->getSettingType() != "water") + if (setting && setting->getSettingsType() != "water") { - LL_WARNS("DAYCYCLE") << "Water track referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; + LL_WARNS("DAYCYCLE") << "Water track referencing " << setting->getSettingsType() << " frame at " << keyframe << "." << LL_ENDL; setting.reset(); } } else { setting = used[(*it)[SETTING_KEYNAME]]; - if (setting && setting->getSettingType() != "sky") + if (setting && setting->getSettingsType() != "sky") { - LL_WARNS("DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingType() << " frame at " << keyframe << "." << LL_ENDL; + LL_WARNS("DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingsType() << " frame at " << keyframe << "." << LL_ENDL; setting.reset(); } } diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 5aa6e91183..be888f42cc 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -78,11 +78,11 @@ public: virtual ptr_t buildClone() = 0; virtual LLSD getSettings() const SETTINGS_OVERRIDE; - virtual LLSettingsType::type_e getSettingTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_DAYCYCLE; } + virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_DAYCYCLE; } //--------------------------------------------------------------------- - virtual std::string getSettingType() const SETTINGS_OVERRIDE { return std::string("daycycle"); } + 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; diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index fd613e4299..6fb9aad342 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -97,8 +97,8 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const SETTINGS_OVERRIDE { return std::string("sky"); } - virtual LLSettingsType::type_e getSettingTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_SKY; } + 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; diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 92e9869e45..19761f6f07 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -55,8 +55,8 @@ public: virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- - virtual std::string getSettingType() const SETTINGS_OVERRIDE { return std::string("water"); } - virtual LLSettingsType::type_e getSettingTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_WATER; } + 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; -- cgit v1.2.3 From a0598b12656cdcf22ba95cacd01b5ff36f8f1b26 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 11 Jun 2018 17:46:16 +0100 Subject: Fix water fog consolidation in underwater shaders. Add plumbing facilities to allow current and next moon textures to be passed to moon shader. Modify moon shader to blend between current and next moon textures by blend factor. --- indra/llinventory/llsettingssky.cpp | 14 ++++++++++++-- indra/llinventory/llsettingssky.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 4763215cff..38574c4ef8 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -602,8 +602,8 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = DEFAULT_CLOUD_ID; - dfltsetting[SETTING_MOON_TEXTUREID] = DEFAULT_MOON_ID; // gMoonTextureID; // These two are returned by the login... wow! - dfltsetting[SETTING_SUN_TEXTUREID] = DEFAULT_SUN_ID; // gSunTextureID; + dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); + dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); dfltsetting[SETTING_TYPE] = "sky"; @@ -1053,3 +1053,13 @@ LLUUID LLSettingsSky::GetDefaultAssetId() { return DEFAULT_ASSET_ID; } + +LLUUID LLSettingsSky::GetDefaultSunTextureId() +{ + return DEFAULT_SUN_ID; +} + +LLUUID LLSettingsSky::GetDefaultMoonTextureId() +{ + return DEFAULT_MOON_ID; +} diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index fd613e4299..0cdd064624 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -412,6 +412,8 @@ public: virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } static LLUUID GetDefaultAssetId(); + static LLUUID GetDefaultSunTextureId(); + static LLUUID GetDefaultMoonTextureId(); protected: static const std::string SETTING_LEGACY_EAST_ANGLE; -- cgit v1.2.3 From fc8d0de673da0e02915556008a365aca67472eba Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 11 Jun 2018 22:39:57 +0100 Subject: Make cloud rendering use textures defined in sky settings and add code to shaders to lerp between current and next cloud texture. --- indra/llinventory/llsettingsdaycycle.cpp | 4 ++-- indra/llinventory/llsettingssky.cpp | 14 +++++++++++++- indra/llinventory/llsettingssky.h | 6 ++---- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 54cf5302fa..0cfc8c09ca 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -104,8 +104,8 @@ const std::string LLSettingsDay::SETTING_KEYHASH("key_hash"); const std::string LLSettingsDay::SETTING_TRACKS("tracks"); const std::string LLSettingsDay::SETTING_FRAMES("frames"); -const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYLENGTH(300); // 5 mins -const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYLENGTH(14400); // 4 hours +const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYLENGTH(120); // 2 mins +const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYLENGTH(14400); // 4 hours const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYOFFSET(0); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 38574c4ef8..8034ce8f7d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,8 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#pragma optimize("", off) + static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); static const LLVector3 DUE_EAST = LLVector3::x_axis; @@ -601,7 +603,7 @@ LLSD LLSettingsSky::defaults() dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; - dfltsetting[SETTING_CLOUD_TEXTUREID] = DEFAULT_CLOUD_ID; + dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); @@ -1063,3 +1065,13 @@ LLUUID LLSettingsSky::GetDefaultMoonTextureId() { return DEFAULT_MOON_ID; } + +LLUUID LLSettingsSky::GetDefaultCloudNoiseTextureId() +{ + return DEFAULT_CLOUD_ID; +} + +void LLSettingsSky::setMoonRotation(const LLQuaternion &val) +{ + setValue(SETTING_MOON_ROTATION, val); +} diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index c30efe0781..fb1134c8f7 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -292,10 +292,7 @@ public: return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); } - void setMoonRotation(const LLQuaternion &val) - { - setValue(SETTING_MOON_ROTATION, val); - } + void setMoonRotation(const LLQuaternion &val); LLUUID getMoonTextureId() const { @@ -414,6 +411,7 @@ public: static LLUUID GetDefaultAssetId(); static LLUUID GetDefaultSunTextureId(); static LLUUID GetDefaultMoonTextureId(); + static LLUUID GetDefaultCloudNoiseTextureId(); protected: static const std::string SETTING_LEGACY_EAST_ANGLE; -- cgit v1.2.3 From 327ded51298599a0057c4a3baf388956ecfed2e5 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 11 Jun 2018 22:42:10 +0100 Subject: Remove debug pragma and put setMoonRotation back in the header file. --- indra/llinventory/llsettingssky.cpp | 7 ------- indra/llinventory/llsettingssky.h | 5 ++++- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8034ce8f7d..f02500d61b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,8 +32,6 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#pragma optimize("", off) - static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); static const LLVector3 DUE_EAST = LLVector3::x_axis; @@ -1070,8 +1068,3 @@ LLUUID LLSettingsSky::GetDefaultCloudNoiseTextureId() { return DEFAULT_CLOUD_ID; } - -void LLSettingsSky::setMoonRotation(const LLQuaternion &val) -{ - setValue(SETTING_MOON_ROTATION, val); -} diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index fb1134c8f7..299e679b6a 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -292,7 +292,10 @@ public: return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); } - void setMoonRotation(const LLQuaternion &val); + void setMoonRotation(const LLQuaternion &val) + { + setValue(SETTING_MOON_ROTATION, val); + } LLUUID getMoonTextureId() const { -- cgit v1.2.3 From 67ab0084f87c40bf31d7fadded55cc9ea6299ca2 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 12 Jun 2018 18:42:07 +0100 Subject: Fix env panel forward action. Make env panel update environment when jumping frame to frame. Add separate funcs for sun/moon vectors in various coord systems. Make haze glow only pay attention to sun (i.e. fix sun glow when moon is near horizon in daytime). --- indra/llinventory/llsettingsbase.cpp | 4 +- indra/llinventory/llsettingssky.cpp | 299 ++++++++++++++++++++++++++++++-- indra/llinventory/llsettingssky.h | 323 ++++++++--------------------------- 3 files changed, 358 insertions(+), 268 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 1b3b5d2576..a261c98bb1 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -206,7 +206,9 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F if (slerps.find(key_name) != slerps.end()) { - LLQuaternion q = slerp(mix, LLQuaternion(value), LLQuaternion(other_value)); + LLQuaternion a(value); + LLQuaternion b(other_value); + LLQuaternion q = slerp(mix, a, b); newvalue = q.getValue(); } else diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f02500d61b..bb310806bd 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -386,6 +386,9 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); + mPositionsDirty = true; + mLightingDirty = true; + setBlendFactor(blendf); mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); @@ -771,11 +774,14 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - mPositionsDirty = isDirty(); - mLightingDirty = isDirty(); - // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); + + // NOTE: these functions are designed to do nothing unless a dirty bit has been set + // so if you add new settings that are referenced by these update functions, + // you'll need to insure that your setter updates the dirty bits as well + calculateHeavenlyBodyPositions(); + calculateLightSettings(); } bool LLSettingsSky::getIsSunUp() const @@ -792,10 +798,11 @@ bool LLSettingsSky::getIsMoonUp() const void LLSettingsSky::calculateHeavenlyBodyPositions() const { + /* can't do this as it gets defeated during animation of env panel settings if (!mPositionsDirty) { return; - } + }*/ mPositionsDirty = false; @@ -811,7 +818,7 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const LLVector3 LLSettingsSky::getLightDirection() const { - calculateHeavenlyBodyPositions(); + update(); // is the normal from the sun or the moon if (getIsSunUp()) @@ -955,60 +962,61 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const LLVector3 LLSettingsSky::getSunDirection() const { - calculateHeavenlyBodyPositions(); + update(); return mSunDirection; } LLVector3 LLSettingsSky::getMoonDirection() const { - calculateHeavenlyBodyPositions(); + update(); return mMoonDirection; } LLColor4U LLSettingsSky::getFadeColor() const { - calculateLightSettings(); + update(); return mFadeColor; } LLColor4 LLSettingsSky::getMoonAmbient() const { - calculateLightSettings(); + update(); return mMoonAmbient; } LLColor3 LLSettingsSky::getMoonDiffuse() const { - calculateLightSettings(); + update(); return mMoonDiffuse; } LLColor4 LLSettingsSky::getSunAmbient() const { - calculateLightSettings(); + update(); return mSunAmbient; } LLColor3 LLSettingsSky::getSunDiffuse() const { - calculateLightSettings(); + update(); return mSunDiffuse; } LLColor4 LLSettingsSky::getTotalAmbient() const { - calculateLightSettings(); + update(); return mTotalAmbient; } void LLSettingsSky::calculateLightSettings() const { + /* can't do this as it gets defeated during animation of env panel settings if (!mLightingDirty) { return; } - calculateHeavenlyBodyPositions(); + calculateHeavenlyBodyPositions();*/ mLightingDirty = false; @@ -1068,3 +1076,266 @@ LLUUID LLSettingsSky::GetDefaultCloudNoiseTextureId() { return DEFAULT_CLOUD_ID; } + +F32 LLSettingsSky::getPlanetRadius() const +{ + return mSettings[SETTING_PLANET_RADIUS].asReal(); +} + +F32 LLSettingsSky::getSkyBottomRadius() const +{ + return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); +} + +F32 LLSettingsSky::getSkyTopRadius() const +{ + return mSettings[SETTING_SKY_TOP_RADIUS].asReal(); +} + +F32 LLSettingsSky::getSunArcRadians() const +{ + return mSettings[SETTING_SUN_ARC_RADIANS].asReal(); +} + +F32 LLSettingsSky::getMieAnisotropy() const +{ + return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); +} + +LLSD LLSettingsSky::getRayleighConfigs() const +{ + return mSettings[SETTING_RAYLEIGH_CONFIG]; +} + +LLSD LLSettingsSky::getMieConfigs() const +{ + return mSettings[SETTING_MIE_CONFIG]; +} + +LLSD LLSettingsSky::getAbsorptionConfigs() const +{ + return mSettings[SETTING_ABSORPTION_CONFIG]; +} + +LLUUID LLSettingsSky::getBloomTextureId() const +{ + return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); +} + +//--------------------------------------------------------------------- +LLColor3 LLSettingsSky::getAmbientColor() const +{ + return LLColor3(mSettings[SETTING_AMBIENT]); +} + +void LLSettingsSky::setAmbientColor(const LLColor3 &val) +{ + setValue(SETTING_AMBIENT, val); + mLightingDirty = true; +} + +LLColor3 LLSettingsSky::getCloudColor() const +{ + return LLColor3(mSettings[SETTING_CLOUD_COLOR]); +} + +void LLSettingsSky::setCloudColor(const LLColor3 &val) +{ + setValue(SETTING_CLOUD_COLOR, val); +} + +LLUUID LLSettingsSky::getCloudNoiseTextureId() const +{ + return mSettings[SETTING_CLOUD_TEXTUREID].asUUID(); +} + +void LLSettingsSky::setCloudNoiseTextureId(const LLUUID &id) +{ + setValue(SETTING_CLOUD_TEXTUREID, id); +} + +LLColor3 LLSettingsSky::getCloudPosDensity1() const +{ + return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]); +} + +void LLSettingsSky::setCloudPosDensity1(const LLColor3 &val) +{ + setValue(SETTING_CLOUD_POS_DENSITY1, val); +} + +LLColor3 LLSettingsSky::getCloudPosDensity2() const +{ + return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY2]); +} + +void LLSettingsSky::setCloudPosDensity2(const LLColor3 &val) +{ + setValue(SETTING_CLOUD_POS_DENSITY2, val); +} + +F32 LLSettingsSky::getCloudScale() const +{ + return mSettings[SETTING_CLOUD_SCALE].asReal(); +} + +void LLSettingsSky::setCloudScale(F32 val) +{ + setValue(SETTING_CLOUD_SCALE, val); +} + +LLVector2 LLSettingsSky::getCloudScrollRate() const +{ + return LLVector2(mSettings[SETTING_CLOUD_SCROLL_RATE]); +} + +void LLSettingsSky::setCloudScrollRate(const LLVector2 &val) +{ + setValue(SETTING_CLOUD_SCROLL_RATE, val); +} + +void LLSettingsSky::setCloudScrollRateX(F32 val) +{ + mSettings[SETTING_CLOUD_SCROLL_RATE][0] = val; + setDirtyFlag(true); +} + +void LLSettingsSky::setCloudScrollRateY(F32 val) +{ + mSettings[SETTING_CLOUD_SCROLL_RATE][1] = val; + setDirtyFlag(true); +} + +F32 LLSettingsSky::getCloudShadow() const +{ + return mSettings[SETTING_CLOUD_SHADOW].asReal(); +} + +void LLSettingsSky::setCloudShadow(F32 val) +{ + setValue(SETTING_CLOUD_SHADOW, val); + mLightingDirty = true; +} + +F32 LLSettingsSky::getDomeOffset() const +{ + //return mSettings[SETTING_DOME_OFFSET].asReal(); + return DOME_OFFSET; +} + +F32 LLSettingsSky::getDomeRadius() const +{ + //return mSettings[SETTING_DOME_RADIUS].asReal(); + return DOME_RADIUS; +} + +F32 LLSettingsSky::getGamma() const +{ + return mSettings[SETTING_GAMMA].asReal(); +} + +void LLSettingsSky::setGamma(F32 val) +{ + mSettings[SETTING_GAMMA] = LLSD::Real(val); + setDirtyFlag(true); + mLightingDirty = true; +} + +LLColor3 LLSettingsSky::getGlow() const +{ + return LLColor3(mSettings[SETTING_GLOW]); +} + +void LLSettingsSky::setGlow(const LLColor3 &val) +{ + setValue(SETTING_GLOW, val); + mLightingDirty = true; +} + +F32 LLSettingsSky::getMaxY() const +{ + return mSettings[SETTING_MAX_Y].asReal(); +} + +void LLSettingsSky::setMaxY(F32 val) +{ + setValue(SETTING_MAX_Y, val); +} + +LLQuaternion LLSettingsSky::getMoonRotation() const +{ + return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); +} + +void LLSettingsSky::setMoonRotation(const LLQuaternion &val) +{ + setValue(SETTING_MOON_ROTATION, val); + mPositionsDirty = true; +} + +LLUUID LLSettingsSky::getMoonTextureId() const +{ + return mSettings[SETTING_MOON_TEXTUREID].asUUID(); +} + +void LLSettingsSky::setMoonTextureId(LLUUID id) +{ + setValue(SETTING_MOON_TEXTUREID, id); +} + +F32 LLSettingsSky::getStarBrightness() const +{ + return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); +} + +void LLSettingsSky::setStarBrightness(F32 val) +{ + setValue(SETTING_STAR_BRIGHTNESS, val); +} + +LLColor3 LLSettingsSky::getSunlightColor() const +{ + return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]); +} + +void LLSettingsSky::setSunlightColor(const LLColor3 &val) +{ + setValue(SETTING_SUNLIGHT_COLOR, val); + mLightingDirty = true; +} + +LLQuaternion LLSettingsSky::getSunRotation() const +{ + return LLQuaternion(mSettings[SETTING_SUN_ROTATION]); +} + +void LLSettingsSky::setSunRotation(const LLQuaternion &val) +{ + setValue(SETTING_SUN_ROTATION, val); + mPositionsDirty = true; +} + +LLUUID LLSettingsSky::getSunTextureId() const +{ + return mSettings[SETTING_SUN_TEXTUREID].asUUID(); +} + +void LLSettingsSky::setSunTextureId(LLUUID id) +{ + setValue(SETTING_SUN_TEXTUREID, id); +} + +LLUUID LLSettingsSky::getNextSunTextureId() const +{ + return mNextSunTextureId; +} + +LLUUID LLSettingsSky::getNextMoonTextureId() const +{ + return mNextMoonTextureId; +} + +LLUUID LLSettingsSky::getNextCloudNoiseTextureId() const +{ + return mNextCloudTextureId; +} diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 299e679b6a..a557080744 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -105,267 +105,85 @@ public: static LLSD defaults(); - F32 getPlanetRadius() const - { - return mSettings[SETTING_PLANET_RADIUS].asReal(); - } - - F32 getSkyBottomRadius() const - { - return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); - } - - F32 getSkyTopRadius() const - { - return mSettings[SETTING_SKY_TOP_RADIUS].asReal(); - } - - F32 getSunArcRadians() const - { - return mSettings[SETTING_SUN_ARC_RADIANS].asReal(); - } - - F32 getMieAnisotropy() const - { - return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); - } - - LLSD getRayleighConfigs() const - { - return mSettings[SETTING_RAYLEIGH_CONFIG]; - } - - LLSD getMieConfigs() const - { - return mSettings[SETTING_MIE_CONFIG]; - } - - LLSD getAbsorptionConfigs() const - { - return mSettings[SETTING_ABSORPTION_CONFIG]; - } - - LLUUID getBloomTextureId() const - { - return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); - } + F32 getPlanetRadius() const; + F32 getSkyBottomRadius() const; + F32 getSkyTopRadius() const; + F32 getSunArcRadians() const; + F32 getMieAnisotropy() const; + LLSD getRayleighConfigs() const; + LLSD getMieConfigs() const; + + LLSD getAbsorptionConfigs() const; + LLUUID getBloomTextureId() const; //--------------------------------------------------------------------- - LLColor3 getAmbientColor() const - { - return LLColor3(mSettings[SETTING_AMBIENT]); - } - - void setAmbientColor(const LLColor3 &val) - { - setValue(SETTING_AMBIENT, val); - } - - LLColor3 getCloudColor() const - { - return LLColor3(mSettings[SETTING_CLOUD_COLOR]); - } - - void setCloudColor(const LLColor3 &val) - { - setValue(SETTING_CLOUD_COLOR, val); - } - - LLUUID getCloudNoiseTextureId() const - { - return mSettings[SETTING_CLOUD_TEXTUREID].asUUID(); - } - - void setCloudNoiseTextureId(const LLUUID &id) - { - setValue(SETTING_CLOUD_TEXTUREID, id); - } - - LLColor3 getCloudPosDensity1() const - { - return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]); - } - - void setCloudPosDensity1(const LLColor3 &val) - { - setValue(SETTING_CLOUD_POS_DENSITY1, val); - } - - LLColor3 getCloudPosDensity2() const - { - return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY2]); - } - - void setCloudPosDensity2(const LLColor3 &val) - { - setValue(SETTING_CLOUD_POS_DENSITY2, val); - } - - F32 getCloudScale() const - { - return mSettings[SETTING_CLOUD_SCALE].asReal(); - } - - void setCloudScale(F32 val) - { - setValue(SETTING_CLOUD_SCALE, val); - } - - LLVector2 getCloudScrollRate() const - { - return LLVector2(mSettings[SETTING_CLOUD_SCROLL_RATE]); - } - - void setCloudScrollRate(const LLVector2 &val) - { - setValue(SETTING_CLOUD_SCROLL_RATE, val); - } - - void setCloudScrollRateX(F32 val) - { - mSettings[SETTING_CLOUD_SCROLL_RATE][0] = val; - setDirtyFlag(true); - } - - void setCloudScrollRateY(F32 val) - { - mSettings[SETTING_CLOUD_SCROLL_RATE][1] = val; - setDirtyFlag(true); - } - - F32 getCloudShadow() const - { - return mSettings[SETTING_CLOUD_SHADOW].asReal(); - } - - void setCloudShadow(F32 val) - { - setValue(SETTING_CLOUD_SHADOW, val); - } + LLColor3 getAmbientColor() const; + void setAmbientColor(const LLColor3 &val); + + LLColor3 getCloudColor() const; + void setCloudColor(const LLColor3 &val); + + LLUUID getCloudNoiseTextureId() const; + void setCloudNoiseTextureId(const LLUUID &id); + + LLColor3 getCloudPosDensity1() const; + void setCloudPosDensity1(const LLColor3 &val); + + LLColor3 getCloudPosDensity2() const; + void setCloudPosDensity2(const LLColor3 &val); + F32 getCloudScale() const; + void setCloudScale(F32 val); + + LLVector2 getCloudScrollRate() const; + void setCloudScrollRate(const LLVector2 &val); + + void setCloudScrollRateX(F32 val); + void setCloudScrollRateY(F32 val); + + F32 getCloudShadow() const; + void setCloudShadow(F32 val); - F32 getDomeOffset() const - { - return DOME_OFFSET; - //return mSettings[SETTING_DOME_OFFSET].asReal(); - } - - F32 getDomeRadius() const - { - return DOME_RADIUS; - //return mSettings[SETTING_DOME_RADIUS].asReal(); - } - - F32 getGamma() const - { - return mSettings[SETTING_GAMMA].asReal(); - } - - void setGamma(F32 val) - { - mSettings[SETTING_GAMMA] = LLSD::Real(val); - setDirtyFlag(true); - } - - LLColor3 getGlow() const - { - return LLColor3(mSettings[SETTING_GLOW]); - } - - void setGlow(const LLColor3 &val) - { - setValue(SETTING_GLOW, val); - } - - F32 getMaxY() const - { - return mSettings[SETTING_MAX_Y].asReal(); - } - - void setMaxY(F32 val) - { - setValue(SETTING_MAX_Y, val); - } - - LLQuaternion getMoonRotation() const - { - return LLQuaternion(mSettings[SETTING_MOON_ROTATION]); - } - - void setMoonRotation(const LLQuaternion &val) - { - setValue(SETTING_MOON_ROTATION, val); - } - - LLUUID getMoonTextureId() const - { - return mSettings[SETTING_MOON_TEXTUREID].asUUID(); - } - - void setMoonTextureId(LLUUID id) - { - setValue(SETTING_MOON_TEXTUREID, id); - } - - F32 getStarBrightness() const - { - return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); - } - - void setStarBrightness(F32 val) - { - setValue(SETTING_STAR_BRIGHTNESS, val); - } - - LLColor3 getSunlightColor() const - { - return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]); - } - - void setSunlightColor(const LLColor3 &val) - { - setValue(SETTING_SUNLIGHT_COLOR, val); - } - - LLQuaternion getSunRotation() const - { - return LLQuaternion(mSettings[SETTING_SUN_ROTATION]); - } - - void setSunRotation(const LLQuaternion &val) - { - setValue(SETTING_SUN_ROTATION, val); - } - - LLUUID getSunTextureId() const - { - return mSettings[SETTING_SUN_TEXTUREID].asUUID(); - } - - void setSunTextureId(LLUUID id) - { - setValue(SETTING_SUN_TEXTUREID, id); - } + F32 getDomeOffset() const; + F32 getDomeRadius() const; - //===================================================================== - // transient properties used in animations. - LLUUID getNextSunTextureId() const - { - return mNextSunTextureId; - } + F32 getGamma() const; + + void setGamma(F32 val); - LLUUID getNextMoonTextureId() const - { - return mNextMoonTextureId; - } + LLColor3 getGlow() const; + void setGlow(const LLColor3 &val); - LLUUID getNextCloudNoiseTextureId() const - { - return mNextCloudTextureId; - } + F32 getMaxY() const; + + void setMaxY(F32 val); + + LLQuaternion getMoonRotation() const; + void setMoonRotation(const LLQuaternion &val); + + LLUUID getMoonTextureId() const; + void setMoonTextureId(LLUUID id); + + F32 getStarBrightness() const; + void setStarBrightness(F32 val); + + LLColor3 getSunlightColor() const; + void setSunlightColor(const LLColor3 &val); + + LLQuaternion getSunRotation() const; + void setSunRotation(const LLQuaternion &val) ; + + LLUUID getSunTextureId() const; + void setSunTextureId(LLUUID id); //===================================================================== - virtual void loadTextures() { }; + // transient properties used in animations. + LLUUID getNextSunTextureId() const; + LLUUID getNextMoonTextureId() const; + LLUUID getNextCloudNoiseTextureId() const; + + //===================================================================== + virtual void loadTextures() { }; //===================================================================== virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; @@ -380,7 +198,6 @@ public: LLColor3 getLightTransmittance() const; LLColor3 gammaCorrect(const LLColor3& in) const; - LLColor3 getBlueDensity() const; LLColor3 getBlueHorizon() const; F32 getHazeDensity() const; -- cgit v1.2.3 From 2add1e7abdf536b32bfbfa4b353189782df8cb19 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 12 Jun 2018 12:39:59 -0700 Subject: Time threshold on timer based updates. Editor can replace frame with one from inventory. Extra check on adding a frame type. --- indra/llinventory/llsettingsbase.cpp | 16 +++++++ indra/llinventory/llsettingsbase.h | 46 +++++++++++++++--- indra/llinventory/llsettingsdaycycle.cpp | 15 ++++++ indra/llinventory/llsettingssky.cpp | 81 ++++++++++++++++++++------------ indra/llinventory/llsettingssky.h | 7 +++ 5 files changed, 128 insertions(+), 37 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 1b3b5d2576..f28d90cb62 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -53,6 +53,7 @@ const std::string LLSettingsBase::SETTING_ID("id"); const std::string LLSettingsBase::SETTING_NAME("name"); const std::string LLSettingsBase::SETTING_HASH("hash"); const std::string LLSettingsBase::SETTING_TYPE("type"); +const std::string LLSettingsBase::SETTING_ASSETID("asset_id"); //========================================================================= LLSettingsBase::LLSettingsBase(): @@ -307,6 +308,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); + static Validator validateAssetId(SETTING_ASSETID, false, LLSD::TypeUUID); stringset_t validated; stringset_t strip; bool isValid(true); @@ -335,6 +337,13 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } validated.insert(validateHash.getName()); + if (!validateAssetId.verify(settings)) + { + errors.append(LLSD::String("Invalid asset Id")); + isValid = false; + } + validated.insert(validateAssetId.getName()); + if (!validateType.verify(settings)) { errors.append( LLSD::String("Unable to validate 'type'.") ); @@ -595,12 +604,19 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { mTimeSpent += timedelta; + mTimeDeltaPassed += timedelta; if (mTimeSpent > mBlendSpan) { triggerComplete(); return; } + if (mTimeDeltaPassed < mTimeDeltaThreshold) + { + return; + } + + mTimeDeltaPassed = LLSettingsBase::Seconds(0.0); LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 5e40d185a1..f0d104ff53 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -67,6 +67,7 @@ public: static const std::string SETTING_NAME; static const std::string SETTING_HASH; static const std::string SETTING_TYPE; + static const std::string SETTING_ASSETID; typedef std::map parammapping_t; @@ -83,6 +84,7 @@ public: // Settings status inline bool hasSetting(const std::string ¶m) const { return mSettings.has(param); } inline bool isDirty() const { return mDirty; } + inline bool isVeryDirty() const { return mReplaced; } inline void setDirtyFlag(bool dirty) { mDirty = dirty; } size_t getHash() const; // Hash will not include Name, ID or a previously stored Hash @@ -102,11 +104,20 @@ public: setValue(SETTING_NAME, val); } + inline LLUUID getAssetId() const + { + if (mSettings.has(SETTING_ASSETID)) + return mSettings[SETTING_ASSETID].asUUID(); + return LLUUID(); + } + + inline void replaceSettings(LLSD settings) { mSettings = settings; mBlendedFactor = 0.0; setDirtyFlag(true); + mReplaced = true; } virtual LLSD getSettings() const; @@ -117,6 +128,8 @@ public: { mSettings[name] = value; mDirty = true; + if (mSettings.has(SETTING_ASSETID)) + mSettings.erase(SETTING_ASSETID); } inline void setValue(const std::string &name, const LLSD &value) @@ -176,7 +189,7 @@ public: // special consideration from getters. inline void update() const { - if (!mDirty) + if ((!mDirty) && (!mReplaced)) return; (const_cast(this))->updateSettings(); } @@ -226,6 +239,12 @@ public: typedef std::vector validation_list_t; static LLSD settingValidation(LLSD &settings, validation_list_t &validations); + + inline void setAssetId(LLUUID value) + { // note that this skips setLLSD + mSettings[SETTING_ASSETID] = value; + } + protected: LLSettingsBase(); @@ -249,7 +268,7 @@ protected: virtual stringset_t getSlerpKeys() const { return stringset_t(); } // Calculate any custom settings that may need to be cached. - virtual void updateSettings() { mDirty = false; }; + virtual void updateSettings() { mDirty = false; mReplaced = false; }; virtual validation_list_t getValidationList() const = 0; @@ -269,10 +288,9 @@ protected: mBlendedFactor = blendfactor; } - void markDirty() { mDirty = true; } - private: bool mDirty; + bool mReplaced; // super dirty! LLSD combineSDMaps(const LLSD &first, const LLSD &other) const; @@ -367,7 +385,9 @@ public: LLSettingsBlender(target, initsetting, endsetting), mBlendSpan(blend_span), mLastUpdate(0.0f), - mTimeSpent(0.0f) + mTimeSpent(0.0f), + mTimeDeltaThreshold(0.0f), + mTimeDeltaPassed(0.0f) { mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; @@ -384,11 +404,23 @@ public: mBlendSpan = blend_span; mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; - mTimeSpent = LLSettingsBase::Seconds(0.0); + mTimeSpent = LLSettingsBase::Seconds(0.0f); + mTimeDeltaPassed = LLSettingsBase::Seconds(0.0f); } virtual void applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE; + inline void setTimeDeltaThreshold(const LLSettingsBase::Seconds time) + { + mTimeDeltaThreshold = time; + mTimeDeltaPassed = time + LLSettingsBase::Seconds(1.0); // take the next update call. + } + + inline LLSettingsBase::Seconds getTimeDeltaThreshold() const + { + return mTimeDeltaThreshold; + } + protected: LLSettingsBase::BlendFactor calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const; @@ -396,6 +428,8 @@ protected: LLSettingsBase::Seconds mLastUpdate; LLSettingsBase::Seconds mTimeSpent; LLSettingsBase::Seconds mTimeStart; + LLSettingsBase::Seconds mTimeDeltaThreshold; + LLSettingsBase::Seconds mTimeDeltaPassed; }; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 54cf5302fa..87233e18c3 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -26,6 +26,7 @@ */ #include "llsettingsdaycycle.h" +#include "llerror.h" #include #include #include "lltrace.h" @@ -610,6 +611,20 @@ void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, return; } + std::string type = settings->getSettingsType(); + if ((track == TRACK_WATER) && (type != "water")) + { + LL_WARNS("DAYCYCLE") << "Attempt to add frame of type '" << type << "' to water track!" << LL_ENDL; + llassert(type == "water"); + return; + } + else if ((track != TRACK_WATER) && (type != "sky")) + { + LL_WARNS("DAYCYCLE") << "Attempt to add frame of type '" << type << "' to sky track!" << LL_ENDL; + llassert(type == "sky"); + return; + } + mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings; setDirtyFlag(true); } diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 38574c4ef8..87581e813b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,25 +32,24 @@ #include "llfasttimer.h" #include "v3colorutil.h" -static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees -static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); -static const LLVector3 DUE_EAST = LLVector3::x_axis; //========================================================================= namespace { LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); -} -static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) -{ - LLQuaternion quat; - quat.setEulerAngles(0.0f, -altitude, azimuth); - return quat; -} + const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees + const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); + const LLVector3 DUE_EAST = LLVector3::x_axis; -const F32 LLSettingsSky::DOME_OFFSET(0.96f); -const F32 LLSettingsSky::DOME_RADIUS(15000.f); + LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) + { + LLQuaternion quat; + quat.setEulerAngles(0.0f, -altitude, azimuth); + return quat; + } + +} //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); @@ -114,6 +113,9 @@ static const LLUUID DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); +const F32 LLSettingsSky::DOME_OFFSET(0.96f); +const F32 LLSettingsSky::DOME_RADIUS(15000.f); + namespace { @@ -771,11 +773,14 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - mPositionsDirty = isDirty(); - mLightingDirty = isDirty(); + mPositionsDirty |= isVeryDirty(); + mLightingDirty |= isVeryDirty(); // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); + + calculateHeavenlyBodyPositions(); + calculateLightSettings(); } bool LLSettingsSky::getIsSunUp() const @@ -798,6 +803,7 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const } mPositionsDirty = false; + mLightingDirty = true; // changes light direction LLQuaternion sunq = getSunRotation(); LLQuaternion moonq = getMoonRotation(); @@ -807,21 +813,27 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); + + LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; + LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; + + llassert(mSunDirection.lengthSquared() > 0.0); + llassert(mMoonDirection.lengthSquared() > 0.0); } LLVector3 LLSettingsSky::getLightDirection() const { - calculateHeavenlyBodyPositions(); + update(); // is the normal from the sun or the moon if (getIsSunUp()) { - llassert(mSunDirection.length() > 0.01f); + llassert(mSunDirection.lengthSquared() > 0.01f); return mSunDirection; } else if (getIsMoonUp()) { - llassert(mMoonDirection.length() > 0.01f); + llassert(mMoonDirection.lengthSquared() > 0.01f); return mMoonDirection; } @@ -885,36 +897,43 @@ F32 LLSettingsSky::getDistanceMultiplier() const void LLSettingsSky::setBlueDensity(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue(); - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } void LLSettingsSky::setBlueHorizon(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON] = val.getValue(); - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } void LLSettingsSky::setDensityMultiplier(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER] = val; - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } void LLSettingsSky::setDistanceMultiplier(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER] = val; - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } void LLSettingsSky::setHazeDensity(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY] = val; - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } + void LLSettingsSky::setHazeHorizon(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON] = val; - markDirty(); + setDirtyFlag(true); + mLightingDirty = true; } // Sunlight attenuation effect (hue and brightness) due to atmosphere @@ -955,49 +974,49 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const LLVector3 LLSettingsSky::getSunDirection() const { - calculateHeavenlyBodyPositions(); + update(); return mSunDirection; } LLVector3 LLSettingsSky::getMoonDirection() const { - calculateHeavenlyBodyPositions(); + update(); return mMoonDirection; } LLColor4U LLSettingsSky::getFadeColor() const { - calculateLightSettings(); + update(); return mFadeColor; } LLColor4 LLSettingsSky::getMoonAmbient() const { - calculateLightSettings(); + update(); return mMoonAmbient; } LLColor3 LLSettingsSky::getMoonDiffuse() const { - calculateLightSettings(); + update(); return mMoonDiffuse; } LLColor4 LLSettingsSky::getSunAmbient() const { - calculateLightSettings(); + update(); return mSunAmbient; } LLColor3 LLSettingsSky::getSunDiffuse() const { - calculateLightSettings(); + update(); return mSunDiffuse; } LLColor4 LLSettingsSky::getTotalAmbient() const { - calculateLightSettings(); + update(); return mTotalAmbient; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index c30efe0781..a206106945 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -159,6 +159,7 @@ public: void setAmbientColor(const LLColor3 &val) { setValue(SETTING_AMBIENT, val); + mLightingDirty = true; } LLColor3 getCloudColor() const @@ -241,6 +242,7 @@ public: void setCloudShadow(F32 val) { setValue(SETTING_CLOUD_SHADOW, val); + mLightingDirty = true; } @@ -265,6 +267,7 @@ public: { mSettings[SETTING_GAMMA] = LLSD::Real(val); setDirtyFlag(true); + mLightingDirty = true; } LLColor3 getGlow() const @@ -285,6 +288,7 @@ public: void setMaxY(F32 val) { setValue(SETTING_MAX_Y, val); + mLightingDirty = true; } LLQuaternion getMoonRotation() const @@ -295,6 +299,7 @@ public: void setMoonRotation(const LLQuaternion &val) { setValue(SETTING_MOON_ROTATION, val); + mPositionsDirty = true; } LLUUID getMoonTextureId() const @@ -325,6 +330,7 @@ public: void setSunlightColor(const LLColor3 &val) { setValue(SETTING_SUNLIGHT_COLOR, val); + mLightingDirty = true; } LLQuaternion getSunRotation() const @@ -335,6 +341,7 @@ public: void setSunRotation(const LLQuaternion &val) { setValue(SETTING_SUN_ROTATION, val); + mPositionsDirty = true; } LLUUID getSunTextureId() const -- cgit v1.2.3 From 34865c4bb5cd12219606f44748159fe7cbeea264 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 13 Jun 2018 00:51:39 +0100 Subject: Mods to hook up water settings to water normals for rendering with support for current to next blending. Modify LLSettingsFoo::buildDefaultFoo to use a static and avoid re-validation of default sky/water/daycycle settings. Remove all references to gSun/MoonTextureId globals (they should come from sky settings now). --- indra/llinventory/llsettingsbase.h | 2 +- indra/llinventory/llsettingsdaycycle.cpp | 1 + indra/llinventory/llsettingssky.cpp | 8 ++++++++ indra/llinventory/llsettingssky.h | 2 ++ indra/llinventory/llsettingswater.cpp | 16 +++++++++++++++- indra/llinventory/llsettingswater.h | 18 ++++++++++++++++++ 6 files changed, 45 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index f0d104ff53..f2fa78e41f 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -112,7 +112,7 @@ public: } - inline void replaceSettings(LLSD settings) + virtual void replaceSettings(LLSD settings) { mSettings = settings; mBlendedFactor = 0.0; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 009d7b06f2..51bc6b0e54 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -37,6 +37,7 @@ #include "llsettingswater.h" #include "llframetimer.h" + //========================================================================= namespace { diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index db574f2eec..c25f9a5b2c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -382,8 +382,16 @@ LLSettingsSky::LLSettingsSky(): { } +void LLSettingsSky::replaceSettings(LLSD settings) +{ + LLSettingsBase::replaceSettings(settings); + +} + void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { + llassert(getSettingsType() == end->getSettingsType()); + LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index a557080744..e6783f6694 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -103,6 +103,8 @@ public: // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; + virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE; + static LLSD defaults(); F32 getPlanetRadius() const; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index ba147baed7..16281e23cc 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -47,6 +47,7 @@ const std::string LLSettingsWater::SETTING_FOG_DENSITY("water_fog_density"); const std::string LLSettingsWater::SETTING_FOG_MOD("underwater_fog_mod"); const std::string LLSettingsWater::SETTING_FRESNEL_OFFSET("fresnel_offset"); const std::string LLSettingsWater::SETTING_FRESNEL_SCALE("fresnel_scale"); +const std::string LLSettingsWater::SETTING_TRANSPARENT_TEXTURE("transparent_texture"); const std::string LLSettingsWater::SETTING_NORMAL_MAP("normal_map"); const std::string LLSettingsWater::SETTING_NORMAL_SCALE("normal_scale"); const std::string LLSettingsWater::SETTING_SCALE_ABOVE("scale_above"); @@ -69,6 +70,8 @@ const std::string LLSettingsWater::SETTING_LEGACY_WAVE2_DIR("wave2Dir"); // *LAPRAS* Change when Agni static const LLUUID DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661"); +static const LLUUID DEFAULT_TRANSPARENT_WATER_TEXTURE("2bfd3884-7e27-69b9-ba3a-3e673f680004"); +static const LLUUID DEFAULT_OPAQUE_WATER_TEXTURE("43c32285-d658-1793-c123-bf86315de055"); //========================================================================= LLSettingsWater::LLSettingsWater(const LLSD &data) : @@ -95,7 +98,8 @@ LLSD LLSettingsWater::defaults() dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f); dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f); dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999); - dfltsetting[SETTING_NORMAL_MAP] = LLSD::UUID(DEFAULT_WATER_NORMAL); + dfltsetting[SETTING_TRANSPARENT_TEXTURE] = GetDefaultTransparentTextureAssetId(); + dfltsetting[SETTING_NORMAL_MAP] = GetDefaultWaterNormalAssetId(); dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f, 2.0f, 2.0f).getValue(); dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f); dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f); @@ -171,6 +175,7 @@ void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) replaceSettings(blenddata); setBlendFactor(blendf); mNextNormalMapID = other->getNormalMapID(); + mNextTransparentTextureID = other->getTransparentTextureID(); } LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const @@ -234,3 +239,12 @@ LLUUID LLSettingsWater::GetDefaultWaterNormalAssetId() return DEFAULT_WATER_NORMAL; } +LLUUID LLSettingsWater::GetDefaultTransparentTextureAssetId() +{ + return DEFAULT_TRANSPARENT_WATER_TEXTURE; +} + +LLUUID LLSettingsWater::GetDefaultOpaqueTextureAssetId() +{ + return DEFAULT_OPAQUE_WATER_TEXTURE; +} diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 19761f6f07..9d006d492d 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -39,6 +39,7 @@ public: static const std::string SETTING_FOG_MOD; static const std::string SETTING_FRESNEL_OFFSET; static const std::string SETTING_FRESNEL_SCALE; + static const std::string SETTING_TRANSPARENT_TEXTURE; static const std::string SETTING_NORMAL_MAP; static const std::string SETTING_NORMAL_SCALE; static const std::string SETTING_SCALE_ABOVE; @@ -124,6 +125,16 @@ public: setValue(SETTING_FRESNEL_SCALE, val); } + LLUUID getTransparentTextureID() const + { + return mSettings[SETTING_TRANSPARENT_TEXTURE].asUUID(); + } + + void setTransparentTextureID(LLUUID val) + { + setValue(SETTING_TRANSPARENT_TEXTURE, val); + } + LLUUID getNormalMapID() const { return mSettings[SETTING_NORMAL_MAP].asUUID(); @@ -203,6 +214,10 @@ public: return mNextNormalMapID; } + LLUUID getNextTransparentTextureID() const + { + return mNextTransparentTextureID; + } virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; static validation_list_t validationList(); @@ -213,6 +228,8 @@ public: static LLUUID GetDefaultAssetId(); static LLUUID GetDefaultWaterNormalAssetId(); + static LLUUID GetDefaultTransparentTextureAssetId(); + static LLUUID GetDefaultOpaqueTextureAssetId(); protected: static const std::string SETTING_LEGACY_BLUR_MULTIPILER; @@ -234,6 +251,7 @@ protected: F32 mWaterFogKS; private: + LLUUID mNextTransparentTextureID; LLUUID mNextNormalMapID; }; -- cgit v1.2.3 From 66d78ce1c73d5da3bc5bc39fe0196a9f82040105 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 15 Jun 2018 21:15:02 +0100 Subject: Make water and sky defaults take a position value to allow for default daycycle w/ multiple frames. Make default daycycle add 8 frames at 0, 0.125, 0.25 etc Merge over server-side bugfixes. Eliminate extraneous dirty bits in sky settings. --- indra/llinventory/llsettingsbase.cpp | 19 ++++++--- indra/llinventory/llsettingsbase.h | 5 ++- indra/llinventory/llsettingsdaycycle.cpp | 52 +++++++++++++++--------- indra/llinventory/llsettingssky.cpp | 68 +++++++------------------------- indra/llinventory/llsettingssky.h | 5 +-- indra/llinventory/llsettingswater.cpp | 7 +++- indra/llinventory/llsettingswater.h | 2 +- 7 files changed, 72 insertions(+), 86 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 24e808c92a..fb4f5cdd60 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -580,10 +580,18 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ } blendf = llclamp(blendf, 0.0f, 1.0f); - mTarget->replaceSettings(mInitial->getSettings()); - if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) - { // this is a trivial blend. Results will be identical to the initial. - return blendf; + if (mTarget) + { + mTarget->replaceSettings(mInitial->getSettings()); + if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) + { // this is a trivial blend. Results will be identical to the initial. + return blendf; + } + mTarget->blend(mFinal, blendf); + } + else + { + LL_WARNS("SETTINGS") << "No target for settings blender." << LL_ENDL; } mTarget->blend(mFinal, blendf); @@ -592,7 +600,8 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ void LLSettingsBlender::triggerComplete() { - mTarget->replaceSettings(mFinal->getSettings()); + if (mTarget) + mTarget->replaceSettings(mFinal->getSettings()); LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon mOnFinished(shared_from_this()); } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index f2fa78e41f..3a5296daa4 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -312,7 +312,7 @@ public: mInitial(initsetting), mFinal(endsetting) { - if (mInitial) + if (mInitial && mTarget) mTarget->replaceSettings(mInitial->getSettings()); if (!mFinal) @@ -333,7 +333,8 @@ public: if (!mFinal) mFinal = mInitial; - mTarget->replaceSettings(mInitial->getSettings()); + if (mTarget) + mTarget->replaceSettings(mInitial->getSettings()); } LLSettingsBase::ptr_t getTarget() const diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 51bc6b0e54..7dc415e480 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -233,11 +233,13 @@ bool LLSettingsDay::initialize() keyframe = llclamp(keyframe, 0.0f, 1.0f); LLSettingsBase::ptr_t setting; + if ((*it).has(SETTING_KEYNAME)) { + std::string key_name = (*it)[SETTING_KEYNAME]; if (i == TRACK_WATER) { - setting = used[(*it)[SETTING_KEYNAME]]; + setting = used[key_name]; if (setting && setting->getSettingsType() != "water") { LL_WARNS("DAYCYCLE") << "Water track referencing " << setting->getSettingsType() << " frame at " << keyframe << "." << LL_ENDL; @@ -246,7 +248,7 @@ bool LLSettingsDay::initialize() } else { - setting = used[(*it)[SETTING_KEYNAME]]; + setting = used[key_name]; if (setting && setting->getSettingsType() != "sky") { LL_WARNS("DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingsType() << " frame at " << keyframe << "." << LL_ENDL; @@ -287,13 +289,36 @@ LLSD LLSettingsDay::defaults() dfltsetting[SETTING_NAME] = "_default_"; + LLSD frames(LLSD::emptyMap()); LLSD waterTrack; - waterTrack[SETTING_KEYKFRAME] = 0.0f; - waterTrack[SETTING_KEYNAME] = "_default_"; - LLSD skyTrack; - skyTrack[SETTING_KEYKFRAME] = 0.0f; - skyTrack[SETTING_KEYNAME] = "_default_"; + + + const U32 FRAME_COUNT = 8; + const F32 FRAME_STEP = 1.0f / F32(FRAME_COUNT); + F32 time = 0.0f; + for (U32 i = 0; i < FRAME_COUNT; i++) + { + std::string name("_default_"); + name += ('a' + i); + + std::string water_frame_name("water:"); + std::string sky_frame_name("sky:"); + + water_frame_name += name; + sky_frame_name += name; + + waterTrack[SETTING_KEYKFRAME] = time; + waterTrack[SETTING_KEYNAME] = water_frame_name; + + skyTrack[SETTING_KEYKFRAME] = time; + skyTrack[SETTING_KEYNAME] = sky_frame_name; + + frames[water_frame_name] = LLSettingsWater::defaults(time); + frames[sky_frame_name] = LLSettingsSky::defaults(time); + + time += FRAME_STEP; + } LLSD tracks; tracks.append(LLSDArray(waterTrack)); @@ -301,10 +326,7 @@ LLSD LLSettingsDay::defaults() dfltsetting[SETTING_TRACKS] = tracks; - LLSD frames(LLSD::emptyMap()); - - frames["water:_defaults_"] = LLSettingsWater::defaults(); - frames["sky:_defaults_"] = LLSettingsSky::defaults(); + dfltsetting[SETTING_FRAMES] = frames; @@ -532,14 +554,6 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::TrackPo CycleTrack_t::iterator iter = track.find(old_frame); if (iter != track.end()) { - /*TODO check that we are not moving too close to another keyframe */ -// CycleTrack_t::value_type existing = getSettingsNearKeyfarme(new_frame, trackno, 2.5f); -// if ((*iter).first != existing.first) -// { -// LL_WARNS("DAYCYCLE") << "Track too close to existing track. Not moving." << LL_ENDL; -// return false; -// } - LLSettingsBase::ptr_t base = iter->second; track.erase(iter); track[llclamp(new_frame, 0.0f, 1.0f)] = base; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c25f9a5b2c..83499cc9fc 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -366,9 +366,7 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId(), - mPositionsDirty(true), - mLightingDirty(true) + mNextCloudTextureId() { } @@ -376,9 +374,7 @@ LLSettingsSky::LLSettingsSky(): LLSettingsBase(), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId(), - mPositionsDirty(true), - mLightingDirty(true) + mNextCloudTextureId() { } @@ -396,9 +392,7 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); - mPositionsDirty = true; - mLightingDirty = true; - + setBlendFactor(blendf); mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); @@ -585,14 +579,19 @@ LLSD LLSettingsSky::mieConfigDefault() return dflt_mie; } -LLSD LLSettingsSky::defaults() +LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) { LLSD dfltsetting; LLQuaternion sunquat; LLQuaternion moonquat; - sunquat = convert_azimuth_and_altitude_to_quat(0.0f, 80.0f * DEG_TO_RAD); - moonquat = convert_azimuth_and_altitude_to_quat(F_PI, 80.0f * DEG_TO_RAD); + F32 azimuth = (F_PI * position) + (80.0f * DEG_TO_RAD); + F32 altitude = (F_PI * position); + + // give the sun and moon slightly different tracks through the sky + // instead of positioning them at opposite poles from each other... + sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); + moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); // Magic constants copied form dfltsetting.xml dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); @@ -784,9 +783,6 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) void LLSettingsSky::updateSettings() { - mPositionsDirty |= isVeryDirty(); - mLightingDirty |= isVeryDirty(); - // base class clears dirty flag so as to not trigger recursive update LLSettingsBase::updateSettings(); @@ -811,15 +807,6 @@ bool LLSettingsSky::getIsMoonUp() const void LLSettingsSky::calculateHeavenlyBodyPositions() const { - /* can't do this as it gets defeated during animation of env panel settings - if (!mPositionsDirty) - { - return; - }*/ - - mPositionsDirty = false; - mLightingDirty = true; // changes light direction - LLQuaternion sunq = getSunRotation(); LLQuaternion moonq = getMoonRotation(); @@ -829,11 +816,11 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); - LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; - LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; + //LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; + //LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; - llassert(mSunDirection.lengthSquared() > 0.0); - llassert(mMoonDirection.lengthSquared() > 0.0); + llassert(mSunDirection.lengthSquared() > 0.01f); + llassert(mMoonDirection.lengthSquared() > 0.01f); } LLVector3 LLSettingsSky::getLightDirection() const @@ -843,12 +830,10 @@ LLVector3 LLSettingsSky::getLightDirection() const // is the normal from the sun or the moon if (getIsSunUp()) { - llassert(mSunDirection.lengthSquared() > 0.01f); return mSunDirection; } else if (getIsMoonUp()) { - llassert(mMoonDirection.lengthSquared() > 0.01f); return mMoonDirection; } @@ -913,42 +898,36 @@ void LLSettingsSky::setBlueDensity(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue(); setDirtyFlag(true); - mLightingDirty = true; } void LLSettingsSky::setBlueHorizon(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON] = val.getValue(); setDirtyFlag(true); - mLightingDirty = true; } void LLSettingsSky::setDensityMultiplier(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER] = val; setDirtyFlag(true); - mLightingDirty = true; } void LLSettingsSky::setDistanceMultiplier(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER] = val; setDirtyFlag(true); - mLightingDirty = true; } void LLSettingsSky::setHazeDensity(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY] = val; setDirtyFlag(true); - mLightingDirty = true; } void LLSettingsSky::setHazeHorizon(F32 val) { mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON] = val; setDirtyFlag(true); - mLightingDirty = true; } // Sunlight attenuation effect (hue and brightness) due to atmosphere @@ -1037,16 +1016,6 @@ LLColor4 LLSettingsSky::getTotalAmbient() const void LLSettingsSky::calculateLightSettings() const { - /* can't do this as it gets defeated during animation of env panel settings - if (!mLightingDirty) - { - return; - } - - calculateHeavenlyBodyPositions();*/ - - mLightingDirty = false; - // Initialize temp variables LLColor3 sunlight = getSunlightColor(); LLColor3 ambient = getAmbientColor(); @@ -1158,7 +1127,6 @@ LLColor3 LLSettingsSky::getAmbientColor() const void LLSettingsSky::setAmbientColor(const LLColor3 &val) { setValue(SETTING_AMBIENT, val); - mLightingDirty = true; } LLColor3 LLSettingsSky::getCloudColor() const @@ -1241,7 +1209,6 @@ F32 LLSettingsSky::getCloudShadow() const void LLSettingsSky::setCloudShadow(F32 val) { setValue(SETTING_CLOUD_SHADOW, val); - mLightingDirty = true; } F32 LLSettingsSky::getDomeOffset() const @@ -1265,7 +1232,6 @@ void LLSettingsSky::setGamma(F32 val) { mSettings[SETTING_GAMMA] = LLSD::Real(val); setDirtyFlag(true); - mLightingDirty = true; } LLColor3 LLSettingsSky::getGlow() const @@ -1276,7 +1242,6 @@ LLColor3 LLSettingsSky::getGlow() const void LLSettingsSky::setGlow(const LLColor3 &val) { setValue(SETTING_GLOW, val); - mLightingDirty = true; } F32 LLSettingsSky::getMaxY() const @@ -1297,7 +1262,6 @@ LLQuaternion LLSettingsSky::getMoonRotation() const void LLSettingsSky::setMoonRotation(const LLQuaternion &val) { setValue(SETTING_MOON_ROTATION, val); - mPositionsDirty = true; } LLUUID LLSettingsSky::getMoonTextureId() const @@ -1328,7 +1292,6 @@ LLColor3 LLSettingsSky::getSunlightColor() const void LLSettingsSky::setSunlightColor(const LLColor3 &val) { setValue(SETTING_SUNLIGHT_COLOR, val); - mLightingDirty = true; } LLQuaternion LLSettingsSky::getSunRotation() const @@ -1339,7 +1302,6 @@ LLQuaternion LLSettingsSky::getSunRotation() const void LLSettingsSky::setSunRotation(const LLQuaternion &val) { setValue(SETTING_SUN_ROTATION, val); - mPositionsDirty = true; } LLUUID LLSettingsSky::getSunTextureId() const diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e6783f6694..19b7cd47e9 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -105,7 +105,7 @@ public: virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE; - static LLSD defaults(); + static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f); F32 getPlanetRadius() const; F32 getSkyBottomRadius() const; @@ -247,9 +247,6 @@ protected: virtual void updateSettings() SETTINGS_OVERRIDE; private: - mutable bool mPositionsDirty; - mutable bool mLightingDirty; - static LLSD rayleighConfigDefault(); static LLSD absorptionConfigDefault(); static LLSD mieConfigDefault(); diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 16281e23cc..a1e4929055 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -87,10 +87,13 @@ LLSettingsWater::LLSettingsWater() : } //========================================================================= -LLSD LLSettingsWater::defaults() +LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position) { LLSD dfltsetting; + // give the normal scale offset some variability over track time... + F32 normal_scale_offset = (position * 0.5f) - 0.25f; + // Magic constants copied form defaults.xml dfltsetting[SETTING_BLUR_MULTIPILER] = LLSD::Real(0.04000f); dfltsetting[SETTING_FOG_COLOR] = LLColor3(0.0156f, 0.1490f, 0.2509f).getValue(); @@ -100,7 +103,7 @@ LLSD LLSettingsWater::defaults() dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999); dfltsetting[SETTING_TRANSPARENT_TEXTURE] = GetDefaultTransparentTextureAssetId(); dfltsetting[SETTING_NORMAL_MAP] = GetDefaultWaterNormalAssetId(); - dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f, 2.0f, 2.0f).getValue(); + dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f + normal_scale_offset, 2.0f + normal_scale_offset, 2.0f + normal_scale_offset).getValue(); dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f); dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f); dfltsetting[SETTING_WAVE1_DIR] = LLVector2(1.04999f, -0.42000f).getValue(); diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 9d006d492d..83d54da6a5 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -62,7 +62,7 @@ public: // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; - static LLSD defaults(); + static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f); //--------------------------------------------------------------------- F32 getBlurMultiplier() const -- cgit v1.2.3 From 91121d113d25af570ec64564dd10c21f0d5fcb69 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 21 Jun 2018 18:37:00 +0100 Subject: Merge server side bugfixes over. --- indra/llinventory/llsettingssky.cpp | 39 +++++++++++++++++++++-------------- indra/llinventory/llsettingswater.cpp | 15 ++++++++++---- 2 files changed, 34 insertions(+), 20 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 83499cc9fc..3f2d55d79d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -37,20 +37,21 @@ namespace { LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment"); +} - const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees - const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); - const LLVector3 DUE_EAST = LLVector3::x_axis; - - LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) - { - LLQuaternion quat; - quat.setEulerAngles(0.0f, -altitude, azimuth); - return quat; - } +static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees +static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); +static const LLVector3 DUE_EAST = LLVector3::x_axis; +static const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); +static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) +{ + LLQuaternion quat; + quat.setEulerAngles(0.0f, -altitude, azimuth); + return quat; } + //========================================================================= const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density"); @@ -389,14 +390,20 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) llassert(getSettingsType() == end->getSettingsType()); LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); - LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + if (other) + { + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + replaceSettings(blenddata); + mNextSunTextureId = other->getSunTextureId(); + mNextMoonTextureId = other->getMoonTextureId(); + mNextCloudTextureId = other->getCloudNoiseTextureId(); + } + else + { + LL_WARNS("SETTINGS") << "Could not cast end settings to sky. No blend performed." << LL_ENDL; + } - replaceSettings(blenddata); - setBlendFactor(blendf); - mNextSunTextureId = other->getSunTextureId(); - mNextMoonTextureId = other->getMoonTextureId(); - mNextCloudTextureId = other->getCloudNoiseTextureId(); } LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index a1e4929055..8eb65331ad 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -173,12 +173,19 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { LLSettingsWater::ptr_t other = PTR_NAMESPACE::static_pointer_cast(end); - LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); - - replaceSettings(blenddata); + if (other) + { + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); + replaceSettings(blenddata); + mNextNormalMapID = other->getNormalMapID(); + mNextTransparentTextureID = other->getTransparentTextureID(); + } + else + { + LL_WARNS("SETTINGS") << "Cound not cast end settings to water. No blend performed." << LL_ENDL; + } setBlendFactor(blendf); mNextNormalMapID = other->getNormalMapID(); - mNextTransparentTextureID = other->getTransparentTextureID(); } LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const -- cgit v1.2.3 From 52b946fd09196989e34afd7226a82060c4f8d831 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 21 Jun 2018 21:25:15 +0100 Subject: Fix double-def of IMG_BLOOM1 from pulling over server change not needed in viewer code. Make viewer code use LLSettingsSky static func to hide indraconstants dep. --- indra/llinventory/llsettingssky.cpp | 9 +++++---- indra/llinventory/llsettingssky.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 48ca79282e..6f1520bdfa 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -33,13 +33,9 @@ #include "v3colorutil.h" //========================================================================= -namespace -{ - static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); static const LLVector3 DUE_EAST = LLVector3::x_axis; -static const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { @@ -1083,6 +1079,11 @@ LLUUID LLSettingsSky::GetDefaultCloudNoiseTextureId() return DEFAULT_CLOUD_ID; } +LLUUID LLSettingsSky::GetDefaultBloomTextureId() +{ + return IMG_BLOOM1; +} + F32 LLSettingsSky::getPlanetRadius() const { return mSettings[SETTING_PLANET_RADIUS].asReal(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 19b7cd47e9..e7b4678f7f 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -234,6 +234,7 @@ public: static LLUUID GetDefaultSunTextureId(); static LLUUID GetDefaultMoonTextureId(); static LLUUID GetDefaultCloudNoiseTextureId(); + static LLUUID GetDefaultBloomTextureId(); protected: static const std::string SETTING_LEGACY_EAST_ANGLE; -- cgit v1.2.3 From a02b3500b9979c10336eb13674279b3c07367445 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 22 Jun 2018 00:41:19 +0100 Subject: Make LLSettingsFoo::defaults() funcs only calculate the invariant values once (use static trick ala the validations). Fix conversion of legacy settings w/ non-zero east angles to account for those values being CW radian angles. --- indra/llinventory/llsettingsdaycycle.cpp | 67 ++++++++++--------- indra/llinventory/llsettingssky.cpp | 108 +++++++++++++++++-------------- indra/llinventory/llsettingswater.cpp | 39 +++++------ 3 files changed, 113 insertions(+), 101 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 7dc415e480..2c8bddee93 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -285,52 +285,51 @@ bool LLSettingsDay::initialize() //========================================================================= LLSD LLSettingsDay::defaults() { - LLSD dfltsetting; + static LLSD dfltsetting; - dfltsetting[SETTING_NAME] = "_default_"; - - LLSD frames(LLSD::emptyMap()); - LLSD waterTrack; - LLSD skyTrack; - - - const U32 FRAME_COUNT = 8; - const F32 FRAME_STEP = 1.0f / F32(FRAME_COUNT); - F32 time = 0.0f; - for (U32 i = 0; i < FRAME_COUNT; i++) + if (dfltsetting.size() == 0) { - std::string name("_default_"); - name += ('a' + i); - - std::string water_frame_name("water:"); - std::string sky_frame_name("sky:"); + dfltsetting[SETTING_NAME] = "_default_"; + dfltsetting[SETTING_TYPE] = "daycycle"; - water_frame_name += name; - sky_frame_name += name; + LLSD frames(LLSD::emptyMap()); + LLSD waterTrack; + LLSD skyTrack; - waterTrack[SETTING_KEYKFRAME] = time; - waterTrack[SETTING_KEYNAME] = water_frame_name; + + const U32 FRAME_COUNT = 8; + const F32 FRAME_STEP = 1.0f / F32(FRAME_COUNT); + F32 time = 0.0f; + for (U32 i = 0; i < FRAME_COUNT; i++) + { + std::string name("_default_"); + name += ('a' + i); - skyTrack[SETTING_KEYKFRAME] = time; - skyTrack[SETTING_KEYNAME] = sky_frame_name; + std::string water_frame_name("water:"); + std::string sky_frame_name("sky:"); - frames[water_frame_name] = LLSettingsWater::defaults(time); - frames[sky_frame_name] = LLSettingsSky::defaults(time); + water_frame_name += name; + sky_frame_name += name; - time += FRAME_STEP; - } + waterTrack[SETTING_KEYKFRAME] = time; + waterTrack[SETTING_KEYNAME] = water_frame_name; - LLSD tracks; - tracks.append(LLSDArray(waterTrack)); - tracks.append(LLSDArray(skyTrack)); + skyTrack[SETTING_KEYKFRAME] = time; + skyTrack[SETTING_KEYNAME] = sky_frame_name; - dfltsetting[SETTING_TRACKS] = tracks; + frames[water_frame_name] = LLSettingsWater::defaults(time); + frames[sky_frame_name] = LLSettingsSky::defaults(time); - + time += FRAME_STEP; + } - dfltsetting[SETTING_FRAMES] = frames; + LLSD tracks; + tracks.append(LLSDArray(waterTrack)); + tracks.append(LLSDArray(skyTrack)); - dfltsetting[SETTING_TYPE] = "daycycle"; + dfltsetting[SETTING_TRACKS] = tracks; + dfltsetting[SETTING_FRAMES] = frames; + } return dfltsetting; } diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 6f1520bdfa..bf0115b80b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -40,7 +40,7 @@ static const LLVector3 DUE_EAST = LLVector3::x_axis; static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { LLQuaternion quat; - quat.setEulerAngles(0.0f, -altitude, azimuth); + quat.setEulerAngles(0.0f, altitude, azimuth); return quat; } @@ -585,53 +585,57 @@ LLSD LLSettingsSky::mieConfigDefault() LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) { - LLSD dfltsetting; - LLQuaternion sunquat; - LLQuaternion moonquat; - - F32 azimuth = (F_PI * position) + (80.0f * DEG_TO_RAD); - F32 altitude = (F_PI * position); - - // give the sun and moon slightly different tracks through the sky - // instead of positioning them at opposite poles from each other... - sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); - moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); - - // Magic constants copied form dfltsetting.xml - dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); - dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); - dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); - dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); - dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); - dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); + static LLSD dfltsetting; + + if (dfltsetting.size() == 0) + { + LLQuaternion sunquat; + LLQuaternion moonquat; + + F32 azimuth = (F_PI * position) + (80.0f * DEG_TO_RAD); + F32 altitude = (F_PI * position); + + // give the sun and moon slightly different tracks through the sky + // instead of positioning them at opposite poles from each other... + sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); + moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); + + // Magic constants copied form dfltsetting.xml + dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); + dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); + dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); + dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); - dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); - dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); - dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); - dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); + dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); + dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); + dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); + dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue(); - dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); - dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); - dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); - dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); - dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); - - dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; - dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); - dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); - dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); - - dfltsetting[SETTING_TYPE] = "sky"; - - // defaults are for earth... - dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; - dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; - - dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); - dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); - dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); + dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); + dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); + dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); + + dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; + dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); + dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); + dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); + + dfltsetting[SETTING_TYPE] = "sky"; + + // defaults are for earth... + dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; + dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); + dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); + dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); + } return dfltsetting; } @@ -769,11 +773,17 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) { // convert the east and sun angles into a quaternion. - F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); - F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); + F32 two_pi = F_PI * 2.0f; + + // get counter-clockwise radian angle from clockwise legacy WL east angle... + F32 azimuth = two_pi - legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); + F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); + LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); - LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude); + + // original WL moon dir was diametrically opposed to the sun dir + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); //LLVector3 sundir = DUE_EAST * sunquat; //LLVector3 moondir = DUE_EAST * moonquat; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 8eb65331ad..3e0c6dcb82 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -89,27 +89,30 @@ LLSettingsWater::LLSettingsWater() : //========================================================================= LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position) { - LLSD dfltsetting; + static LLSD dfltsetting; - // give the normal scale offset some variability over track time... - F32 normal_scale_offset = (position * 0.5f) - 0.25f; + if (dfltsetting.size() == 0) + { + // give the normal scale offset some variability over track time... + F32 normal_scale_offset = (position * 0.5f) - 0.25f; - // Magic constants copied form defaults.xml - dfltsetting[SETTING_BLUR_MULTIPILER] = LLSD::Real(0.04000f); - dfltsetting[SETTING_FOG_COLOR] = LLColor3(0.0156f, 0.1490f, 0.2509f).getValue(); - dfltsetting[SETTING_FOG_DENSITY] = LLSD::Real(2.0f); - dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f); - dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f); - dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999); - dfltsetting[SETTING_TRANSPARENT_TEXTURE] = GetDefaultTransparentTextureAssetId(); - dfltsetting[SETTING_NORMAL_MAP] = GetDefaultWaterNormalAssetId(); - dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f + normal_scale_offset, 2.0f + normal_scale_offset, 2.0f + normal_scale_offset).getValue(); - dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f); - dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f); - dfltsetting[SETTING_WAVE1_DIR] = LLVector2(1.04999f, -0.42000f).getValue(); - dfltsetting[SETTING_WAVE2_DIR] = LLVector2(1.10999f, -1.16000f).getValue(); + // Magic constants copied form defaults.xml + dfltsetting[SETTING_BLUR_MULTIPILER] = LLSD::Real(0.04000f); + dfltsetting[SETTING_FOG_COLOR] = LLColor3(0.0156f, 0.1490f, 0.2509f).getValue(); + dfltsetting[SETTING_FOG_DENSITY] = LLSD::Real(2.0f); + dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f); + dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f); + dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999); + dfltsetting[SETTING_TRANSPARENT_TEXTURE] = GetDefaultTransparentTextureAssetId(); + dfltsetting[SETTING_NORMAL_MAP] = GetDefaultWaterNormalAssetId(); + dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f + normal_scale_offset, 2.0f + normal_scale_offset, 2.0f + normal_scale_offset).getValue(); + dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f); + dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f); + dfltsetting[SETTING_WAVE1_DIR] = LLVector2(1.04999f, -0.42000f).getValue(); + dfltsetting[SETTING_WAVE2_DIR] = LLVector2(1.10999f, -1.16000f).getValue(); - dfltsetting[SETTING_TYPE] = "water"; + dfltsetting[SETTING_TYPE] = "water"; + } return dfltsetting; } -- cgit v1.2.3 From 02ffb06463e8b2ae3654c0de35d7f0fbab72025c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 22 Jun 2018 01:00:23 +0100 Subject: Fix double blend and warnings reported as errors. --- indra/llinventory/llsettingsbase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7bcafabb8a..f282f0c7dc 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -298,8 +298,9 @@ bool LLSettingsBase::validate() } if (result["warnings"].size() > 0) { - LL_WARNS("SETTINGS") << "Validation warnings: " << result["errors"] << LL_ENDL; + LL_WARNS("SETTINGS") << "Validation warnings: " << result["warnings"] << LL_ENDL; } + LL_WARNS("SETTINGS") << "Validation success is " << result["success"] << LL_ENDL; return result["success"].asBoolean(); } @@ -593,7 +594,6 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ { LL_WARNS("SETTINGS") << "No target for settings blender." << LL_ENDL; } - mTarget->blend(mFinal, blendf); return blendf; } -- cgit v1.2.3 From 8b2d5cb6867657e98e1fd1c9e4f209e952c59474 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 25 Jun 2018 19:06:48 +0100 Subject: Better method for deriving sun/moon quaternions from east/sun angle defs in legacy sky settings XML. Avoid using static const DUE_EAST due to CRT init order issues w/ GCC. --- indra/llinventory/llsettingssky.cpp | 46 +++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index bf0115b80b..b1868fb50e 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -35,12 +35,29 @@ //========================================================================= static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); -static const LLVector3 DUE_EAST = LLVector3::x_axis; static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { + + F32 sinTheta = sin(azimuth); + F32 cosTheta = cos(azimuth); + F32 sinPhi = sin(altitude); + F32 cosPhi = cos(altitude); + + LLVector3 dir; + // +x right, +z up, +y at... + dir.mV[0] = cosTheta * cosPhi; + dir.mV[1] = sinTheta * cosPhi; + dir.mV[2] = sinPhi; + + LLVector3 axis = LLVector3::x_axis % dir; + axis.normalize(); + + F32 angle = acos(LLVector3::x_axis * dir); + LLQuaternion quat; - quat.setEulerAngles(0.0f, altitude, azimuth); + quat.setAngleAxis(angle, axis); + return quat; } @@ -772,21 +789,15 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) } if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) - { // convert the east and sun angles into a quaternion. - F32 two_pi = F_PI * 2.0f; - + { // get counter-clockwise radian angle from clockwise legacy WL east angle... - F32 azimuth = two_pi - legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); - - F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); + F32 azimuth = -legacy[SETTING_LEGACY_EAST_ANGLE].asReal(); + F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); // original WL moon dir was diametrically opposed to the sun dir - LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); - - //LLVector3 sundir = DUE_EAST * sunquat; - //LLVector3 moondir = DUE_EAST * moonquat; + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude + F_PI); newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); @@ -826,15 +837,20 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const LLQuaternion sunq = getSunRotation(); LLQuaternion moonq = getMoonRotation(); - mSunDirection = DUE_EAST * sunq; - mMoonDirection = DUE_EAST * moonq; + mSunDirection = LLVector3::x_axis * sunq; + mMoonDirection = LLVector3::x_axis * moonq; mSunDirection.normalize(); mMoonDirection.normalize(); - //LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; + //LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; //LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; + if (mSunDirection.lengthSquared() < 0.01f) + LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; + if (mMoonDirection.lengthSquared() < 0.01f) + LL_WARNS("SETTINGS") << "Zero length moon direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; + llassert(mSunDirection.lengthSquared() > 0.01f); llassert(mMoonDirection.lengthSquared() > 0.01f); } -- cgit v1.2.3 From 8a2532ee55fb1c1bf78318e954bd25a0853cc2e3 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 25 Jun 2018 19:22:04 +0100 Subject: Clean up spaces vs tabs to match sim side code. --- indra/llinventory/llsettingssky.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b1868fb50e..ad863b5671 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -38,15 +38,14 @@ static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_T static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) { - - F32 sinTheta = sin(azimuth); - F32 cosTheta = cos(azimuth); - F32 sinPhi = sin(altitude); - F32 cosPhi = cos(altitude); + F32 sinTheta = sin(azimuth); + F32 cosTheta = cos(azimuth); + F32 sinPhi = sin(altitude); + F32 cosPhi = cos(altitude); LLVector3 dir; // +x right, +z up, +y at... - dir.mV[0] = cosTheta * cosPhi; + dir.mV[0] = cosTheta * cosPhi; dir.mV[1] = sinTheta * cosPhi; dir.mV[2] = sinPhi; -- cgit v1.2.3 From d25f80181463d373c317835a219903bcdf9b91c8 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 25 Jun 2018 14:44:09 -0700 Subject: Fix cloud scroll adjustment in the editor, pause clouds method, set sun disk UUID to null. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index bf0115b80b..250af5a392 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -622,7 +622,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); - dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); + dfltsetting[SETTING_SUN_TEXTUREID] = LLUUID::null; // GetDefaultSunTextureId(); dfltsetting[SETTING_TYPE] = "sky"; -- cgit v1.2.3 From 7762829031236422dcb569017b7095424957c954 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 25 Jun 2018 14:52:08 -0700 Subject: Pair of LOG_CLASS macros (from simulator) --- indra/llinventory/llsettingsbase.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 7f88227a6d..caae2dcd23 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -300,6 +300,7 @@ private: class LLSettingsBlender : public PTR_NAMESPACE::enable_shared_from_this { + LOG_CLASS(LLSettingsBlender); public: typedef PTR_NAMESPACE::shared_ptr ptr_t; typedef boost::signals2::signal finish_signal_t; @@ -380,6 +381,7 @@ protected: class LLSettingsBlenderTimeDelta : public LLSettingsBlender { + LOG_CLASS(LLSettingsBlenderTimeDelta); public: LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target, const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::Seconds& blend_span) : -- cgit v1.2.3 From 5c2f49b86511f88de520f4297f20e6382139a927 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 27 Jun 2018 22:00:50 +0100 Subject: Make distinct ALM moon shader, tweak mix factor for day vs night moon shading, and fix transposed name of daycycle func. --- indra/llinventory/llsettingsdaycycle.cpp | 5 ++--- indra/llinventory/llsettingsdaycycle.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 2c8bddee93..2534d5f0f1 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -661,7 +661,7 @@ LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(const LLSettingsBase: return LLSettingsBase::ptr_t(); } -LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyfarme(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const +LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyframe(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const { if ((track < 0) || (track >= TRACK_MAX)) { @@ -683,8 +683,7 @@ LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyfarme(c F32 dist = get_wrapping_distance(startframe, (*it).first); - LL_WARNS("LAPRAS") << "[" << startframe << " ... " << keyframe << " -> " << (*it).first << "@" << dist << LL_ENDL; - + LL_DEBUGS("LAPRAS") << "[" << startframe << " ... " << keyframe << " -> " << (*it).first << "@" << dist << LL_ENDL; if (dist <= (fudge * 2.0f)) return (*it); diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index be888f42cc..c719b593c1 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -100,7 +100,7 @@ public: LLSettingsSkyPtr_t getSkyAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const; void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::TrackPosition& keyframe, S32 track); LLSettingsBase::ptr_t getSettingsAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const; - CycleTrack_t::value_type getSettingsNearKeyfarme(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const; + CycleTrack_t::value_type getSettingsNearKeyframe(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const; void clearTrack(S32 track); //--------------------------------------------------------------------- -- cgit v1.2.3 From 0ff65651cc219eef959c5e961663de2a07595e5a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 27 Jun 2018 23:52:02 +0100 Subject: MAINT-8011 make newly created Sky, Water, etc create a system folder with proper icon Add entries to strings.xml for all langs for the "settings" string. --- indra/llinventory/llfoldertype.cpp | 2 ++ indra/llinventory/llfoldertype.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp index 2c8c82a62b..067b22ee27 100644 --- a/indra/llinventory/llfoldertype.cpp +++ b/indra/llinventory/llfoldertype.cpp @@ -100,6 +100,8 @@ LLFolderDictionary::LLFolderDictionary() addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new FolderEntry("stock", FALSE)); addEntry(LLFolderType::FT_MARKETPLACE_VERSION, new FolderEntry("version", FALSE)); + addEntry(LLFolderType::FT_SETTINGS, new FolderEntry("settings", FALSE)); + addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); }; diff --git a/indra/llinventory/llfoldertype.h b/indra/llinventory/llfoldertype.h index 515bb05a3f..85b86f9ce5 100644 --- a/indra/llinventory/llfoldertype.h +++ b/indra/llinventory/llfoldertype.h @@ -91,6 +91,8 @@ public: FT_MARKETPLACE_STOCK = 54, FT_MARKETPLACE_VERSION = 55, // Note: We actually *never* create folders with that type. This is used for icon override only. + FT_SETTINGS = 56, + FT_COUNT, FT_NONE = -1 -- cgit v1.2.3 From 19069ce25c30f6744310e015dbf767954efbd8ae Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 28 Jun 2018 17:06:49 -0700 Subject: Creating settings objects in the correct folders. Correctly check if clouds paused. --- indra/llinventory/llfoldertype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp index 067b22ee27..7241b3c0c2 100644 --- a/indra/llinventory/llfoldertype.cpp +++ b/indra/llinventory/llfoldertype.cpp @@ -100,7 +100,7 @@ LLFolderDictionary::LLFolderDictionary() addEntry(LLFolderType::FT_MARKETPLACE_STOCK, new FolderEntry("stock", FALSE)); addEntry(LLFolderType::FT_MARKETPLACE_VERSION, new FolderEntry("version", FALSE)); - addEntry(LLFolderType::FT_SETTINGS, new FolderEntry("settings", FALSE)); + addEntry(LLFolderType::FT_SETTINGS, new FolderEntry("settings", TRUE)); addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE)); }; -- cgit v1.2.3 From 79570e276108c59f3384d49318835fdce35ce213 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 29 Jun 2018 10:44:08 -0700 Subject: Fix moon rotation. --- indra/llinventory/llsettingssky.cpp | 46 ++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b797c1b715..91d2e9b23d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -36,28 +36,32 @@ static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); -static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) -{ - F32 sinTheta = sin(azimuth); - F32 cosTheta = cos(azimuth); - F32 sinPhi = sin(altitude); - F32 cosPhi = cos(altitude); +namespace { + LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) + { + F32 sinTheta = sin(azimuth); + F32 cosTheta = cos(azimuth); + F32 sinPhi = sin(altitude); + F32 cosPhi = cos(altitude); - LLVector3 dir; - // +x right, +z up, +y at... - dir.mV[0] = cosTheta * cosPhi; - dir.mV[1] = sinTheta * cosPhi; - dir.mV[2] = sinPhi; + LLVector3 dir; + // +x right, +z up, +y at... + dir.mV[0] = cosTheta * cosPhi; + dir.mV[1] = sinTheta * cosPhi; + dir.mV[2] = sinPhi; - LLVector3 axis = LLVector3::x_axis % dir; - axis.normalize(); + LLVector3 axis = LLVector3::x_axis % dir; + axis.normalize(); + if (mirror_axis) + axis *= -1; - F32 angle = acos(LLVector3::x_axis * dir); + F32 angle = acos(LLVector3::x_axis * dir); - LLQuaternion quat; - quat.setAngleAxis(angle, axis); + LLQuaternion quat; + quat.setAngleAxis(angle, axis); - return quat; + return quat; + } } static LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment"); @@ -613,8 +617,9 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) // give the sun and moon slightly different tracks through the sky // instead of positioning them at opposite poles from each other... + // but keep them on opposite sides of the sky. sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth); - moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f)); + moonquat = convert_azimuth_and_altitude_to_quat(-(altitude + (F_PI * 0.125f)), azimuth + (F_PI * 1.125f)); // Magic constants copied form dfltsetting.xml dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue(); @@ -794,11 +799,10 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal(); LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); - // original WL moon dir was diametrically opposed to the sun dir - LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude + F_PI); + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); - newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); + newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); } -- cgit v1.2.3 From d5c465b4ab263e568761f6197534f7ddcda8a5ee Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 29 Jun 2018 20:15:10 +0100 Subject: MAINT-8817 remove automatic update of inv_proj matrix so sunLightF which expects it not to match the projection mat works again Fix misspellinging in missing settings asset notification string Fix moon quat conversion to get proper directional rotation Add early out so attempting to set parcel env settings doesn't crash --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index b797c1b715..375bd7cbce 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -796,7 +796,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude); // original WL moon dir was diametrically opposed to the sun dir - LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude + F_PI); + LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); -- cgit v1.2.3 From 96e8e670e104d852b1a925976f3d935448eba103 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 29 Jun 2018 12:59:53 -0700 Subject: Enable settings inventory filter checkbox. Fix day cycle editor selection on open. --- indra/llinventory/llsettingssky.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 91d2e9b23d..475b5fcf79 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -52,8 +52,6 @@ namespace { LLVector3 axis = LLVector3::x_axis % dir; axis.normalize(); - if (mirror_axis) - axis *= -1; F32 angle = acos(LLVector3::x_axis * dir); -- cgit v1.2.3 From 9717589a55c6ae0aac5b09f1146e489df2e45c5e Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 2 Jul 2018 23:15:38 +0100 Subject: MAINT-8837 fix legacy haze validation to make all params optional --- indra/llinventory/llsettingssky.cpp | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index fc783f99e0..0b6ad66a0c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -140,21 +140,21 @@ LLSettingsSky::validation_list_t legacyHazeValidationList() static LLSettingsBase::validation_list_t legacyHazeValidation; if (legacyHazeValidation.empty()) { - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_DENSITY, true, LLSD::TypeArray, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_DENSITY, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_HORIZON, true, LLSD::TypeArray, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_HORIZON, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, true, LLSD::TypeReal, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, true, LLSD::TypeReal, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, true, LLSD::TypeReal, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); - legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, true, LLSD::TypeReal, + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); } return legacyHazeValidation; @@ -165,19 +165,19 @@ LLSettingsSky::validation_list_t rayleighValidationList() static LLSettingsBase::validation_list_t rayleighValidation; if (rayleighValidation.empty()) { - rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); } return rayleighValidation; @@ -188,19 +188,19 @@ LLSettingsSky::validation_list_t absorptionValidationList() static LLSettingsBase::validation_list_t absorptionValidation; if (absorptionValidation.empty()) { - absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); } return absorptionValidation; @@ -211,22 +211,22 @@ LLSettingsSky::validation_list_t mieValidationList() static LLSettingsBase::validation_list_t mieValidation; if (mieValidation.empty()) { - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f))))); - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f))))); - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); - mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, true, LLSD::TypeReal, + mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); } return mieValidation; -- cgit v1.2.3 From 8969b114357d189e1bf39024762698eeddddfc78 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 3 Jul 2018 16:37:32 +0100 Subject: MAINT-8838 render a sun disc if the texture(s) are provided by WL settings (default is no sun disc and just haze) Refactor sky texture optimization to retain building the cubemap used by shiny. --- indra/llinventory/llsettingsdaycycle.cpp | 2 +- indra/llinventory/llsettingssky.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 2534d5f0f1..5e6d5597e4 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -683,7 +683,7 @@ LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyframe(c F32 dist = get_wrapping_distance(startframe, (*it).first); - LL_DEBUGS("LAPRAS") << "[" << startframe << " ... " << keyframe << " -> " << (*it).first << "@" << dist << LL_ENDL; + //LL_DEBUGS("LAPRAS") << "[" << startframe << " ... " << keyframe << " -> " << (*it).first << "@" << dist << LL_ENDL; if (dist <= (fudge * 2.0f)) return (*it); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0b6ad66a0c..d73ae5721a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -640,7 +640,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); - dfltsetting[SETTING_SUN_TEXTUREID] = LLUUID::null; // GetDefaultSunTextureId(); + dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); dfltsetting[SETTING_TYPE] = "sky"; @@ -1092,7 +1092,8 @@ LLUUID LLSettingsSky::GetDefaultAssetId() LLUUID LLSettingsSky::GetDefaultSunTextureId() { - return DEFAULT_SUN_ID; + //return DEFAULT_SUN_ID; + return LLUUID::null; } LLUUID LLSettingsSky::GetDefaultMoonTextureId() -- cgit v1.2.3 From a4137d72ebc9f49dfd8bd124b255da0dfbc4ba92 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 3 Jul 2018 14:18:24 -0700 Subject: MAINT-8821: New "My Environments" floater. First pass. --- indra/llinventory/llsettingsbase.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index caae2dcd23..6c3b9e23ee 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -242,6 +242,7 @@ public: inline void setAssetId(LLUUID value) { // note that this skips setLLSD + LL_WARNS("LAPRAS") << "Settings asset id set to:{" << value << "}" << LL_ENDL; mSettings[SETTING_ASSETID] = value; } -- cgit v1.2.3 From a90e61b798711306496c2ed7aa5cce6d096ea466 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 10 Jul 2018 19:08:14 +0100 Subject: Support blending current/next bloom textures in deferred star rendering. --- indra/llinventory/llsettingssky.cpp | 15 ++++++++++++--- indra/llinventory/llsettingssky.h | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index d73ae5721a..2f5216eba9 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -382,7 +382,8 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId() + mNextCloudTextureId(), + mNextBloomTextureId() { } @@ -390,7 +391,8 @@ LLSettingsSky::LLSettingsSky(): LLSettingsBase(), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId() + mNextCloudTextureId(), + mNextBloomTextureId() { } @@ -412,6 +414,7 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); mNextCloudTextureId = other->getCloudNoiseTextureId(); + mNextBloomTextureId = other->getBloomTextureId(); } else { @@ -637,7 +640,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); - dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1; + dfltsetting[SETTING_BLOOM_TEXTUREID] = GetDefaultBloomTextureId(); dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); @@ -1366,3 +1369,9 @@ LLUUID LLSettingsSky::getNextCloudNoiseTextureId() const { return mNextCloudTextureId; } + +LLUUID LLSettingsSky::getNextBloomTextureId() const +{ + return mNextBloomTextureId; +} + diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e7b4678f7f..00b7c5b37b 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -183,6 +183,7 @@ public: LLUUID getNextSunTextureId() const; LLUUID getNextMoonTextureId() const; LLUUID getNextCloudNoiseTextureId() const; + LLUUID getNextBloomTextureId() const; //===================================================================== virtual void loadTextures() { }; @@ -272,6 +273,7 @@ private: LLUUID mNextSunTextureId; LLUUID mNextMoonTextureId; LLUUID mNextCloudTextureId; + LLUUID mNextBloomTextureId; typedef std::map mapNameToUniformId_t; -- cgit v1.2.3 From ca5d5be4fb51fa1ee7ffda24a0aa58c71facd7dd Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 11 Jul 2018 16:46:14 -0700 Subject: Minor change from the simulator to throttle the minimum blend in a time based blend. --- indra/llinventory/llsettingsbase.cpp | 10 +++++++++- indra/llinventory/llsettingsbase.h | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index f282f0c7dc..8bcf8a4973 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -607,6 +607,8 @@ void LLSettingsBlender::triggerComplete() } //------------------------------------------------------------------------- +const LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::MIN_BLEND_DELTA(0.001); + LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const { return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen); @@ -629,9 +631,15 @@ void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& t return; } + LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); mTimeDeltaPassed = LLSettingsBase::Seconds(0.0); - LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); + if (fabs(mLastBlendF - blendf) < mBlendFMinDelta) + { + return; + } + + mLastBlendF = blendf; update(blendf); } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 6c3b9e23ee..a74579e7a6 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -57,6 +57,8 @@ class LLSettingsBase : friend std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings); +protected: + LOG_CLASS(LLSettingsBase); public: typedef F64Seconds Seconds; typedef F64 BlendFactor; @@ -384,6 +386,8 @@ class LLSettingsBlenderTimeDelta : public LLSettingsBlender { LOG_CLASS(LLSettingsBlenderTimeDelta); public: + static const LLSettingsBase::BlendFactor MIN_BLEND_DELTA; + LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target, const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::Seconds& blend_span) : LLSettingsBlender(target, initsetting, endsetting), @@ -392,7 +396,9 @@ public: mTimeSpent(0.0f), mTimeDeltaThreshold(0.0f), mTimeDeltaPassed(0.0f), - mIgnoreTimeDelta(false) + mIgnoreTimeDelta(false), + mBlendFMinDelta(MIN_BLEND_DELTA), + mLastBlendF(-1.0f) { mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; @@ -411,6 +417,7 @@ public: mLastUpdate = mTimeStart; mTimeSpent = LLSettingsBase::Seconds(0.0f); mTimeDeltaPassed = LLSettingsBase::Seconds(0.0f); + mLastBlendF = LLSettingsBase::BlendFactor(-1.0f); } virtual void applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE; @@ -439,6 +446,8 @@ protected: LLSettingsBase::Seconds mTimeDeltaThreshold; LLSettingsBase::Seconds mTimeDeltaPassed; bool mIgnoreTimeDelta; + LLSettingsBase::BlendFactor mBlendFMinDelta; + LLSettingsBase::BlendFactor mLastBlendF; }; -- cgit v1.2.3 From 939174416453a46a4a415f37ae642e5508c05787 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 16 Jul 2018 16:49:49 -0700 Subject: Add default and wellknown asset ids. --- indra/llinventory/llsettingsdaycycle.cpp | 3 +-- indra/llinventory/llsettingsdaycycle.h | 2 ++ indra/llinventory/llsettingssky.cpp | 4 ++-- indra/llinventory/llsettingssky.h | 2 ++ indra/llinventory/llsettingswater.cpp | 4 ++-- indra/llinventory/llsettingswater.h | 2 ++ 6 files changed, 11 insertions(+), 6 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 5e6d5597e4..ab01a585c6 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -118,8 +118,7 @@ const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water const S32 LLSettingsDay::FRAME_MAX(56); -// *LAPRAS* Change when Agni -static const LLUUID DEFAULT_ASSET_ID("94d296c2-6e05-963c-6b62-671199121dbb"); +const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("283a26a3-b147-47b7-8057-cfff0302ec0e"); //========================================================================= LLSettingsDay::LLSettingsDay(const LLSD &data) : diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index c719b593c1..e2f095aa74 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -63,6 +63,8 @@ public: static const S32 TRACK_MAX; static const S32 FRAME_MAX; + static const LLUUID DEFAULT_ASSET_ID; + typedef std::map CycleTrack_t; typedef std::vector CycleList_t; typedef PTR_NAMESPACE::shared_ptr ptr_t; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 2f5216eba9..4451bd753b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -121,11 +121,11 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_s const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); -// *LAPRAS* Change when Agni! +const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("ff64f04e-097f-40bc-9063-d8d48c308739"); + static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); -static const LLUUID DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 00b7c5b37b..19a5656644 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -88,6 +88,8 @@ public: static const std::string SETTING_LEGACY_HAZE; + static const LLUUID DEFAULT_ASSET_ID; + typedef PTR_NAMESPACE::shared_ptr ptr_t; //--------------------------------------------------------------------- diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 3e0c6dcb82..f0d63bf033 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -68,8 +68,8 @@ const std::string LLSettingsWater::SETTING_LEGACY_SCALE_BELOW("scaleBelow"); const std::string LLSettingsWater::SETTING_LEGACY_WAVE1_DIR("wave1Dir"); const std::string LLSettingsWater::SETTING_LEGACY_WAVE2_DIR("wave2Dir"); -// *LAPRAS* Change when Agni -static const LLUUID DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661"); +const LLUUID LLSettingsWater::DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661"); + static const LLUUID DEFAULT_TRANSPARENT_WATER_TEXTURE("2bfd3884-7e27-69b9-ba3a-3e673f680004"); static const LLUUID DEFAULT_OPAQUE_WATER_TEXTURE("43c32285-d658-1793-c123-bf86315de055"); diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 83d54da6a5..b525912898 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -47,6 +47,8 @@ public: static const std::string SETTING_WAVE1_DIR; static const std::string SETTING_WAVE2_DIR; + static const LLUUID DEFAULT_ASSET_ID; + typedef PTR_NAMESPACE::shared_ptr ptr_t; //--------------------------------------------------------------------- -- cgit v1.2.3 From d6ede8e81cad497a6cd8482dfb48c99bdf5c258a Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 30 Jul 2018 15:54:36 -0700 Subject: MAINT-8904: Creating new setting in inventory now causes simulator to assign default asset ID to inventory item. --- indra/llinventory/llinventorysettings.cpp | 8 +++++++- indra/llinventory/llinventorysettings.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventorysettings.cpp b/indra/llinventory/llinventorysettings.cpp index 8887c23a6c..fdad50e8d4 100644 --- a/indra/llinventory/llinventorysettings.cpp +++ b/indra/llinventory/llinventorysettings.cpp @@ -89,7 +89,6 @@ LLSettingsType::type_e LLSettingsType::fromInventoryFlags(U32 flags) return (LLSettingsType::type_e)(flags & LLInventoryItemFlags::II_FLAGS_SUBTYPE_MASK); } - LLInventoryType::EIconName LLSettingsType::getIconName(LLSettingsType::type_e type) { const SettingsEntry *entry = LLSettingsDictionary::instance().lookup(type); @@ -98,6 +97,13 @@ LLInventoryType::EIconName LLSettingsType::getIconName(LLSettingsType::type_e ty return entry->mIconName; } +std::string LLSettingsType::getDefaultName(LLSettingsType::type_e type) +{ + const SettingsEntry *entry = LLSettingsDictionary::instance().lookup(type); + if (!entry) + return getDefaultName(ST_INVALID); + return entry->mDefaultNewName; +} void LLSettingsType::initClass(LLTranslationBridge::ptr_t &trans) { diff --git a/indra/llinventory/llinventorysettings.h b/indra/llinventory/llinventorysettings.h index fb08190ea9..906540689c 100644 --- a/indra/llinventory/llinventorysettings.h +++ b/indra/llinventory/llinventorysettings.h @@ -46,6 +46,7 @@ public: static type_e fromInventoryFlags(U32 flags); static LLInventoryType::EIconName getIconName(type_e type); + static std::string getDefaultName(type_e type); static void initClass(LLTranslationBridge::ptr_t &trans); static void cleanupClass(); -- cgit v1.2.3 From 51abc168c03f80d63c85d4bb48624f440b585390 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 3 Aug 2018 21:01:43 +0300 Subject: MAINT-8902 fix encroaching 'legacy' issues --- indra/llinventory/llsettingsdaycycle.cpp | 106 ++++++++++++++++++++++++++++++- indra/llinventory/llsettingsdaycycle.h | 4 +- 2 files changed, 108 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index ff9614fb10..320e090bfd 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -118,8 +118,12 @@ const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water const S32 LLSettingsDay::FRAME_MAX(56); +const F32 LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR(0.02501f); + const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("283a26a3-b147-47b7-8057-cfff0302ec0e"); +// Minimum value to prevent multislider in edit floaters from eating up frames that 'encroach' on one another's space +static const F32 DEFAULT_MULTISLIDER_INCREMENT(0.005f); //========================================================================= LLSettingsDay::LLSettingsDay(const LLSD &data) : LLSettingsBase(data), @@ -185,7 +189,7 @@ LLSD LLSettingsDay::getSettings() const return settings; } -bool LLSettingsDay::initialize() +bool LLSettingsDay::initialize(bool validate_frames) { LLSD tracks = mSettings[SETTING_TRACKS]; LLSD frames = mSettings[SETTING_FRAMES]; @@ -263,6 +267,106 @@ bool LLSettingsDay::initialize() else hassky |= true; + if (validate_frames && mDayTracks[i].size() > 0) + { + // check if we hit close to anything in the list + LLSettingsDay::CycleTrack_t::value_type frame = getSettingsNearKeyframe(keyframe, i, DEFAULT_FRAME_SLOP_FACTOR); + if (frame.second) + { + // figure out direction of search + LLSettingsBase::TrackPosition found = frame.first; + LLSettingsBase::TrackPosition new_frame = keyframe; + F32 total_frame_shift = 0; + // We consider frame DEFAULT_FRAME_SLOP_FACTOR away as still encroaching, so add minimum increment + F32 move_factor = DEFAULT_FRAME_SLOP_FACTOR + DEFAULT_MULTISLIDER_INCREMENT; + bool move_forward = true; + if ((new_frame < found && (found - new_frame) <= DEFAULT_FRAME_SLOP_FACTOR) + || (new_frame > found && (new_frame - found) > DEFAULT_FRAME_SLOP_FACTOR)) + { + move_forward = false; + } + + if (move_forward) + { + CycleTrack_t::iterator iter = mDayTracks[i].find(found); + new_frame = found; // for total_frame_shift + while (total_frame_shift < 1) + { + // calculate shifted position from previous found point + total_frame_shift += move_factor + (found >= new_frame ? found : found + 1) - new_frame; + new_frame = found + move_factor; + if (new_frame > 1) new_frame--; + + // we know that current point is too close, go for next one + iter++; + if (iter == mDayTracks[i].end()) + { + iter = mDayTracks[i].begin(); + } + + if ((iter->first >= (new_frame - DEFAULT_MULTISLIDER_INCREMENT) && (new_frame + DEFAULT_FRAME_SLOP_FACTOR) >= iter->first) + || iter->first < new_frame && (new_frame + DEFAULT_FRAME_SLOP_FACTOR) >= (iter->first + 1)) + { + // we are encroaching at new point as well + found = iter->first; + } + else // (new_frame + DEFAULT_FRAME_SLOP_FACTOR < iter->first) + { + //we found clear spot + break; + } + } + } + else + { + CycleTrack_t::reverse_iterator iter = mDayTracks[i].rbegin(); + while (iter->first != found) + { + iter++; + } + new_frame = found; // for total_frame_shift + while (total_frame_shift < 1) + { + // calculate shifted position from current found point + total_frame_shift += move_factor + new_frame - (found <= new_frame ? found : found - 1); + new_frame = found - move_factor; + if (new_frame < 0) new_frame++; + + // we know that current point is too close, go for next one + iter++; + if (iter == mDayTracks[i].rend()) + { + iter = mDayTracks[i].rbegin(); + } + + if ((iter->first <= (new_frame + DEFAULT_MULTISLIDER_INCREMENT) && (new_frame - DEFAULT_FRAME_SLOP_FACTOR) <= iter->first) + || iter->first > new_frame && (new_frame - DEFAULT_FRAME_SLOP_FACTOR) <= (iter->first - 1)) + { + // we are encroaching at new point as well + found = iter->first; + } + else // (new_frame - DEFAULT_FRAME_SLOP_FACTOR > iter->first) + { + //we found clear spot + break; + } + } + + + } + + if (total_frame_shift >= 1) + { + LL_WARNS() << "Could not fix frame position, adding as is to position: " << keyframe << LL_ENDL; + } + else + { + // Mark as new position + keyframe = new_frame; + } + } + } + // Build clone since: // - can use settings from "used" multiple times // - settings can reuse LLSDs they were initialized from diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 484c59e57f..974ca8660d 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -63,6 +63,8 @@ public: static const S32 TRACK_MAX; static const S32 FRAME_MAX; + static const F32 DEFAULT_FRAME_SLOP_FACTOR; + static const LLUUID DEFAULT_ASSET_ID; typedef std::map CycleTrack_t; @@ -76,7 +78,7 @@ public: LLSettingsDay(const LLSD &data); virtual ~LLSettingsDay() { }; - bool initialize(); + bool initialize(bool validate_frames = false); virtual ptr_t buildClone() = 0; virtual LLSD getSettings() const SETTINGS_OVERRIDE; -- cgit v1.2.3 From b50d546d5ffb520228926ff1f4e6b03c69b3f857 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 3 Aug 2018 16:13:22 -0700 Subject: MAINT-7699: More robust cap protocol, better support for delete and support for individual tracks, support for setting environment by asset id in the cap MAINT-7703: Initial flags sent in message protocol for parcels --- indra/llinventory/llparcel.cpp | 3 +++ indra/llinventory/llparcel.h | 9 +++++++++ indra/llinventory/llsettingsbase.cpp | 1 - 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 0908613c10..aff7f86fd4 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -231,6 +231,9 @@ void LLParcel::init(const LLUUID &owner_id, setAllowGroupAVSounds(TRUE); setAllowAnyAVSounds(TRUE); setHaveNewParcelLimitData(FALSE); + + setRegionAllowEnvironmentOverride(FALSE); + setParcelEnvironmentVersion(-1); } void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned) diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 6ef389d246..2497a069d7 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -511,6 +511,10 @@ public: { return mRegionDenyAgeUnverifiedOverride; } BOOL getRegionAllowAccessOverride() const { return mRegionAllowAccessoverride; } + BOOL getRegionAllowEnvironmentOverride() const + { return mRegionAllowEnvironmentOverride; } + S32 getParcelEnvironmentVersion() const + { return mCurrentEnvironmentVersion; } BOOL getAllowGroupAVSounds() const { return mAllowGroupAVSounds; } @@ -581,6 +585,9 @@ public: void setRegionDenyAnonymousOverride(BOOL override) { mRegionDenyAnonymousOverride = override; } void setRegionDenyAgeUnverifiedOverride(BOOL override) { mRegionDenyAgeUnverifiedOverride = override; } void setRegionAllowAccessOverride(BOOL override) { mRegionAllowAccessoverride = override; } + void setRegionAllowEnvironmentOverride(BOOL override) { mRegionAllowEnvironmentOverride = override; } + + void setParcelEnvironmentVersion(S32 version) { mCurrentEnvironmentVersion = version; } // Accessors for parcel sellWithObjects void setPreviousOwnerID(LLUUID prev_owner) { mPreviousOwnerID = prev_owner; } @@ -662,8 +669,10 @@ protected: BOOL mRegionDenyAnonymousOverride; BOOL mRegionDenyAgeUnverifiedOverride; BOOL mRegionAllowAccessoverride; + BOOL mRegionAllowEnvironmentOverride; BOOL mAllowGroupAVSounds; BOOL mAllowAnyAVSounds; + S32 mCurrentEnvironmentVersion; bool mIsDefaultDayCycle; diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 8bcf8a4973..e00dd2199c 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -300,7 +300,6 @@ bool LLSettingsBase::validate() { LL_WARNS("SETTINGS") << "Validation warnings: " << result["warnings"] << LL_ENDL; } - LL_WARNS("SETTINGS") << "Validation success is " << result["success"] << LL_ENDL; return result["success"].asBoolean(); } -- cgit v1.2.3 From 3f6cedbbf340ae4a4d825472aca53e0c04ee5322 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 3 Aug 2018 16:32:31 -0700 Subject: Synch settings with simulator. --- indra/llinventory/llsettingsbase.h | 7 +++- indra/llinventory/llsettingsdaycycle.cpp | 63 ++++++++++++++++++++++++++------ indra/llinventory/llsettingsdaycycle.h | 4 +- 3 files changed, 61 insertions(+), 13 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index a74579e7a6..beaeac2d04 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -244,10 +244,15 @@ public: inline void setAssetId(LLUUID value) { // note that this skips setLLSD - LL_WARNS("LAPRAS") << "Settings asset id set to:{" << value << "}" << LL_ENDL; mSettings[SETTING_ASSETID] = value; } + inline void clearAssetId() + { + if (mSettings.has(SETTING_ASSETID)) + mSettings.erase(SETTING_ASSETID); + } + protected: LLSettingsBase(); diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index ab01a585c6..a43eae16fe 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -498,6 +498,58 @@ LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track) return mDayTracks[track]; } +bool LLSettingsDay::clearCycleTrack(S32 track) +{ + if ((track < 0) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to clear track (#" << track << ") out of range!" << LL_ENDL; + return false; + } + mDayTracks[track].clear(); + clearAssetId(); + setDirtyFlag(true); + return true; +} + +bool LLSettingsDay::replaceCycleTrack(S32 track, const CycleTrack_t &source) +{ + if (source.empty()) + { + LL_WARNS("DAYCYCLE") << "Attempt to copy an empty track." << LL_ENDL; + return false; + } + + { + LLSettingsBase::ptr_t first((*source.begin()).second); + std::string setting_type = first->getSettingsType(); + + if (((setting_type == "water") && (track != 0)) || + ((setting_type == "sky") && (track == 0))) + { + LL_WARNS("DAYCYCLE") << "Attempt to copy track missmatch" << LL_ENDL; + return false; + } + } + + if (!clearCycleTrack(track)) + return false; + + mDayTracks[track] = source; + return true; +} + + +bool LLSettingsDay::isTrackEmpty(S32 track) const +{ + if ((track < 0) || (track >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt to test track (#" << track << ") out of range!" << LL_ENDL; + return true; + } + + return mDayTracks[track].empty(); +} + //========================================================================= void LLSettingsDay::startDayCycle() { @@ -690,17 +742,6 @@ LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyframe(c return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); } -void LLSettingsDay::clearTrack(S32 track) -{ - if ((track < 0) || (track >= TRACK_MAX)) - { - LL_WARNS("DAYCYCLE") << "Attempt to clear track (#" << track << ") out of range!" << LL_ENDL; - return; - } - - mDayTracks[track].clear(); -} - LLSettingsBase::TrackPosition LLSettingsDay::getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe) { return get_wrapping_atafter(mDayTracks[track], keyframe)->first; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index e2f095aa74..484c59e57f 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -103,7 +103,6 @@ public: void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, const LLSettingsBase::TrackPosition& keyframe, S32 track); LLSettingsBase::ptr_t getSettingsAtKeyframe(const LLSettingsBase::TrackPosition& keyframe, S32 track) const; CycleTrack_t::value_type getSettingsNearKeyframe(const LLSettingsBase::TrackPosition &keyframe, S32 track, F32 fudge) const; - void clearTrack(S32 track); //--------------------------------------------------------------------- void startDayCycle(); @@ -116,6 +115,9 @@ public: void setInitialized(bool value = true) { mInitialized = value; } CycleTrack_t & getCycleTrack(S32 track); + bool clearCycleTrack(S32 track); + bool replaceCycleTrack(S32 track, const CycleTrack_t &source); + bool isTrackEmpty(S32 track) const; virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; static validation_list_t validationList(); -- cgit v1.2.3 From 21c6e6063f52398802fd63a81914eb42b76f3ff3 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 6 Aug 2018 16:22:06 +0300 Subject: MAINT-8952 EEP Changing one Day Cycle Keyframe can change other keyframes --- indra/llinventory/llsettingsdaycycle.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index a43eae16fe..ff9614fb10 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -262,7 +262,12 @@ bool LLSettingsDay::initialize() haswater |= true; else hassky |= true; - mDayTracks[i][keyframe] = setting; + + // Build clone since: + // - can use settings from "used" multiple times + // - settings can reuse LLSDs they were initialized from + // - LLSDs are 'smart' and can reuse them self multiple times + mDayTracks[i][keyframe] = setting->buildDerivedClone(); } } } -- cgit v1.2.3 From 7da3a1eb4f14b67c698977eb1947ce06a312d507 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 6 Aug 2018 17:49:50 +0100 Subject: WIP check-in to allow merge of upstream changes. --- indra/llinventory/llsettingssky.cpp | 88 +++++++++++++++++++++++-------------- indra/llinventory/llsettingssky.h | 24 ++++++++-- 2 files changed, 77 insertions(+), 35 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 4451bd753b..a7f9aa7842 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -554,36 +554,53 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() return validation; } +LLSD LLSettingsSky::createDensityProfileLayer( + F32 width, + F32 exponential_term, + F32 exponential_scale_factor, + F32 linear_term, + F32 constant_term, + F32 aniso_factor) +{ + LLSD dflt_layer; + dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + + if (aniso_factor != 0.0f) + { + dflt_layer[SETTING_MIE_ANISOTROPY_FACTOR] = aniso_factor; + } + + return dflt_layer; +} + +LLSD LLSettingsSky::createSingleLayerDensityProfile( + F32 width, + F32 exponential_term, + F32 exponential_scale_factor, + F32 linear_term, + F32 constant_term, + F32 aniso_factor) +{ + LLSD dflt; + LLSD dflt_layer = createDensityProfileLayer(width, exponential_term, exponential_scale_factor, linear_term, constant_term, aniso_factor); + dflt.append(dflt_layer); + return dflt; +} + LLSD LLSettingsSky::rayleighConfigDefault() { - LLSD dflt_rayleigh; - LLSD dflt_rayleigh_layer; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_rayleigh.append(dflt_rayleigh_layer); - return dflt_rayleigh; + return createSingleLayerDensityProfile(0.0f, 1.0f, -1.0f / 8000.0f, 0.0f, 0.0f); } LLSD LLSettingsSky::absorptionConfigDefault() { // absorption (ozone) has two linear ramping zones - LLSD dflt_absorption_layer_a; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; - - LLSD dflt_absorption_layer_b; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; - + LLSD dflt_absorption_layer_a = createDensityProfileLayer(25000.0f, 0.0f, 0.0f, -1.0f / 25000.0f, -2.0f / 3.0f); + LLSD dflt_absorption_layer_b = createDensityProfileLayer(0.0f, 0.0f, 0.0f, -1.0f / 15000.0f, 8.0f / 3.0f); LLSD dflt_absorption; dflt_absorption.append(dflt_absorption_layer_a); dflt_absorption.append(dflt_absorption_layer_b); @@ -592,15 +609,7 @@ LLSD LLSettingsSky::absorptionConfigDefault() LLSD LLSettingsSky::mieConfigDefault() { - LLSD dflt_mie; - LLSD dflt_mie_layer; - dflt_mie_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_mie_layer[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; - dflt_mie.append(dflt_mie_layer); + LLSD dflt_mie = createSingleLayerDensityProfile(0.0f, 1.0f, -1.0f / 1200.0f, 0.0f, 0.0f, 0.8f); return dflt_mie; } @@ -1154,6 +1163,21 @@ LLSD LLSettingsSky::getAbsorptionConfigs() const return mSettings[SETTING_ABSORPTION_CONFIG]; } +void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig) +{ + mSettings[SETTING_RAYLEIGH_CONFIG] = rayleighConfig; +} + +void LLSettingsSky::setMieConfigs(const LLSD& mieConfig) +{ + mSettings[SETTING_MIE_CONFIG] = mieConfig; +} + +void LLSettingsSky::setAbsorptionConfigs(const LLSD& absorptionConfig) +{ + mSettings[SETTING_ABSORPTION_CONFIG] = absorptionConfig; +} + LLUUID LLSettingsSky::getBloomTextureId() const { return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 19a5656644..36d1053cf6 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -72,7 +72,6 @@ public: static const std::string SETTING_SKY_BOTTOM_RADIUS; static const std::string SETTING_SKY_TOP_RADIUS; static const std::string SETTING_SUN_ARC_RADIANS; - static const std::string SETTING_MIE_ANISOTROPY_FACTOR; static const std::string SETTING_RAYLEIGH_CONFIG; static const std::string SETTING_MIE_CONFIG; @@ -84,7 +83,7 @@ public: static const std::string SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR; static const std::string SETTING_DENSITY_PROFILE_LINEAR_TERM; static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; - + static const std::string SETTING_MIE_ANISOTROPY_FACTOR; static const std::string SETTING_LEGACY_HAZE; @@ -116,10 +115,13 @@ public: F32 getMieAnisotropy() const; LLSD getRayleighConfigs() const; LLSD getMieConfigs() const; - LLSD getAbsorptionConfigs() const; LLUUID getBloomTextureId() const; + void setRayleighConfigs(const LLSD& rayleighConfig); + void setMieConfigs(const LLSD& mieConfig); + void setAbsorptionConfigs(const LLSD& absorptionConfig); + //--------------------------------------------------------------------- LLColor3 getAmbientColor() const; void setAmbientColor(const LLColor3 &val); @@ -239,6 +241,22 @@ public: static LLUUID GetDefaultCloudNoiseTextureId(); static LLUUID GetDefaultBloomTextureId(); + static LLSD createDensityProfileLayer( + F32 width, + F32 exponential_term, + F32 exponential_scale_factor, + F32 linear_term, + F32 constant_term, + F32 aniso_factor = 0.0f); + + static LLSD createSingleLayerDensityProfile( + F32 width, + F32 exponential_term, + F32 exponential_scale_factor, + F32 linear_term, + F32 constant_term, + F32 aniso_factor = 0.0f); + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; -- cgit v1.2.3 From 881ee670d92f13ac518a74e1bff81bf69e07ccfa Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 8 Aug 2018 15:41:28 -0700 Subject: Fix for mac build MAINT-8870, MAINT-8871: When legacy windlight fails load the default day cycle asset and use that. --- indra/llinventory/llsettingsdaycycle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 320e090bfd..84ef145913 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -304,8 +304,8 @@ bool LLSettingsDay::initialize(bool validate_frames) iter = mDayTracks[i].begin(); } - if ((iter->first >= (new_frame - DEFAULT_MULTISLIDER_INCREMENT) && (new_frame + DEFAULT_FRAME_SLOP_FACTOR) >= iter->first) - || iter->first < new_frame && (new_frame + DEFAULT_FRAME_SLOP_FACTOR) >= (iter->first + 1)) + if (((iter->first >= (new_frame - DEFAULT_MULTISLIDER_INCREMENT)) && ((new_frame + DEFAULT_FRAME_SLOP_FACTOR) >= iter->first)) + || ((iter->first < new_frame) && ((new_frame + DEFAULT_FRAME_SLOP_FACTOR) >= (iter->first + 1)))) { // we are encroaching at new point as well found = iter->first; -- cgit v1.2.3 From 133900d31a4f75621bad070043f5ef0125708a88 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 8 Aug 2018 16:22:04 -0700 Subject: Miss an || && in an if --- indra/llinventory/llsettingsdaycycle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 84ef145913..ea57c8987f 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -340,7 +340,7 @@ bool LLSettingsDay::initialize(bool validate_frames) } if ((iter->first <= (new_frame + DEFAULT_MULTISLIDER_INCREMENT) && (new_frame - DEFAULT_FRAME_SLOP_FACTOR) <= iter->first) - || iter->first > new_frame && (new_frame - DEFAULT_FRAME_SLOP_FACTOR) <= (iter->first - 1)) + || ((iter->first > new_frame) && ((new_frame - DEFAULT_FRAME_SLOP_FACTOR) <= (iter->first - 1)))) { // we are encroaching at new point as well found = iter->first; -- cgit v1.2.3 From 7a001186b3063c36a78b2537b81c75124e307ff7 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 9 Aug 2018 16:36:44 -0700 Subject: Adjust layout of sunmoon panel and size of ext day edit. Blank sun texture. Fix edit and transition in edit day cycle. Fix default and blank images in sky textures. --- indra/llinventory/llsettingssky.cpp | 7 ++++++- indra/llinventory/llsettingssky.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 4451bd753b..072dff4ce4 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1095,10 +1095,15 @@ LLUUID LLSettingsSky::GetDefaultAssetId() LLUUID LLSettingsSky::GetDefaultSunTextureId() { - //return DEFAULT_SUN_ID; return LLUUID::null; } + +LLUUID LLSettingsSky::GetBlankSunTextureId() +{ + return DEFAULT_SUN_ID; +} + LLUUID LLSettingsSky::GetDefaultMoonTextureId() { return DEFAULT_MOON_ID; diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 19a5656644..e2a6e6e8ae 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -235,6 +235,7 @@ public: static LLUUID GetDefaultAssetId(); static LLUUID GetDefaultSunTextureId(); + static LLUUID GetBlankSunTextureId(); static LLUUID GetDefaultMoonTextureId(); static LLUUID GetDefaultCloudNoiseTextureId(); static LLUUID GetDefaultBloomTextureId(); -- cgit v1.2.3 From 584fec695bc8d6bafc38ff6ed3b435f133fdca2b Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 15 Aug 2018 18:31:07 +0300 Subject: MAINT-8952 EEP 'uncompress' day tracks before editing --- indra/llinventory/llsettingsdaycycle.cpp | 7 +------ indra/llinventory/llsettingsdaycycle.h | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index ea57c8987f..4a99be0c4b 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -366,12 +366,7 @@ bool LLSettingsDay::initialize(bool validate_frames) } } } - - // Build clone since: - // - can use settings from "used" multiple times - // - settings can reuse LLSDs they were initialized from - // - LLSDs are 'smart' and can reuse them self multiple times - mDayTracks[i][keyframe] = setting->buildDerivedClone(); + mDayTracks[i][keyframe] = setting; } } } diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 974ca8660d..0ee5ce3e0b 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -81,6 +81,7 @@ public: bool initialize(bool validate_frames = false); virtual ptr_t buildClone() = 0; + virtual ptr_t buildDeepCloneAndUncompress() = 0; virtual LLSD getSettings() const SETTINGS_OVERRIDE; virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_DAYCYCLE; } -- cgit v1.2.3 From eadf0b910174274e7c83fe37e417f576a7350edb Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 15 Aug 2018 13:35:53 -0700 Subject: MAINT-8990, MAINT-9002: First pass rework on environment panels, region/parcel --- indra/llinventory/llsettingsbase.h | 8 ++++---- indra/llinventory/llsettingsdaycycle.cpp | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index beaeac2d04..3356727ee6 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -87,7 +87,7 @@ public: inline bool hasSetting(const std::string ¶m) const { return mSettings.has(param); } inline bool isDirty() const { return mDirty; } inline bool isVeryDirty() const { return mReplaced; } - inline void setDirtyFlag(bool dirty) { mDirty = dirty; } + inline void setDirtyFlag(bool dirty) { mDirty = dirty; clearAssetId(); } size_t getHash() const; // Hash will not include Name, ID or a previously stored Hash @@ -116,10 +116,10 @@ public: virtual void replaceSettings(LLSD settings) { - mSettings = settings; mBlendedFactor = 0.0; setDirtyFlag(true); mReplaced = true; + mSettings = settings; } virtual LLSD getSettings() const; @@ -130,8 +130,8 @@ public: { mSettings[name] = value; mDirty = true; - if (mSettings.has(SETTING_ASSETID)) - mSettings.erase(SETTING_ASSETID); + if (name != SETTING_ASSETID) + clearAssetId(); } inline void setValue(const std::string &name, const LLSD &value) diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index ea57c8987f..20efb23607 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -120,7 +120,7 @@ const S32 LLSettingsDay::FRAME_MAX(56); const F32 LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR(0.02501f); -const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("283a26a3-b147-47b7-8057-cfff0302ec0e"); +const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("94d296c2-6e05-963c-6b62-671199121dbb"); // Minimum value to prevent multislider in edit floaters from eating up frames that 'encroach' on one another's space static const F32 DEFAULT_MULTISLIDER_INCREMENT(0.005f); @@ -150,6 +150,9 @@ LLSD LLSettingsDay::getSettings() const if (mSettings.has(SETTING_ID)) settings[SETTING_ID] = mSettings[SETTING_ID]; + if (mSettings.has(SETTING_ASSETID)) + settings[SETTING_ASSETID] = mSettings[SETTING_ASSETID]; + settings[SETTING_TYPE] = getSettingsType(); std::map in_use; @@ -194,6 +197,14 @@ bool LLSettingsDay::initialize(bool validate_frames) LLSD tracks = mSettings[SETTING_TRACKS]; LLSD frames = mSettings[SETTING_FRAMES]; + // save for later... + LLUUID assetid; + if (mSettings.has(SETTING_ASSETID)) + { + assetid = mSettings[SETTING_ASSETID].asUUID(); + LL_WARNS("LAPRAS") << "initializing daycycle with asset id " << assetid << LL_ENDL; + } + std::map used; for (LLSD::map_const_iterator itFrame = frames.beginMap(); itFrame != frames.endMap(); ++itFrame) @@ -385,6 +396,11 @@ bool LLSettingsDay::initialize(bool validate_frames) mSettings.erase(SETTING_TRACKS); mSettings.erase(SETTING_FRAMES); + if (!assetid.isNull()) + { + mSettings[SETTING_ASSETID] = assetid; + } + mInitialized = true; return true; } -- cgit v1.2.3 From 5ddd9d0c977bea070008baefdb452e808077f98c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 16 Aug 2018 21:38:49 +0100 Subject: Make settings vfuncs use SETTINGS_OVERRIDE macro (override keyword in viewer codebase) to fix OS X compilation. Mark cloning funcs and derived class overrides as const. --- indra/llinventory/llsettingsbase.h | 2 +- indra/llinventory/llsettingsdaycycle.h | 6 +++--- indra/llinventory/llsettingssky.h | 4 ++-- indra/llinventory/llsettingswater.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index beaeac2d04..481914a012 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -200,7 +200,7 @@ public: virtual bool validate(); - virtual ptr_t buildDerivedClone() = 0; + virtual ptr_t buildDerivedClone() const = 0; class Validator { diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 0ee5ce3e0b..878eec8301 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -80,8 +80,8 @@ public: bool initialize(bool validate_frames = false); - virtual ptr_t buildClone() = 0; - virtual ptr_t buildDeepCloneAndUncompress() = 0; + virtual ptr_t buildClone() const = 0; + virtual ptr_t buildDeepCloneAndUncompress() const = 0; virtual LLSD getSettings() const SETTINGS_OVERRIDE; virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_DAYCYCLE; } @@ -125,7 +125,7 @@ public: virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE; static validation_list_t validationList(); - virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } + virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); } LLSettingsBase::TrackPosition getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe); LLSettingsBase::TrackPosition getLowerBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e2a6e6e8ae..e0ad480c0a 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -96,7 +96,7 @@ public: LLSettingsSky(const LLSD &data); virtual ~LLSettingsSky() { }; - virtual ptr_t buildClone() = 0; + virtual ptr_t buildClone() const = 0; //--------------------------------------------------------------------- virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("sky"); } @@ -231,7 +231,7 @@ public: LLColor3 getSunDiffuse() const; LLColor4 getTotalAmbient() const; - virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } + virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); } static LLUUID GetDefaultAssetId(); static LLUUID GetDefaultSunTextureId(); diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index b525912898..b33b082bbf 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -55,7 +55,7 @@ public: LLSettingsWater(const LLSD &data); virtual ~LLSettingsWater() { }; - virtual ptr_t buildClone() = 0; + virtual ptr_t buildClone() const = 0; //--------------------------------------------------------------------- virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("water"); } @@ -226,7 +226,7 @@ public: static LLSD translateLegacySettings(LLSD legacy); - virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } + virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); } static LLUUID GetDefaultAssetId(); static LLUUID GetDefaultWaterNormalAssetId(); -- cgit v1.2.3 From 597d28ad343d39f0812f7403119cc817dfab3d64 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 16 Aug 2018 22:00:53 +0100 Subject: Fix constness of LLSettingsVODay::buildDeepCloneAndUncompress. --- indra/llinventory/llsettingsdaycycle.cpp | 11 ++++++++++- indra/llinventory/llsettingsdaycycle.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 4a99be0c4b..8ca4ca4a6d 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -593,7 +593,16 @@ LLSettingsDay::validation_list_t LLSettingsDay::validationList() return validation; } -LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track) +LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrack(S32 track) +{ + static CycleTrack_t emptyTrack; + if (mDayTracks.size() <= track) + return emptyTrack; + + return mDayTracks[track]; +} + +const LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrackConst(S32 track) const { static CycleTrack_t emptyTrack; if (mDayTracks.size() <= track) diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 878eec8301..46dc0cec74 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -118,6 +118,7 @@ public: void setInitialized(bool value = true) { mInitialized = value; } CycleTrack_t & getCycleTrack(S32 track); + const CycleTrack_t & getCycleTrackConst(S32 track) const; bool clearCycleTrack(S32 track); bool replaceCycleTrack(S32 track, const CycleTrack_t &source); bool isTrackEmpty(S32 track) const; -- cgit v1.2.3 From 4859db1adabcf84b959ff0603f1bb8401232164c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 21 Aug 2018 15:59:18 -0700 Subject: MAINT-9026: Adding scale for sun and moon. Also don't allow the user to directly set the radio buttons for inventory and custom. --- indra/llinventory/llsettingsbase.cpp | 14 +++++++++++++- indra/llinventory/llsettingsbase.h | 1 + indra/llinventory/llsettingssky.cpp | 29 ++++++++++++++++++++++++++++- indra/llinventory/llsettingssky.h | 8 ++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index e00dd2199c..938f614fc9 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -306,7 +306,7 @@ bool LLSettingsBase::validate() LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &validations) { - static Validator validateName(SETTING_NAME, false, LLSD::TypeString); + static Validator validateName(SETTING_NAME, false, LLSD::TypeString, boost::bind(&Validator::verifyStringLength, _1, 32)); static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); @@ -564,6 +564,18 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range) return true; } +bool LLSettingsBase::Validator::verifyStringLength(LLSD &value, S32 length) +{ + std::string sval = value.asString(); + + if (!sval.empty()) + { + sval = sval.substr(0, length); + value = LLSD::String(sval); + } + return true; +} + //========================================================================= void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 9757092794..7884240ae3 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -230,6 +230,7 @@ public: static bool verifyQuaternionNormal(LLSD &value); static bool verifyFloatRange(LLSD &value, LLSD range); static bool verifyIntegerRange(LLSD &value, LLSD range); + static bool verifyStringLength(LLSD &value, S32 length); private: std::string mName; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 072dff4ce4..c0402f1fe4 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -93,10 +93,12 @@ const std::string LLSettingsSky::SETTING_GLOW("glow"); const std::string LLSettingsSky::SETTING_LIGHT_NORMAL("lightnorm"); const std::string LLSettingsSky::SETTING_MAX_Y("max_y"); const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation"); +const std::string LLSettingsSky::SETTING_MOON_SCALE("moon_scale"); const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id"); const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness"); const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color"); const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation"); +const std::string LLSettingsSky::SETTING_SUN_SCALE("sun_scale"); const std::string LLSettingsSky::SETTING_SUN_TEXTUREID("sun_id"); const std::string LLSettingsSky::SETTING_LEGACY_EAST_ANGLE("east_angle"); @@ -524,6 +526,8 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4000.0f))))); validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); + validation.push_back(Validator(SETTING_MOON_SCALE, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); @@ -532,7 +536,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_SUN_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); - validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_SUN_SCALE, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); + validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_PLANET_RADIUS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f))))); @@ -1310,6 +1316,16 @@ void LLSettingsSky::setMoonRotation(const LLQuaternion &val) setValue(SETTING_MOON_ROTATION, val); } +F32 LLSettingsSky::getMoonScale() const +{ + return mSettings[SETTING_MOON_SCALE].asReal(); +} + +void LLSettingsSky::setMoonScale(F32 val) +{ + setValue(SETTING_MOON_SCALE, val); +} + LLUUID LLSettingsSky::getMoonTextureId() const { return mSettings[SETTING_MOON_TEXTUREID].asUUID(); @@ -1350,6 +1366,17 @@ void LLSettingsSky::setSunRotation(const LLQuaternion &val) setValue(SETTING_SUN_ROTATION, val); } + +F32 LLSettingsSky::getSunScale() const +{ + return mSettings[SETTING_SUN_SCALE].asReal(); +} + +void LLSettingsSky::setSunScale(F32 val) +{ + setValue(SETTING_SUN_SCALE, val); +} + LLUUID LLSettingsSky::getSunTextureId() const { return mSettings[SETTING_SUN_TEXTUREID].asUUID(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e0ad480c0a..20b8d01879 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -62,10 +62,12 @@ public: static const std::string SETTING_LIGHT_NORMAL; static const std::string SETTING_MAX_Y; static const std::string SETTING_MOON_ROTATION; + static const std::string SETTING_MOON_SCALE; static const std::string SETTING_MOON_TEXTUREID; static const std::string SETTING_STAR_BRIGHTNESS; static const std::string SETTING_SUNLIGHT_COLOR; static const std::string SETTING_SUN_ROTATION; + static const std::string SETTING_SUN_SCALE; static const std::string SETTING_SUN_TEXTUREID; static const std::string SETTING_PLANET_RADIUS; @@ -165,6 +167,9 @@ public: LLQuaternion getMoonRotation() const; void setMoonRotation(const LLQuaternion &val); + F32 getMoonScale() const; + void setMoonScale(F32 val); + LLUUID getMoonTextureId() const; void setMoonTextureId(LLUUID id); @@ -177,6 +182,9 @@ public: LLQuaternion getSunRotation() const; void setSunRotation(const LLQuaternion &val) ; + F32 getSunScale() const; + void setSunScale(F32 val); + LLUUID getSunTextureId() const; void setSunTextureId(LLUUID id); -- cgit v1.2.3 From b45a7144aa5be95ffc8edd406ef9ab14c4192890 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 22 Aug 2018 00:49:48 +0100 Subject: Fix up dropped new funcs for settings density profile configs in sky settings. --- indra/llinventory/llsettingssky.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 14caca36a7..d15e084878 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -120,6 +120,10 @@ public: LLSD getAbsorptionConfigs() const; LLUUID getBloomTextureId() const; + void setRayleighConfigs(const LLSD& rayleighConfig); + void setMieConfigs(const LLSD& mieConfig); + void setAbsorptionConfigs(const LLSD& absorptionConfig); + //--------------------------------------------------------------------- LLColor3 getAmbientColor() const; void setAmbientColor(const LLColor3 &val); -- cgit v1.2.3 From ab1c7087e944ea9ded217770176e3444c8c39c0d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 22 Aug 2018 00:52:47 +0100 Subject: Restore funcs to create LLSD for density layers and profiles with single density layers. --- indra/llinventory/llsettingssky.cpp | 73 +++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 32 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index bc02867ce6..3ede670d35 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -554,36 +554,53 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() return validation; } +LLSD LLSettingsSky::createDensityProfileLayer( + F32 width, + F32 exponential_term, + F32 exponential_scale_factor, + F32 linear_term, + F32 constant_term, + F32 aniso_factor) +{ + LLSD dflt_layer; + dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere + dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; + dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; + dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; + dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + + if (aniso_factor != 0.0f) + { + dflt_layer[SETTING_MIE_ANISOTROPY_FACTOR] = aniso_factor; + } + + return dflt_layer; +} + +LLSD LLSettingsSky::createSingleLayerDensityProfile( + F32 width, + F32 exponential_term, + F32 exponential_scale_factor, + F32 linear_term, + F32 constant_term, + F32 aniso_factor) +{ + LLSD dflt; + LLSD dflt_layer = createDensityProfileLayer(width, exponential_term, exponential_scale_factor, linear_term, constant_term, aniso_factor); + dflt.append(dflt_layer); + return dflt; +} + LLSD LLSettingsSky::rayleighConfigDefault() { - LLSD dflt_rayleigh; - LLSD dflt_rayleigh_layer; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_rayleigh_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_rayleigh.append(dflt_rayleigh_layer); - return dflt_rayleigh; + return createSingleLayerDensityProfile(0.0f, 1.0f, -1.0f / 8000.0f, 0.0f, 0.0f); } LLSD LLSettingsSky::absorptionConfigDefault() { // absorption (ozone) has two linear ramping zones - LLSD dflt_absorption_layer_a; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_WIDTH] = 25000.0f; // 0 -> the entire atmosphere - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 25000.0f; - dflt_absorption_layer_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = -2.0f / 3.0f; - - LLSD dflt_absorption_layer_b; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> remainder of the atmosphere - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_TERM] = 0.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_LINEAR_TERM] = -1.0f / 15000.0f; - dflt_absorption_layer_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 8.0f / 3.0f; - + LLSD dflt_absorption_layer_a = createDensityProfileLayer(25000.0f, 0.0f, 0.0f, -1.0f / 25000.0f, -2.0f / 3.0f); + LLSD dflt_absorption_layer_b = createDensityProfileLayer(0.0f, 0.0f, 0.0f, -1.0f / 15000.0f, 8.0f / 3.0f); LLSD dflt_absorption; dflt_absorption.append(dflt_absorption_layer_a); dflt_absorption.append(dflt_absorption_layer_b); @@ -592,15 +609,7 @@ LLSD LLSettingsSky::absorptionConfigDefault() LLSD LLSettingsSky::mieConfigDefault() { - LLSD dflt_mie; - LLSD dflt_mie_layer; - dflt_mie_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_mie_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; - dflt_mie_layer[SETTING_MIE_ANISOTROPY_FACTOR] = 0.8f; - dflt_mie.append(dflt_mie_layer); + LLSD dflt_mie = createSingleLayerDensityProfile(0.0f, 1.0f, -1.0f / 1200.0f, 0.0f, 0.0f, 0.8f); return dflt_mie; } -- cgit v1.2.3 From 4c7376f939d6cbfe17a982a0e1ad93cc529a1ba7 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 22 Aug 2018 16:54:14 +0300 Subject: MAINT-8881 EEP Blue Horizon swatch does not display the color set for that keyframe. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c0402f1fe4..184a75b9c7 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -892,7 +892,7 @@ LLColor3 LLSettingsSky::getBlueDensity() const LLColor3 LLSettingsSky::getBlueHorizon() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY)) + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_HORIZON)) { return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON]); } -- cgit v1.2.3 From 94c24b8713b72b6ce52637644ff18b234a3a400a Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 23 Aug 2018 20:14:15 +0300 Subject: MAINT-8944 Fix frame transition's images --- indra/llinventory/llsettingssky.cpp | 5 ++++- indra/llinventory/llsettingswater.cpp | 10 ++++++++-- indra/llinventory/llsettingswater.h | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 184a75b9c7..dbf9117882 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -401,7 +401,10 @@ LLSettingsSky::LLSettingsSky(): void LLSettingsSky::replaceSettings(LLSD settings) { LLSettingsBase::replaceSettings(settings); - + mNextSunTextureId.setNull(); + mNextMoonTextureId.setNull(); + mNextCloudTextureId.setNull(); + mNextBloomTextureId.setNull(); } void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index f0d63bf033..652e211ac4 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -185,10 +185,16 @@ void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf) } else { - LL_WARNS("SETTINGS") << "Cound not cast end settings to water. No blend performed." << LL_ENDL; + LL_WARNS("SETTINGS") << "Could not cast end settings to water. No blend performed." << LL_ENDL; } setBlendFactor(blendf); - mNextNormalMapID = other->getNormalMapID(); +} + +void LLSettingsWater::replaceSettings(LLSD settings) +{ + LLSettingsBase::replaceSettings(settings); + mNextNormalMapID.setNull(); + mNextTransparentTextureID.setNull(); } LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index b33b082bbf..11d7150ba9 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -64,6 +64,8 @@ public: // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; + virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE; + static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f); //--------------------------------------------------------------------- -- cgit v1.2.3 From 964a472461bed91b3efa383aaea34d425b96111d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 29 Aug 2018 21:13:09 +0100 Subject: Hook up sky density panel to fixedenv and edit_ext_daycycle UI. Fix retrieving LLSD for density configs (element not array) in density UI. Tweak layout of sky density controls. --- indra/llinventory/llsettingssky.cpp | 29 +++++++++++++++++++++++++---- indra/llinventory/llsettingssky.h | 9 ++++++++- 2 files changed, 33 insertions(+), 5 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0d789590fa..5f55018387 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1161,20 +1161,41 @@ F32 LLSettingsSky::getMieAnisotropy() const { return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); } - + +LLSD LLSettingsSky::getRayleighConfig() const +{ + LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray()); + return copy; +} + +LLSD LLSettingsSky::getMieConfig() const +{ + LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray()); + return copy; +} + +LLSD LLSettingsSky::getAbsorptionConfig() const +{ + LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray()); + return copy; +} + LLSD LLSettingsSky::getRayleighConfigs() const { - return mSettings[SETTING_RAYLEIGH_CONFIG]; + LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray()); + return copy; } LLSD LLSettingsSky::getMieConfigs() const { - return mSettings[SETTING_MIE_CONFIG]; + LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray()); + return copy; } LLSD LLSettingsSky::getAbsorptionConfigs() const { - return mSettings[SETTING_ABSORPTION_CONFIG]; + LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray()); + return copy; } void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig) diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 8030bfeb39..a4ea8c98f4 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -116,10 +116,17 @@ public: F32 getSkyTopRadius() const; F32 getSunArcRadians() const; F32 getMieAnisotropy() const; + + // Return first (only) profile layer represented in LLSD + LLSD getRayleighConfig() const; + LLSD getMieConfig() const; + LLSD getAbsorptionConfig() const; + + // Return entire LLSDArray of profile layers represented in LLSD LLSD getRayleighConfigs() const; LLSD getMieConfigs() const; - LLSD getAbsorptionConfigs() const; + LLUUID getBloomTextureId() const; void setRayleighConfigs(const LLSD& rayleighConfig); -- cgit v1.2.3 From d452fd77eff53c031c74301dd44a35edce6da95b Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 30 Aug 2018 21:37:10 +0100 Subject: MAINT-9007 fix management of water plane and fog Ks shader uniforms --- indra/llinventory/llsettingswater.h | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 11d7150ba9..06ee8e68bc 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -199,19 +199,6 @@ public: setValue(SETTING_WAVE2_DIR, val); } - //------------------------------------------- - LLVector4 getWaterPlane() const - { - update(); - return mWaterPlane; - } - - F32 getWaterFogKS() const - { - update(); - return mWaterFogKS; - } - //------------------------------------------- LLUUID getNextNormalMapID() const { @@ -251,9 +238,6 @@ protected: LLSettingsWater(); - LLVector4 mWaterPlane; - F32 mWaterFogKS; - private: LLUUID mNextTransparentTextureID; LLUUID mNextNormalMapID; -- cgit v1.2.3 From 3b10414c632e73d66d2840ddcd474a79fa120540 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 31 Aug 2018 11:47:18 -0700 Subject: Adding optional flags to settings objects. --- indra/llinventory/llsettingsbase.cpp | 38 ++++++++++++++++++++++++++-- indra/llinventory/llsettingsbase.h | 48 +++++++++++++++++++++++++++++++++++- indra/llinventory/llsettingssky.cpp | 1 + 3 files changed, 84 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 938f614fc9..5283a8dc8a 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -54,6 +54,10 @@ const std::string LLSettingsBase::SETTING_NAME("name"); const std::string LLSettingsBase::SETTING_HASH("hash"); const std::string LLSettingsBase::SETTING_TYPE("type"); const std::string LLSettingsBase::SETTING_ASSETID("asset_id"); +const std::string LLSettingsBase::SETTING_FLAGS("flags"); + +const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0); +const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1); //========================================================================= LLSettingsBase::LLSettingsBase(): @@ -239,13 +243,23 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F // case LLSD::TypeBinary: // case LLSD::TypeDate: default: - /* TODO: If the UUID points to an image ID, blend the images. */ // 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; } } + // Special handling cases + // Flags + if (settings.has(SETTING_FLAGS)) + { + U32 flags = (U32)settings[SETTING_FLAGS].asInteger(); + if (other.has(SETTING_FLAGS)) + flags |= (U32)other[SETTING_FLAGS].asInteger(); + + newSettings[SETTING_FLAGS] = LLSD::Integer(flags); + } + // Now add anything that is in other but not in the settings for (LLSD::map_const_iterator it = other.beginMap(); it != other.endMap(); ++it) { @@ -262,6 +276,19 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, F return newSettings; } +LLSettingsBase::stringset_t LLSettingsBase::getSkipInterpolateKeys() const +{ + static stringset_t skipSet; + + if (skipSet.empty()) + { + skipSet.insert(SETTING_FLAGS); + skipSet.insert(SETTING_HASH); + } + + return skipSet; +} + LLSD LLSettingsBase::getSettings() const { return mSettings; @@ -311,6 +338,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); static Validator validateAssetId(SETTING_ASSETID, false, LLSD::TypeUUID); + static Validator validateFlags(SETTING_FLAGS, false, LLSD::TypeInteger); stringset_t validated; stringset_t strip; bool isValid(true); @@ -353,6 +381,13 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } validated.insert(validateType.getName()); + if (!validateFlags.verify(settings)) + { + errors.append(LLSD::String("Unable to validate 'flags'.")); + isValid = false; + } + validated.insert(validateFlags.getName()); + // Fields for specific settings. for (validation_list_t::iterator itv = validations.begin(); itv != validations.end(); ++itv) { @@ -415,7 +450,6 @@ bool LLSettingsBase::Validator::verify(LLSD &data) { if (!mDefault.isUndefined()) { - LL_INFOS("SETTINGS") << "Inserting missing default for '" << mName << "'." << LL_ENDL; data[mName] = mDefault; return true; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 7884240ae3..a90cec6323 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -70,6 +70,10 @@ public: static const std::string SETTING_HASH; static const std::string SETTING_TYPE; static const std::string SETTING_ASSETID; + static const std::string SETTING_FLAGS; + + static const U32 FLAG_NOCOPY; + static const U32 FLAG_NOMOD; typedef std::map parammapping_t; @@ -113,6 +117,48 @@ public: return LLUUID(); } + inline U32 getFlags() const + { + if (mSettings.has(SETTING_FLAGS)) + return static_cast(mSettings[SETTING_FLAGS].asInteger()); + return 0; + } + + inline void setFlags(U32 value) + { + setLLSD(SETTING_FLAGS, LLSD::Integer(value)); + } + + inline bool getFlag(U32 flag) const + { + if (mSettings.has(SETTING_FLAGS)) + return ((U32)mSettings[SETTING_FLAGS].asInteger() & flag) == flag; + return false; + } + + 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); + } + + 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); + } virtual void replaceSettings(LLSD settings) { @@ -270,7 +316,7 @@ protected: /// when lerping between settings, some may require special handling. /// Get a list of these key to be skipped by the default settings lerp. /// (handling should be performed in the override of lerpSettings. - virtual stringset_t getSkipInterpolateKeys() const { return stringset_t(); } + virtual stringset_t getSkipInterpolateKeys() const; // A list of settings that represent quaternions and should be slerped // rather than lerped. diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index dbf9117882..0203e5067a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -435,6 +435,7 @@ LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const if (skipSet.empty()) { + skipSet = LLSettingsBase::getSkipInterpolateKeys(); skipSet.insert(SETTING_RAYLEIGH_CONFIG); skipSet.insert(SETTING_MIE_CONFIG); skipSet.insert(SETTING_ABSORPTION_CONFIG); -- cgit v1.2.3 From 0a78e9271c524c92cb8b1965e9a6081d4f700437 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 4 Sep 2018 23:39:21 +0100 Subject: Make legacy star brightness setting convert to 0-512 range of new settings. Make brightness scale in shader more linear and fix twinkling. --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0203e5067a..3b60ee2000 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -646,7 +646,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); - dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(256.0000); dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); @@ -775,7 +775,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) } if (legacy.has(SETTING_STAR_BRIGHTNESS)) { - newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal()); + newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal()) * 256.0f; } if (legacy.has(SETTING_SUNLIGHT_COLOR)) { -- cgit v1.2.3 From 32631f09a57548c2bbf7e09211a2053ff2e4e47d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 4 Sep 2018 23:41:36 +0100 Subject: 8283/4 WIP --- indra/llinventory/llsettingssky.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 5f55018387..cd6dfad71d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,8 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#pragma optimize("", off) + //========================================================================= static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); -- cgit v1.2.3 From 4aaa23fe6d4a875998a7472e656e058a1581513a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 4 Sep 2018 23:49:49 +0100 Subject: Update validation range for star brightness to 0 -> 512. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 3b60ee2000..8539f1fe0a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -534,7 +534,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(512.0f))))); validation.push_back(Validator(SETTING_SUNLIGHT_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), -- cgit v1.2.3 From 4bd2b8b98ba1c562dfd65975a87ef5ee3db35633 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 7 Sep 2018 17:24:29 +0100 Subject: Fix createDensityProfileLayer dropping passed in values. Enable sky density panel to update advanced atmo precomputed textures. Take wild stab at appropriate ranges for density parameters in edit panel UI. Clean up debug-only code that isn't necessary anymore. Point autobuild at latest version of libatmosphere package. --- indra/llinventory/llsettingssky.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ba92a82174..ed8baee204 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -573,11 +573,11 @@ LLSD LLSettingsSky::createDensityProfileLayer( F32 aniso_factor) { LLSD dflt_layer; - dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = 0.0f; // 0 -> the entire atmosphere - dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = 1.0f; - dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f; - dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = 0.0f; - dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = 0.0f; + dflt_layer[SETTING_DENSITY_PROFILE_WIDTH] = width; // 0 -> the entire atmosphere + dflt_layer[SETTING_DENSITY_PROFILE_EXP_TERM] = exponential_term; + dflt_layer[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = exponential_scale_factor; + dflt_layer[SETTING_DENSITY_PROFILE_LINEAR_TERM] = linear_term; + dflt_layer[SETTING_DENSITY_PROFILE_CONSTANT_TERM] = constant_term; if (aniso_factor != 0.0f) { @@ -670,7 +670,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f; dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; - dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f; + dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00045f; dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); @@ -1160,7 +1160,7 @@ F32 LLSettingsSky::getSunArcRadians() const F32 LLSettingsSky::getMieAnisotropy() const { - return mSettings[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); + return getMieConfig()[SETTING_MIE_ANISOTROPY_FACTOR].asReal(); } LLSD LLSettingsSky::getRayleighConfig() const @@ -1183,20 +1183,17 @@ LLSD LLSettingsSky::getAbsorptionConfig() const LLSD LLSettingsSky::getRayleighConfigs() const { - LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray()); - return copy; + return mSettings[SETTING_RAYLEIGH_CONFIG]; } LLSD LLSettingsSky::getMieConfigs() const { - LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray()); - return copy; + return mSettings[SETTING_MIE_CONFIG]; } LLSD LLSettingsSky::getAbsorptionConfigs() const { - LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray()); - return copy; + return mSettings[SETTING_ABSORPTION_CONFIG]; } void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig) -- cgit v1.2.3 From 1f69a685eb7d403b8ad5b2ebc24978151da49910 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 7 Sep 2018 22:10:14 +0100 Subject: MAINT-8988 Make rebuilding sky tex not look up invariant values by converting from LLSD 15 times per pixel. Set range on density multiplier to be non-zero to clamp light attenuation to sane values. Fix UI for density multiplier to include 4 decimal places and not show 0.0003 as 0.00 --- indra/llinventory/llsettingssky.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8539f1fe0a..bc7f4f2b5a 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -155,7 +155,7 @@ LLSettingsSky::validation_list_t legacyHazeValidationList() legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(0.9f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); } @@ -923,11 +923,12 @@ F32 LLSettingsSky::getHazeHorizon() const F32 LLSettingsSky::getDensityMultiplier() const { + F32 density_multiplier = 0.0001f; if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DENSITY_MULTIPLIER)) { - return mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER].asReal(); + density_multiplier = mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER].asReal(); } - return 0.0001f; + return density_multiplier; } F32 LLSettingsSky::getDistanceMultiplier() const -- cgit v1.2.3 From 114e358aae80e9e3ca70de093d51e4700c46df37 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 7 Sep 2018 16:09:32 -0700 Subject: Work to make edit floaters respect no mod and no trans. Importing no-trans frame will cause day cycle to become no trans. --- indra/llinventory/llsettingsbase.cpp | 1 + indra/llinventory/llsettingsbase.h | 1 + 2 files changed, 2 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 5283a8dc8a..2adbb213e6 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -58,6 +58,7 @@ const std::string LLSettingsBase::SETTING_FLAGS("flags"); const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0); const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1); +const U32 LLSettingsBase::FLAG_NOTRANS(0x01 << 2); //========================================================================= LLSettingsBase::LLSettingsBase(): diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index a90cec6323..aea1bc3fde 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -74,6 +74,7 @@ public: static const U32 FLAG_NOCOPY; static const U32 FLAG_NOMOD; + static const U32 FLAG_NOTRANS; typedef std::map parammapping_t; -- cgit v1.2.3 From 598cd8a30fe31b2af5e9bd23db72101afae45870 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 10 Sep 2018 17:31:31 +0300 Subject: MAINT-9066 EEP should not be able to delete all Keyframes from Ground Level or Water --- indra/llinventory/llsettingsdaycycle.cpp | 1 + indra/llinventory/llsettingsdaycycle.h | 1 + 2 files changed, 2 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 25cd99b997..c911ef23c0 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -115,6 +115,7 @@ const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYOFFSET(57600); // +16 ho const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYOFFSET(86400); // 24 hours const S32 LLSettingsDay::TRACK_WATER(0); // water track is 0 +const S32 LLSettingsDay::TRACK_GROUND_LEVEL(1); const S32 LLSettingsDay::TRACK_MAX(5); // 5 tracks, 4 skys, 1 water const S32 LLSettingsDay::FRAME_MAX(56); diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 46dc0cec74..8776f6725d 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -60,6 +60,7 @@ public: static const Seconds MAXIMUM_DAYOFFSET; static const S32 TRACK_WATER; + static const S32 TRACK_GROUND_LEVEL; static const S32 TRACK_MAX; static const S32 FRAME_MAX; -- cgit v1.2.3 From 9581a197aceba7647ab9153513089570f11c4f9a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 17 Sep 2018 19:48:58 +0100 Subject: SL-1873 Make range of star brightness in code and in UI 0-500 (not 512). --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 56449c0598..399692d80b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -534,7 +534,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(512.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(500.0f))))); validation.push_back(Validator(SETTING_SUNLIGHT_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -784,7 +784,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) } if (legacy.has(SETTING_STAR_BRIGHTNESS)) { - newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal()) * 256.0f; + newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal() * 250.0f); } if (legacy.has(SETTING_SUNLIGHT_COLOR)) { -- cgit v1.2.3 From aafb9bebf48f79d06c82e601dd19cf2f2d70de9e Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 20 Sep 2018 15:39:06 -0700 Subject: SL-9636: Hide the anyone, group share and for sale checks in the properties panel for settings. (didn't do others items it may apply to) --- indra/llinventory/llinventorytype.cpp | 6 ++++++ indra/llinventory/llinventorytype.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 2b6b53556d..458adc9edd 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -209,6 +209,12 @@ bool LLInventoryType::cannotRestrictPermissions(LLInventoryType::EType type) } } +// Should show permissions that apply only to objects rezed in world. +bool LLInventoryType::showInWorldPermissions(LLInventoryType::EType type) +{ + return (type != IT_SETTINGS); +} + bool inventory_and_asset_types_match(LLInventoryType::EType inventory_type, LLAssetType::EType asset_type) { diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index 86486373b5..8f2267307b 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -134,6 +134,8 @@ public: // true if this type cannot have restricted permissions. static bool cannotRestrictPermissions(EType type); + static bool showInWorldPermissions(EType type); + private: // don't instantiate or derive one of these objects LLInventoryType( void ); -- cgit v1.2.3 From 70c18ba14b4ea831c109030b48096d7c1fd5e510 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 24 Sep 2018 14:55:21 -0700 Subject: SL-9736: 0.0 is no motion for cloud scroll. --- indra/llinventory/llsettingssky.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 399692d80b..36e203cbf5 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -645,7 +645,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); - dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109); + dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(0.0f)(0.0f); dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); @@ -752,6 +752,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) { LLVector2 cloud_scroll(legacy[SETTING_CLOUD_SCROLL_RATE]); + cloud_scroll -= LLVector2(10, 10); if (legacy.has(SETTING_LEGACY_ENABLE_CLOUD_SCROLL)) { LLSD enabled = legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL]; -- cgit v1.2.3 From ed2e333a544acc467df0f1d97b4fc5d2fd72b3b2 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 24 Sep 2018 17:00:01 -0700 Subject: MAINT-9734: Change limits on settings values. --- indra/llinventory/llsettingssky.cpp | 33 ++++++++++++++++++--------------- indra/llinventory/llsettingswater.cpp | 14 +++++++------- 2 files changed, 25 insertions(+), 22 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 36e203cbf5..4543f00454 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -33,8 +33,11 @@ #include "v3colorutil.h" //========================================================================= -static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees -static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); +namespace { + const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees + const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); + const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); +} namespace { LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) @@ -480,17 +483,17 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); validation.push_back(Validator(SETTING_HAZE_DENSITY, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); validation.push_back(Validator(SETTING_HAZE_HORIZON, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); validation.push_back(Validator(SETTING_AMBIENT, false, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.0009f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1000.0f))))); validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); @@ -501,17 +504,17 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY1, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(1.68841f)(1.0f)(1.0f)("*"))))); + LLSD(LLSDArray(1.0f)(1.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY2, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(1.68841f)(1.0f)(1.0f)("*"))))); + LLSD(LLSDArray(1.0f)(1.0f)(1.0f)("*"))))); validation.push_back(Validator(SETTING_CLOUD_SCALE, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.001f)(0.999f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.001f)(3.0f))))); validation.push_back(Validator(SETTING_CLOUD_SCROLL_RATE, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)), - LLSD(LLSDArray(20.0f)(20.0f))))); + LLSD(LLSDArray(-50.0f)(-50.0f)), + LLSD(LLSDArray(50.0f)(50.0f))))); validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); @@ -521,14 +524,14 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_DOME_RADIUS, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(2000.0f))))); validation.push_back(Validator(SETTING_GAMMA, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(10.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(20.0f))))); validation.push_back(Validator(SETTING_GLOW, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.2f)("*")(-2.5f)("*")), - LLSD(LLSDArray(20.0f)("*")(0.0f)("*"))))); + LLSD(LLSDArray(0.2f)("*")(-10.0f)("*")), + LLSD(LLSDArray(40.0f)("*")(10.0f)("*"))))); validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4000.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(10000.0f))))); validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); validation.push_back(Validator(SETTING_MOON_SCALE, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 652e211ac4..33f824028b 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -213,7 +213,7 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] validation.push_back(Validator(SETTING_BLUR_MULTIPILER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.16f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-0.5f)(0.5f))))); validation.push_back(Validator(SETTING_FOG_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)(1.0f)), @@ -232,17 +232,17 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)), LLSD(LLSDArray(10.0f)(10.0f)(10.0f))))); validation.push_back(Validator(SETTING_SCALE_ABOVE, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(3.0f))))); validation.push_back(Validator(SETTING_SCALE_BELOW, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(3.0f))))); validation.push_back(Validator(SETTING_WAVE1_DIR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(-4.0f)(-4.0f)), - LLSD(LLSDArray(4.0f)(4.0f))))); + LLSD(LLSDArray(-20.0f)(-20.0f)), + LLSD(LLSDArray(20.0f)(20.0f))))); validation.push_back(Validator(SETTING_WAVE2_DIR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(-4.0f)(-4.0f)), - LLSD(LLSDArray(4.0f)(4.0f))))); + LLSD(LLSDArray(-20.0f)(-20.0f)), + LLSD(LLSDArray(20.0f)(20.0f))))); } return validation; -- cgit v1.2.3 From 05d3d1b4815e4bd683b4362b57942563e6902262 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 2 Oct 2018 17:00:17 +0100 Subject: Add LUT textures and optional settings for moisture/ice level to sky settings. --- indra/llinventory/llsettingssky.cpp | 57 +++++++++++++++++++++++++++++++++++++ indra/llinventory/llsettingssky.h | 14 +++++++++ 2 files changed, 71 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 4543f00454..f298a9cbc7 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -126,6 +126,9 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_s const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term"); const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); +const std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level"); +const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); + const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("ff64f04e-097f-40bc-9063-d8d48c308739"); static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver @@ -559,6 +562,12 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f))))); + validation.push_back(Validator(SETTING_SKY_MOISTURE_LEVEL, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + + validation.push_back(Validator(SETTING_SKY_ICE_LEVEL, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); validation.push_back(Validator(SETTING_MIE_CONFIG, true, LLSD::TypeArray, &validateMieLayers)); @@ -675,6 +684,9 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f; dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00045f; + dfltsetting[SETTING_SKY_MOISTURE_LEVEL] = 0.0f; + dfltsetting[SETTING_SKY_ICE_LEVEL] = 0.0f; + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); @@ -953,6 +965,41 @@ F32 LLSettingsSky::getDistanceMultiplier() const return 0.8f; } +void LLSettingsSky::setPlanetRadius(F32 radius) +{ + mSettings[SETTING_PLANET_RADIUS] = radius; +} + +void LLSettingsSky::setSkyBottomRadius(F32 radius) +{ + mSettings[SETTING_SKY_BOTTOM_RADIUS] = radius; +} + +void LLSettingsSky::setSkyTopRadius(F32 radius) +{ + mSettings[SETTING_SKY_TOP_RADIUS] = radius; +} + +void LLSettingsSky::setSunArcRadians(F32 radians) +{ + mSettings[SETTING_SUN_ARC_RADIANS] = radians; +} + +void LLSettingsSky::setMieAnisotropy(F32 aniso_factor) +{ + getMieConfig()[SETTING_MIE_ANISOTROPY_FACTOR] = aniso_factor; +} + +void LLSettingsSky::setSkyMoistureLevel(F32 moisture_level) +{ + mSettings[SETTING_SKY_MOISTURE_LEVEL] = moisture_level; +} + +void LLSettingsSky::setSkyIceLevel(F32 ice_level) +{ + mSettings[SETTING_SKY_ICE_LEVEL] = ice_level; +} + void LLSettingsSky::setBlueDensity(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue(); @@ -1148,6 +1195,16 @@ F32 LLSettingsSky::getPlanetRadius() const return mSettings[SETTING_PLANET_RADIUS].asReal(); } +F32 LLSettingsSky::getSkyMoistureLevel() const +{ + return mSettings[SETTING_SKY_MOISTURE_LEVEL].asReal(); +} + +F32 LLSettingsSky::getSkyIceLevel() const +{ + return mSettings[SETTING_SKY_ICE_LEVEL].asReal(); +} + F32 LLSettingsSky::getSkyBottomRadius() const { return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index a4ea8c98f4..2052908bd3 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -87,6 +87,8 @@ public: static const std::string SETTING_DENSITY_PROFILE_LINEAR_TERM; static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; + static const std::string SETTING_SKY_MOISTURE_LEVEL; + static const std::string SETTING_SKY_ICE_LEVEL; static const std::string SETTING_LEGACY_HAZE; @@ -117,6 +119,9 @@ public: F32 getSunArcRadians() const; F32 getMieAnisotropy() const; + F32 getSkyMoistureLevel() const; + F32 getSkyIceLevel() const; + // Return first (only) profile layer represented in LLSD LLSD getRayleighConfig() const; LLSD getMieConfig() const; @@ -133,6 +138,15 @@ public: void setMieConfigs(const LLSD& mieConfig); void setAbsorptionConfigs(const LLSD& absorptionConfig); + void setPlanetRadius(F32 radius); + void setSkyBottomRadius(F32 radius); + void setSkyTopRadius(F32 radius); + void setSunArcRadians(F32 radians); + void setMieAnisotropy(F32 aniso_factor); + + void setSkyMoistureLevel(F32 moisture_level); + void setSkyIceLevel(F32 ice_level); + //--------------------------------------------------------------------- LLColor3 getAmbientColor() const; void setAmbientColor(const LLColor3 &val); -- cgit v1.2.3 From 5eed233618abd7020e130799be2abe0f986543f6 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 5 Oct 2018 21:32:42 +0100 Subject: SL-1925 More settings for rainbow/halo atmospheric effects, final default asset UUIDs, and shader mods. --- indra/llinventory/llsettingssky.cpp | 56 +++++++++++++++++++++++++++++++++++-- indra/llinventory/llsettingssky.h | 11 ++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f298a9cbc7..21fde72941 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -37,6 +37,8 @@ namespace { const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); + const LLUUID IMG_RAINBOW("12149143-f599-91a7-77ac-b52a3c0f59cd"); + const LLUUID IMG_HALO("11b4c57c-56b3-04ed-1f82-2004363882e4"); } namespace { @@ -80,6 +82,8 @@ const std::string LLSettingsSky::SETTING_HAZE_DENSITY("haze_density"); const std::string LLSettingsSky::SETTING_HAZE_HORIZON("haze_horizon"); const std::string LLSettingsSky::SETTING_BLOOM_TEXTUREID("bloom_id"); +const std::string LLSettingsSky::SETTING_RAINBOW_TEXTUREID("rainbow_id"); +const std::string LLSettingsSky::SETTING_HALO_TEXTUREID("halo_id"); const std::string LLSettingsSky::SETTING_CLOUD_COLOR("cloud_color"); const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY1("cloud_pos_density1"); const std::string LLSettingsSky::SETTING_CLOUD_POS_DENSITY2("cloud_pos_density2"); @@ -127,6 +131,7 @@ const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_ter const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term"); const std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level"); +const std::string LLSettingsSky::SETTING_SKY_DROPLET_RADIUS("droplet_radius"); const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("ff64f04e-097f-40bc-9063-d8d48c308739"); @@ -391,7 +396,9 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : mNextSunTextureId(), mNextMoonTextureId(), mNextCloudTextureId(), - mNextBloomTextureId() + mNextBloomTextureId(), + mNextRainbowTextureId(), + mNextHaloTextureId() { } @@ -400,7 +407,9 @@ LLSettingsSky::LLSettingsSky(): mNextSunTextureId(), mNextMoonTextureId(), mNextCloudTextureId(), - mNextBloomTextureId() + mNextBloomTextureId(), + mNextRainbowTextureId(), + mNextHaloTextureId() { } @@ -411,6 +420,8 @@ void LLSettingsSky::replaceSettings(LLSD settings) mNextMoonTextureId.setNull(); mNextCloudTextureId.setNull(); mNextBloomTextureId.setNull(); + mNextRainbowTextureId.setNull(); + mNextHaloTextureId.setNull(); } void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) @@ -426,6 +437,8 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) mNextMoonTextureId = other->getMoonTextureId(); mNextCloudTextureId = other->getCloudNoiseTextureId(); mNextBloomTextureId = other->getBloomTextureId(); + mNextRainbowTextureId = other->getRainbowTextureId(); + mNextHaloTextureId = other->getHaloTextureId(); } else { @@ -500,6 +513,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_RAINBOW_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_HALO_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), @@ -565,6 +581,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SKY_MOISTURE_LEVEL, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_SKY_DROPLET_RADIUS, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(5.0f)(1000.0f))))); + validation.push_back(Validator(SETTING_SKY_ICE_LEVEL, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); @@ -675,6 +694,8 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId(); dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId(); + dfltsetting[SETTING_RAINBOW_TEXTUREID] = GetDefaultRainbowTextureId(); + dfltsetting[SETTING_HALO_TEXTUREID] = GetDefaultHaloTextureId(); dfltsetting[SETTING_TYPE] = "sky"; @@ -685,6 +706,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00045f; dfltsetting[SETTING_SKY_MOISTURE_LEVEL] = 0.0f; + dfltsetting[SETTING_SKY_DROPLET_RADIUS] = 800.0f; dfltsetting[SETTING_SKY_ICE_LEVEL] = 0.0f; dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); @@ -995,6 +1017,11 @@ void LLSettingsSky::setSkyMoistureLevel(F32 moisture_level) mSettings[SETTING_SKY_MOISTURE_LEVEL] = moisture_level; } +void LLSettingsSky::setSkyDropletRadius(F32 radius) +{ + mSettings[SETTING_SKY_DROPLET_RADIUS] = radius; +} + void LLSettingsSky::setSkyIceLevel(F32 ice_level) { mSettings[SETTING_SKY_ICE_LEVEL] = ice_level; @@ -1190,6 +1217,16 @@ LLUUID LLSettingsSky::GetDefaultBloomTextureId() return IMG_BLOOM1; } +LLUUID LLSettingsSky::GetDefaultRainbowTextureId() +{ + return IMG_RAINBOW; +} + +LLUUID LLSettingsSky::GetDefaultHaloTextureId() +{ + return IMG_HALO; +} + F32 LLSettingsSky::getPlanetRadius() const { return mSettings[SETTING_PLANET_RADIUS].asReal(); @@ -1200,6 +1237,11 @@ F32 LLSettingsSky::getSkyMoistureLevel() const return mSettings[SETTING_SKY_MOISTURE_LEVEL].asReal(); } +F32 LLSettingsSky::getSkyDropletRadius() const +{ + return mSettings[SETTING_SKY_DROPLET_RADIUS].asReal(); +} + F32 LLSettingsSky::getSkyIceLevel() const { return mSettings[SETTING_SKY_ICE_LEVEL].asReal(); @@ -1278,6 +1320,16 @@ LLUUID LLSettingsSky::getBloomTextureId() const return mSettings[SETTING_BLOOM_TEXTUREID].asUUID(); } +LLUUID LLSettingsSky::getRainbowTextureId() const +{ + return mSettings[SETTING_RAINBOW_TEXTUREID].asUUID(); +} + +LLUUID LLSettingsSky::getHaloTextureId() const +{ + return mSettings[SETTING_HALO_TEXTUREID].asUUID(); +} + //--------------------------------------------------------------------- LLColor3 LLSettingsSky::getAmbientColor() const { diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 2052908bd3..fbae6739b8 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -42,6 +42,8 @@ class LLSettingsSky: public LLSettingsBase public: static const std::string SETTING_AMBIENT; static const std::string SETTING_BLOOM_TEXTUREID; + static const std::string SETTING_RAINBOW_TEXTUREID; + static const std::string SETTING_HALO_TEXTUREID; static const std::string SETTING_BLUE_DENSITY; static const std::string SETTING_BLUE_HORIZON; static const std::string SETTING_DENSITY_MULTIPLIER; @@ -88,6 +90,7 @@ public: static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM; static const std::string SETTING_SKY_MOISTURE_LEVEL; + static const std::string SETTING_SKY_DROPLET_RADIUS; static const std::string SETTING_SKY_ICE_LEVEL; static const std::string SETTING_LEGACY_HAZE; @@ -120,6 +123,7 @@ public: F32 getMieAnisotropy() const; F32 getSkyMoistureLevel() const; + F32 getSkyDropletRadius() const; F32 getSkyIceLevel() const; // Return first (only) profile layer represented in LLSD @@ -133,6 +137,8 @@ public: LLSD getAbsorptionConfigs() const; LLUUID getBloomTextureId() const; + LLUUID getRainbowTextureId() const; + LLUUID getHaloTextureId() const; void setRayleighConfigs(const LLSD& rayleighConfig); void setMieConfigs(const LLSD& mieConfig); @@ -145,6 +151,7 @@ public: void setMieAnisotropy(F32 aniso_factor); void setSkyMoistureLevel(F32 moisture_level); + void setSkyDropletRadius(F32 radius); void setSkyIceLevel(F32 ice_level); //--------------------------------------------------------------------- @@ -272,6 +279,8 @@ public: static LLUUID GetDefaultMoonTextureId(); static LLUUID GetDefaultCloudNoiseTextureId(); static LLUUID GetDefaultBloomTextureId(); + static LLUUID GetDefaultRainbowTextureId(); + static LLUUID GetDefaultHaloTextureId(); static LLSD createDensityProfileLayer( F32 width, @@ -326,6 +335,8 @@ private: LLUUID mNextMoonTextureId; LLUUID mNextCloudTextureId; LLUUID mNextBloomTextureId; + LLUUID mNextRainbowTextureId; + LLUUID mNextHaloTextureId; typedef std::map mapNameToUniformId_t; -- cgit v1.2.3 From ffc6393309d06446f9d1361f0f0282b2110768ae Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 8 Oct 2018 22:08:35 +0100 Subject: SL-9751 Add optional moon brightness setting --- indra/llinventory/llsettingssky.cpp | 18 ++++++++++++++++++ indra/llinventory/llsettingssky.h | 5 +++++ 2 files changed, 23 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 21fde72941..dd3a76be31 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -102,6 +102,8 @@ const std::string LLSettingsSky::SETTING_MAX_Y("max_y"); const std::string LLSettingsSky::SETTING_MOON_ROTATION("moon_rotation"); const std::string LLSettingsSky::SETTING_MOON_SCALE("moon_scale"); const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id"); +const std::string LLSettingsSky::SETTING_MOON_BRIGHTNESS("moon_brightness"); + const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness"); const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color"); const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation"); @@ -555,6 +557,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_MOON_SCALE, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_MOON_BRIGHTNESS, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(500.0f))))); validation.push_back(Validator(SETTING_SUNLIGHT_COLOR, true, LLSD::TypeArray, @@ -686,6 +691,9 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); + dfltsetting[SETTING_MOON_BRIGHTNESS] = LLSD::Real(0.5f); + dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(256.0000); dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); @@ -1496,6 +1504,16 @@ void LLSettingsSky::setMoonTextureId(LLUUID id) setValue(SETTING_MOON_TEXTUREID, id); } +F32 LLSettingsSky::getMoonBrightness() const +{ + return mSettings[SETTING_MOON_BRIGHTNESS].asReal(); +} + +void LLSettingsSky::setMoonBrightness(F32 brightness_factor) +{ + setValue(SETTING_MOON_BRIGHTNESS, brightness_factor); +} + F32 LLSettingsSky::getStarBrightness() const { return mSettings[SETTING_STAR_BRIGHTNESS].asReal(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index fbae6739b8..89dd6d20fd 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -66,6 +66,8 @@ public: static const std::string SETTING_MOON_ROTATION; static const std::string SETTING_MOON_SCALE; static const std::string SETTING_MOON_TEXTUREID; + static const std::string SETTING_MOON_BRIGHTNESS; + static const std::string SETTING_STAR_BRIGHTNESS; static const std::string SETTING_SUNLIGHT_COLOR; static const std::string SETTING_SUN_ROTATION; @@ -205,6 +207,9 @@ public: LLUUID getMoonTextureId() const; void setMoonTextureId(LLUUID id); + F32 getMoonBrightness() const; + void setMoonBrightness(F32 brightness_factor); + F32 getStarBrightness() const; void setStarBrightness(F32 val); -- cgit v1.2.3 From f8aac192378462b5824d28808ed84833e2cbfe0f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 9 Oct 2018 18:44:43 +0100 Subject: SL-1289 add cloud_variance control for randomized perturbance of clouds to break up tiling monotony --- indra/llinventory/llsettingssky.cpp | 16 +++++++++++++++- indra/llinventory/llsettingssky.h | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index dd3a76be31..5ef964af04 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -91,6 +91,7 @@ const std::string LLSettingsSky::SETTING_CLOUD_SCALE("cloud_scale"); const std::string LLSettingsSky::SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate"); const std::string LLSettingsSky::SETTING_CLOUD_SHADOW("cloud_shadow"); const std::string LLSettingsSky::SETTING_CLOUD_TEXTUREID("cloud_id"); +const std::string LLSettingsSky::SETTING_CLOUD_VARIANCE("cloud_variance"); const std::string LLSettingsSky::SETTING_DOME_OFFSET("dome_offset"); const std::string LLSettingsSky::SETTING_DOME_RADIUS("dome_radius"); @@ -539,6 +540,8 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); + validation.push_back(Validator(SETTING_CLOUD_VARIANCE, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_DOME_OFFSET, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); @@ -683,7 +686,8 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(0.0f)(0.0f); dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); - + dfltsetting[SETTING_CLOUD_VARIANCE] = LLSD::Real(0.0); + dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f); dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f); dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0); @@ -1431,6 +1435,16 @@ void LLSettingsSky::setCloudShadow(F32 val) setValue(SETTING_CLOUD_SHADOW, val); } +F32 LLSettingsSky::getCloudVariance() const +{ + return mSettings[SETTING_CLOUD_VARIANCE].asReal(); +} + +void LLSettingsSky::setCloudVariance(F32 val) +{ + setValue(SETTING_CLOUD_VARIANCE, val); +} + F32 LLSettingsSky::getDomeOffset() const { //return mSettings[SETTING_DOME_OFFSET].asReal(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 89dd6d20fd..796120ba03 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -57,6 +57,8 @@ public: static const std::string SETTING_CLOUD_SCROLL_RATE; static const std::string SETTING_CLOUD_SHADOW; static const std::string SETTING_CLOUD_TEXTUREID; + static const std::string SETTING_CLOUD_VARIANCE; + static const std::string SETTING_DOME_OFFSET; static const std::string SETTING_DOME_RADIUS; static const std::string SETTING_GAMMA; @@ -184,6 +186,9 @@ public: F32 getCloudShadow() const; void setCloudShadow(F32 val); + F32 getCloudVariance() const; + void setCloudVariance(F32 val); + F32 getDomeOffset() const; F32 getDomeRadius() const; -- cgit v1.2.3 From c0b86245cd9f7e6805158e34423ba7d0d5ef7a04 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 9 Oct 2018 18:46:07 +0100 Subject: Remove redundant set of moon default tex id. --- indra/llinventory/llsettingssky.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 5ef964af04..61e31df663 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -696,7 +696,6 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605); dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); dfltsetting[SETTING_MOON_BRIGHTNESS] = LLSD::Real(0.5f); - dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId(); dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(256.0000); dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); -- cgit v1.2.3 From 79d33f9d19a0c6e5ed34ffbd01a31cb2625e1ecc Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 10 Oct 2018 18:44:03 +0100 Subject: Fix names of WATER_BLUR_MULTIPILER. Give wave direction uniforms more meaningful names in shaders. Add comments on glow size/focus conversions for clarity. --- indra/llinventory/llsettingswater.cpp | 14 +++++++------- indra/llinventory/llsettingswater.h | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 33f824028b..61eb3d6fc0 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -41,7 +41,7 @@ namespace } //========================================================================= -const std::string LLSettingsWater::SETTING_BLUR_MULTIPILER("blur_multiplier"); +const std::string LLSettingsWater::SETTING_BLUR_MULTIPLIER("blur_multiplier"); const std::string LLSettingsWater::SETTING_FOG_COLOR("water_fog_color"); const std::string LLSettingsWater::SETTING_FOG_DENSITY("water_fog_density"); const std::string LLSettingsWater::SETTING_FOG_MOD("underwater_fog_mod"); @@ -55,7 +55,7 @@ const std::string LLSettingsWater::SETTING_SCALE_BELOW("scale_below"); const std::string LLSettingsWater::SETTING_WAVE1_DIR("wave1_direction"); const std::string LLSettingsWater::SETTING_WAVE2_DIR("wave2_direction"); -const std::string LLSettingsWater::SETTING_LEGACY_BLUR_MULTIPILER("blurMultiplier"); +const std::string LLSettingsWater::SETTING_LEGACY_BLUR_MULTIPLIER("blurMultiplier"); const std::string LLSettingsWater::SETTING_LEGACY_FOG_COLOR("waterFogColor"); const std::string LLSettingsWater::SETTING_LEGACY_FOG_DENSITY("waterFogDensity"); const std::string LLSettingsWater::SETTING_LEGACY_FOG_MOD("underWaterFogMod"); @@ -97,7 +97,7 @@ LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position) F32 normal_scale_offset = (position * 0.5f) - 0.25f; // Magic constants copied form defaults.xml - dfltsetting[SETTING_BLUR_MULTIPILER] = LLSD::Real(0.04000f); + dfltsetting[SETTING_BLUR_MULTIPLIER] = LLSD::Real(0.04000f); dfltsetting[SETTING_FOG_COLOR] = LLColor3(0.0156f, 0.1490f, 0.2509f).getValue(); dfltsetting[SETTING_FOG_DENSITY] = LLSD::Real(2.0f); dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f); @@ -121,9 +121,9 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) { LLSD newsettings(defaults()); - if (legacy.has(SETTING_LEGACY_BLUR_MULTIPILER)) + if (legacy.has(SETTING_LEGACY_BLUR_MULTIPLIER)) { - newsettings[SETTING_BLUR_MULTIPILER] = LLSD::Real(legacy[SETTING_LEGACY_BLUR_MULTIPILER].asReal()); + newsettings[SETTING_BLUR_MULTIPLIER] = LLSD::Real(legacy[SETTING_LEGACY_BLUR_MULTIPLIER].asReal()); } if (legacy.has(SETTING_LEGACY_FOG_COLOR)) { @@ -212,14 +212,14 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] - validation.push_back(Validator(SETTING_BLUR_MULTIPILER, true, LLSD::TypeReal, + validation.push_back(Validator(SETTING_BLUR_MULTIPLIER, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-0.5f)(0.5f))))); validation.push_back(Validator(SETTING_FOG_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)(1.0f)), LLSD(LLSDArray(1.0f)(1.0f)(1.0f)(1.0f))))); validation.push_back(Validator(SETTING_FOG_DENSITY, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1.0f)(1024.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-10.0f)(10.0f))))); validation.push_back(Validator(SETTING_FOG_MOD, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1.0f)(1024.0f))))); validation.push_back(Validator(SETTING_FRESNEL_OFFSET, true, LLSD::TypeReal, diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 06ee8e68bc..009a72eb24 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -33,7 +33,7 @@ class LLSettingsWater : public LLSettingsBase { public: - static const std::string SETTING_BLUR_MULTIPILER; + static const std::string SETTING_BLUR_MULTIPLIER; static const std::string SETTING_FOG_COLOR; static const std::string SETTING_FOG_DENSITY; static const std::string SETTING_FOG_MOD; @@ -71,12 +71,12 @@ public: //--------------------------------------------------------------------- F32 getBlurMultiplier() const { - return mSettings[SETTING_BLUR_MULTIPILER].asReal(); + return mSettings[SETTING_BLUR_MULTIPLIER].asReal(); } void setBlurMultiplier(F32 val) { - setValue(SETTING_BLUR_MULTIPILER, val); + setValue(SETTING_BLUR_MULTIPLIER, val); } LLColor3 getWaterFogColor() const @@ -223,7 +223,7 @@ public: static LLUUID GetDefaultOpaqueTextureAssetId(); protected: - static const std::string SETTING_LEGACY_BLUR_MULTIPILER; + static const std::string SETTING_LEGACY_BLUR_MULTIPLIER; static const std::string SETTING_LEGACY_FOG_COLOR; static const std::string SETTING_LEGACY_FOG_DENSITY; static const std::string SETTING_LEGACY_FOG_MOD; -- cgit v1.2.3 From 6cdcc7fe2edcb6c001f2dabf48c87e00d907a4db Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 17 Oct 2018 12:16:24 -0700 Subject: SL-9889: New reconverted default assets --- indra/llinventory/llsettingsdaycycle.cpp | 6 +++--- indra/llinventory/llsettingssky.cpp | 2 +- indra/llinventory/llsettingswater.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index c911ef23c0..ec497b4021 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -106,7 +106,7 @@ const std::string LLSettingsDay::SETTING_KEYHASH("key_hash"); const std::string LLSettingsDay::SETTING_TRACKS("tracks"); const std::string LLSettingsDay::SETTING_FRAMES("frames"); -const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYLENGTH(120); // 2 mins +const LLSettingsDay::Seconds LLSettingsDay::MINIMUM_DAYLENGTH(14400); // 4 hours const LLSettingsDay::Seconds LLSettingsDay::DEFAULT_DAYLENGTH(14400); // 4 hours const LLSettingsDay::Seconds LLSettingsDay::MAXIMUM_DAYLENGTH(604800); // 7 days @@ -121,7 +121,7 @@ const S32 LLSettingsDay::FRAME_MAX(56); const F32 LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR(0.02501f); -const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("94d296c2-6e05-963c-6b62-671199121dbb"); +const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("78751d18-6c51-3c43-2887-3654cd427a42"); // Minimum value to prevent multislider in edit floaters from eating up frames that 'encroach' on one another's space static const F32 DEFAULT_MULTISLIDER_INCREMENT(0.005f); @@ -369,7 +369,7 @@ bool LLSettingsDay::initialize(bool validate_frames) if (total_frame_shift >= 1) { - LL_WARNS() << "Could not fix frame position, adding as is to position: " << keyframe << LL_ENDL; + LL_WARNS("SETTINGS") << "Could not fix frame position, adding as is to position: " << keyframe << LL_ENDL; } else { diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 61e31df663..0ba40e5e3d 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -137,7 +137,7 @@ const std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level"); const std::string LLSettingsSky::SETTING_SKY_DROPLET_RADIUS("droplet_radius"); const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); -const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("ff64f04e-097f-40bc-9063-d8d48c308739"); +const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 61eb3d6fc0..87744453ed 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -68,7 +68,7 @@ const std::string LLSettingsWater::SETTING_LEGACY_SCALE_BELOW("scaleBelow"); const std::string LLSettingsWater::SETTING_LEGACY_WAVE1_DIR("wave1Dir"); const std::string LLSettingsWater::SETTING_LEGACY_WAVE2_DIR("wave2Dir"); -const LLUUID LLSettingsWater::DEFAULT_ASSET_ID("ce4cfe94-700a-292c-7c22-a2d9201bd661"); +const LLUUID LLSettingsWater::DEFAULT_ASSET_ID("59d1a851-47e7-0e5f-1ed7-6b715154f41a"); static const LLUUID DEFAULT_TRANSPARENT_WATER_TEXTURE("2bfd3884-7e27-69b9-ba3a-3e673f680004"); static const LLUUID DEFAULT_OPAQUE_WATER_TEXTURE("43c32285-d658-1793-c123-bf86315de055"); -- cgit v1.2.3 From 3447621a15c14a6a23a9827cfbb2e244ce91e8c0 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 18 Oct 2018 21:18:40 +0100 Subject: Port sim-side changes to back-conversion of new settings to legacy. Fix validating of density multiplier to clamp >= 0.0001f. Port fix to setter for ambient color in sky settings. --- indra/llinventory/llsettingssky.cpp | 41 ++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 61e31df663..0093d84cef 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -510,9 +510,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(2.0f))))); validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1000.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(1000.0f))))); validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); @@ -870,7 +870,7 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) // original WL moon dir was diametrically opposed to the sun dir LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude); - newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); + newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); } @@ -943,6 +943,19 @@ LLVector3 LLSettingsSky::getLightDirection() const return LLVector3::z_axis; } +LLColor3 LLSettingsSky::getAmbientColor() const +{ + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + { + return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT]); + } + if (mSettings.has(SETTING_AMBIENT)) + { + return LLColor3(mSettings[SETTING_AMBIENT]); + } + return LLColor3(0.25f, 0.25f, 0.25f); +} + LLColor3 LLSettingsSky::getBlueDensity() const { if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY)) @@ -1025,17 +1038,23 @@ void LLSettingsSky::setMieAnisotropy(F32 aniso_factor) void LLSettingsSky::setSkyMoistureLevel(F32 moisture_level) { - mSettings[SETTING_SKY_MOISTURE_LEVEL] = moisture_level; + setValue(SETTING_SKY_MOISTURE_LEVEL, moisture_level); } void LLSettingsSky::setSkyDropletRadius(F32 radius) { - mSettings[SETTING_SKY_DROPLET_RADIUS] = radius; + setValue(SETTING_SKY_DROPLET_RADIUS,radius); } void LLSettingsSky::setSkyIceLevel(F32 ice_level) { - mSettings[SETTING_SKY_ICE_LEVEL] = ice_level; + setValue(SETTING_SKY_ICE_LEVEL, ice_level); +} + +void LLSettingsSky::setAmbientColor(const LLColor3 &val) +{ + mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT] = val.getValue(); + setDirtyFlag(true); } void LLSettingsSky::setBlueDensity(const LLColor3 &val) @@ -1342,16 +1361,6 @@ LLUUID LLSettingsSky::getHaloTextureId() const } //--------------------------------------------------------------------- -LLColor3 LLSettingsSky::getAmbientColor() const -{ - return LLColor3(mSettings[SETTING_AMBIENT]); -} - -void LLSettingsSky::setAmbientColor(const LLColor3 &val) -{ - setValue(SETTING_AMBIENT, val); -} - LLColor3 LLSettingsSky::getCloudColor() const { return LLColor3(mSettings[SETTING_CLOUD_COLOR]); -- cgit v1.2.3 From 659d14504f6ab4ad283efe4ecd950a4483e1498f Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 29 Oct 2018 18:18:20 +0200 Subject: SL-1476 EEP Better shader resets and transitions --- indra/llinventory/llsettingsbase.cpp | 192 +++++++++++++++++++++------------- indra/llinventory/llsettingsbase.h | 26 ++++- indra/llinventory/llsettingssky.cpp | 10 +- indra/llinventory/llsettingswater.cpp | 2 +- 4 files changed, 154 insertions(+), 76 deletions(-) (limited to 'indra/llinventory') 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 @@ -263,6 +215,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()) @@ -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 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 parammapping_t; typedef PTR_NAMESPACE::shared_ptr 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 e2fd681039..14318a2a26 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -434,7 +434,14 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(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(); @@ -945,6 +952,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(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(); -- cgit v1.2.3 From 536799d07e4298ff8157ef51ed00040e10a5ba65 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 29 Oct 2018 23:02:20 +0100 Subject: SL-9977 SL-9973 --- indra/llinventory/llsettingssky.cpp | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e2fd681039..8a1e74d7ea 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -156,14 +156,18 @@ LLSettingsSky::validation_list_t legacyHazeValidationList() static LLSettingsBase::validation_list_t legacyHazeValidation; if (legacyHazeValidation.empty()) { + legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_AMBIENT, false, LLSD::TypeArray, + boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, + LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_DENSITY, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_HORIZON, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); + LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, false, LLSD::TypeReal, boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, false, LLSD::TypeReal, @@ -493,28 +497,6 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() // copy constructor for LLSDArray. Directly binding the LLSDArray as // a parameter without first wrapping it in a pure LLSD object will result // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] - validation.push_back(Validator(SETTING_BLUE_DENSITY, false, LLSD::TypeArray, - boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - validation.push_back(Validator(SETTING_BLUE_HORIZON, false, LLSD::TypeArray, - boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(2.0f)(2.0f)(2.0f)("*"))))); - validation.push_back(Validator(SETTING_HAZE_DENSITY, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); - validation.push_back(Validator(SETTING_HAZE_HORIZON, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); - validation.push_back(Validator(SETTING_AMBIENT, false, LLSD::TypeArray, - boost::bind(&Validator::verifyVectorMinMax, _1, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); - validation.push_back(Validator(SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(2.0f))))); - validation.push_back(Validator(SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(1000.0f))))); - - validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_RAINBOW_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_HALO_TEXTUREID, false, LLSD::TypeUUID)); @@ -921,9 +903,6 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; if (mMoonDirection.lengthSquared() < 0.01f) LL_WARNS("SETTINGS") << "Zero length moon direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; - - llassert(mSunDirection.lengthSquared() > 0.01f); - llassert(mMoonDirection.lengthSquared() > 0.01f); } LLVector3 LLSettingsSky::getLightDirection() const -- cgit v1.2.3 From 86419eb11be50bf75c9049a80e422d7704dd7d30 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 30 Oct 2018 01:14:21 +0200 Subject: SL-1476 EEP Better shader transitions --- indra/llinventory/llsettingsbase.cpp | 5 +++++ indra/llinventory/llsettingssky.cpp | 22 ++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 80680948b5..4b8be04355 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -230,6 +230,11 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c // Blend against default value newSettings[key_name] = interpolateSDValue(key_name, def_iter->second.getDefaultValue(), (*it).second, defaults, mix, 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); + } // else do nothing when no known defaults // TODO: Should I blend this out instead? } diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cf6bc45080..088c183f70 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -438,11 +438,25 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast(end); if (other) { - if (!mSettings.has(SETTING_LEGACY_HAZE) && !mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + if (other->mSettings.has(SETTING_LEGACY_HAZE)) { - // Special case since SETTING_AMBIENT is both in outer and legacy maps, we prioritize legacy one - // see getAmbientColor() - setAmbientColor(getAmbientColor()); + 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(), we are about to replaceSettings(), so we are free to set it + setAmbientColor(getAmbientColor()); + } + } + else + { + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[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); + } } LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf); -- cgit v1.2.3 From 64db1f48206ead083661a3f9df93bff9b37074a8 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 1 Nov 2018 18:17:43 +0200 Subject: SL-9793 EEP Clouds vanish and reappear abruptly if one of textures is not set --- indra/llinventory/llsettingssky.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 088c183f70..9d839e88d0 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -459,11 +459,35 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) } } + LLUUID cloud_noise_id = getCloudNoiseTextureId(); + LLUUID cloud_noise_id_next = other->getCloudNoiseTextureId(); + F64 cloud_shadow = 0; + if (!cloud_noise_id.isNull() && cloud_noise_id_next.isNull()) + { + // 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(mSettings[SETTING_CLOUD_SHADOW].asReal(), (F64)0.f, 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((F64)0.f, other->mSettings[SETTING_CLOUD_SHADOW].asReal(), blendf); + setCloudNoiseTextureId(cloud_noise_id_next); + } + else + { + cloud_shadow = lerp(mSettings[SETTING_CLOUD_SHADOW].asReal(), other->mSettings[SETTING_CLOUD_SHADOW].asReal(), blendf); + } + LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf); + blenddata[SETTING_CLOUD_SHADOW] = LLSD::Real(cloud_shadow); replaceSettings(blenddata); mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); - mNextCloudTextureId = other->getCloudNoiseTextureId(); + mNextCloudTextureId = cloud_noise_id_next; mNextBloomTextureId = other->getBloomTextureId(); mNextRainbowTextureId = other->getRainbowTextureId(); mNextHaloTextureId = other->getHaloTextureId(); @@ -486,6 +510,7 @@ LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const skipSet.insert(SETTING_RAYLEIGH_CONFIG); skipSet.insert(SETTING_MIE_CONFIG); skipSet.insert(SETTING_ABSORPTION_CONFIG); + skipSet.insert(SETTING_CLOUD_SHADOW); } return skipSet; -- cgit v1.2.3 From fb335cc243581925bb772a1f10112ec493db8552 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 1 Nov 2018 18:26:24 +0100 Subject: SL-10000 fix storing of ambient value when converting legacy settings --- indra/llinventory/llsettingssky.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cf6bc45080..aff8bec1cd 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -169,13 +169,13 @@ LLSettingsSky::validation_list_t legacyHazeValidationList() LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(4.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(5.0f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(0.9f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(2.0f))))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(100.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0001f)(1000.0f))))); } return legacyHazeValidation; } @@ -724,6 +724,10 @@ LLSD LLSettingsSky::translateLegacyHazeSettings(const LLSD& legacy) // AdvancedAtmospherics TODO // These need to be translated into density profile info in the new settings format... // LEGACY_ATMOSPHERICS + if (legacy.has(SETTING_AMBIENT)) + { + legacyhazesettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); + } if (legacy.has(SETTING_BLUE_DENSITY)) { legacyhazesettings[SETTING_BLUE_DENSITY] = LLColor3(legacy[SETTING_BLUE_DENSITY]).getValue(); @@ -765,10 +769,6 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) newsettings[SETTING_LEGACY_HAZE] = legacyhazesettings; } - if (legacy.has(SETTING_AMBIENT)) - { - newsettings[SETTING_AMBIENT] = LLColor3(legacy[SETTING_AMBIENT]).getValue(); - } if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); -- cgit v1.2.3 From c3ac4650ad825966d587c06ce9787d9ab181dac6 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 2 Nov 2018 17:23:30 +0200 Subject: SL-9870 EEP Water texture doesn't apply to observer --- indra/llinventory/llsettingsbase.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 4b8be04355..7917fa96f1 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -688,6 +688,7 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ return blendf; } mTarget->blend(mFinal, blendf); + mTarget->update(); } else { @@ -702,6 +703,7 @@ void LLSettingsBlender::triggerComplete() if (mTarget) mTarget->replaceSettings(mFinal->getSettings()); LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon + mTarget->update(); mOnFinished(shared_from_this()); } -- cgit v1.2.3 From 77b278b7f5615a6ba93b47c2a0d8a2338dc27dc2 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 12 Nov 2018 16:41:40 +0200 Subject: SL-9620 Viewer crashes after clicking "Commit" button while editing Day Cycle preset --- indra/llinventory/llparcel.cpp | 2 +- indra/llinventory/llparcel.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index aff7f86fd4..e2469f3c7e 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -233,7 +233,7 @@ void LLParcel::init(const LLUUID &owner_id, setHaveNewParcelLimitData(FALSE); setRegionAllowEnvironmentOverride(FALSE); - setParcelEnvironmentVersion(-1); + setParcelEnvironmentVersion(INVALID_PARCEL_ENVIRONMENT_VERSION); } void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned) diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 2497a069d7..9ece9b58e5 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -102,6 +102,7 @@ const U32 RT_LIST = 0x1 << 4; const U32 RT_SELL = 0x1 << 5; const S32 INVALID_PARCEL_ID = -1; +const S32 INVALID_PARCEL_ENVIRONMENT_VERSION = -1; // Timeouts for parcels // default is 21 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 1814400000000 -- cgit v1.2.3 From dd6167ae8d652e32d1c3849631dd8c0022032f79 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 14 Nov 2018 14:01:50 +0200 Subject: SL-10061 FIXED [EEP] Parcel Environment settings can't be changed when Region settings are used --- indra/llinventory/llparcel.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 9ece9b58e5..067391b5a1 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -102,7 +102,9 @@ const U32 RT_LIST = 0x1 << 4; const U32 RT_SELL = 0x1 << 5; const S32 INVALID_PARCEL_ID = -1; -const S32 INVALID_PARCEL_ENVIRONMENT_VERSION = -1; + +// if Region settings are used, parcel env. version is -1 +const S32 INVALID_PARCEL_ENVIRONMENT_VERSION = -2; // Timeouts for parcels // default is 21 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 1814400000000 -- cgit v1.2.3 From 655e1d190044d3d4466589eeab5e6eb867fb08c0 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 19 Nov 2018 15:59:00 +0200 Subject: SL-10086 FIXED [EEP] Rainbow and Halo use wrong textures --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f21cca34a6..ace530ae54 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -37,8 +37,8 @@ namespace { const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); - const LLUUID IMG_RAINBOW("12149143-f599-91a7-77ac-b52a3c0f59cd"); - const LLUUID IMG_HALO("11b4c57c-56b3-04ed-1f82-2004363882e4"); + const LLUUID IMG_RAINBOW("11b4c57c-56b3-04ed-1f82-2004363882e4"); + const LLUUID IMG_HALO("12149143-f599-91a7-77ac-b52a3c0f59cd"); } namespace { -- cgit v1.2.3 From 62720cf5dd5c11eaf08e90ce281d6d084ae017f0 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 21 Nov 2018 19:04:28 +0200 Subject: SL-9661 Settings applied from inventory don't update about land floater. --- indra/llinventory/llparcel.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 067391b5a1..3b39aeb56b 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -103,8 +103,9 @@ const U32 RT_SELL = 0x1 << 5; const S32 INVALID_PARCEL_ID = -1; -// if Region settings are used, parcel env. version is -1 const S32 INVALID_PARCEL_ENVIRONMENT_VERSION = -2; +// if Region settings are used, parcel env. version is -1 +const S32 UNSET_PARCEL_ENVIRONMENT_VERSION = -1; // Timeouts for parcels // default is 21 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 1814400000000 -- cgit v1.2.3 From b6fa72d3c4d02527f6d118eadc9ba1ac48a297f5 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 3 Dec 2018 15:33:15 -0800 Subject: SL-10055 Modify handling of directional light to prefer sun when it is up but use moon dir/color when it is alone in the sky. Modify handling of shader in shaders to get some shadowing of ambient and nighttime shadowing. --- indra/llinventory/llsettingssky.cpp | 17 +++++++++++++++++ indra/llinventory/llsettingssky.h | 2 ++ 2 files changed, 19 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ace530ae54..bd40760193 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -968,6 +968,23 @@ LLVector3 LLSettingsSky::getLightDirection() const return LLVector3::z_axis; } +LLColor3 LLSettingsSky::getLightDiffuse() const +{ + update(); + + // is the normal from the sun or the moon + if (getIsSunUp()) + { + return getSunDiffuse(); + } + else if (getIsMoonUp()) + { + return getMoonDiffuse(); + } + + return LLColor3::white; +} + LLColor3 LLSettingsSky::getAmbientColor() const { // Todo: this causes complications, preferably to get rid of this duality diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 796120ba03..bac8b52e65 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -272,6 +272,8 @@ public: bool getIsMoonUp() const; LLVector3 getLightDirection() const; + LLColor3 getLightDiffuse() const; + LLVector3 getSunDirection() const; LLVector3 getMoonDirection() const; LLColor4U getFadeColor() const; -- cgit v1.2.3 From 70ac8d9fa7049891ed1b65f68f112127dfb5f5f7 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 12 Dec 2018 14:07:23 -0800 Subject: SL-10238: Viewer spport for push notifications from the simulator contaiting partial groups of settings. Blend these settings into the current environment. --- indra/llinventory/llsettingsbase.cpp | 44 ++++++++++++++++++++------------ indra/llinventory/llsettingsbase.h | 19 ++++++++++---- indra/llinventory/llsettingsdaycycle.cpp | 1 - indra/llinventory/llsettingssky.cpp | 12 +++++++++ indra/llinventory/llsettingssky.h | 1 + indra/llinventory/llsettingswater.cpp | 8 ++++++ indra/llinventory/llsettingswater.h | 1 + 7 files changed, 64 insertions(+), 22 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7917fa96f1..5adb787048 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -60,6 +60,8 @@ const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0); const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1); const U32 LLSettingsBase::FLAG_NOTRANS(0x01 << 2); +const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0); + //========================================================================= LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), @@ -385,7 +387,7 @@ bool LLSettingsBase::validate() return result["success"].asBoolean(); } -LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &validations) +LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &validations, bool partial) { static Validator validateName(SETTING_NAME, false, LLSD::TypeString, boost::bind(&Validator::verifyStringLength, _1, 32)); static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); @@ -398,44 +400,48 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida bool isValid(true); LLSD errors(LLSD::emptyArray()); LLSD warnings(LLSD::emptyArray()); + U32 flags(0); + + if (partial) + flags |= Validator::VALIDATION_PARTIAL; // Fields common to all settings. - if (!validateName.verify(settings)) + if (!validateName.verify(settings, flags)) { errors.append( LLSD::String("Unable to validate 'name'.") ); isValid = false; } validated.insert(validateName.getName()); - if (!validateId.verify(settings)) + if (!validateId.verify(settings, flags)) { errors.append( LLSD::String("Unable to validate 'id'.") ); isValid = false; } validated.insert(validateId.getName()); - if (!validateHash.verify(settings)) + if (!validateHash.verify(settings, flags)) { errors.append( LLSD::String("Unable to validate 'hash'.") ); isValid = false; } validated.insert(validateHash.getName()); - if (!validateAssetId.verify(settings)) + if (!validateAssetId.verify(settings, flags)) { errors.append(LLSD::String("Invalid asset Id")); isValid = false; } validated.insert(validateAssetId.getName()); - if (!validateType.verify(settings)) + if (!validateType.verify(settings, flags)) { errors.append( LLSD::String("Unable to validate 'type'.") ); isValid = false; } validated.insert(validateType.getName()); - if (!validateFlags.verify(settings)) + if (!validateFlags.verify(settings, flags)) { errors.append(LLSD::String("Unable to validate 'flags'.")); isValid = false; @@ -453,7 +459,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } #endif - if (!(*itv).verify(settings)) + if (!(*itv).verify(settings, flags)) { std::stringstream errtext; @@ -498,10 +504,14 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida } //========================================================================= -bool LLSettingsBase::Validator::verify(LLSD &data) + +bool LLSettingsBase::Validator::verify(LLSD &data, U32 flags) { if (!data.has(mName) || (data.has(mName) && data[mName].isUndefined())) { + if ((flags & VALIDATION_PARTIAL) != 0) // we are doing a partial validation. Do no attempt to set a default if missing (or fail even if required) + return true; + if (!mDefault.isUndefined()) { data[mName] = mDefault; @@ -667,7 +677,10 @@ bool LLSettingsBase::Validator::verifyStringLength(LLSD &value, S32 length) //========================================================================= void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { - setBlendFactor(blendf); + F64 res = setBlendFactor(blendf); + + if ((res >= 0.0001) && (res < 1.0)) + mTarget->update(); } F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_in) @@ -688,7 +701,6 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ return blendf; } mTarget->blend(mFinal, blendf); - mTarget->update(); } else { @@ -715,7 +727,7 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen); } -void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) +bool LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { mTimeSpent += timedelta; mTimeDeltaPassed += timedelta; @@ -724,12 +736,12 @@ void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& t { mIgnoreTimeDelta = false; triggerComplete(); - return; + return false; } if ((mTimeDeltaPassed < mTimeDeltaThreshold) && (!mIgnoreTimeDelta)) { - return; + return false; } LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); @@ -737,10 +749,10 @@ void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& t if (fabs(mLastBlendF - blendf) < mBlendFMinDelta) { - return; + return false; } mLastBlendF = blendf; - update(blendf); + return true; } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index c7b685c6d5..87466e6570 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -266,6 +266,8 @@ public: class Validator { public: + static const U32 VALIDATION_PARTIAL; + typedef boost::function verify_pr; Validator(std::string name, bool required, LLSD::Type type, verify_pr verify = verify_pr(), LLSD defval = LLSD()) : @@ -280,7 +282,7 @@ public: bool isRequired() const { return mRequired; } LLSD::Type getType() const { return mType; } - bool verify(LLSD &data); + bool verify(LLSD &data, U32 flags); // Some basic verifications static bool verifyColor(LLSD &value); @@ -302,7 +304,7 @@ public: }; typedef std::vector validation_list_t; - static LLSD settingValidation(LLSD &settings, validation_list_t &validations); + static LLSD settingValidation(LLSD &settings, validation_list_t &validations, bool partial = false); inline void setAssetId(LLUUID value) { // note that this skips setLLSD @@ -346,7 +348,7 @@ protected: virtual stringset_t getSlerpKeys() const { return stringset_t(); } // Calculate any custom settings that may need to be cached. - virtual void updateSettings() { mDirty = false; mReplaced = false; }; + virtual void updateSettings() { mDirty = false; mReplaced = false; } virtual validation_list_t getValidationList() const = 0; @@ -366,6 +368,12 @@ protected: mBlendedFactor = blendfactor; } + void replaceWith(LLSettingsBase::ptr_t other) + { + replaceSettings(other->cloneSettings()); + setBlendFactor(other->getBlendFactor()); + } + private: bool mDirty; bool mReplaced; // super dirty! @@ -437,10 +445,11 @@ public: } virtual void update(const LLSettingsBase::BlendFactor& blendf); - virtual void applyTimeDelta(const LLSettingsBase::Seconds& delta) + virtual bool applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { llassert(false); // your derived class needs to implement an override of this func + return false; } virtual F64 setBlendFactor(const LLSettingsBase::BlendFactor& position); @@ -495,7 +504,7 @@ public: mLastBlendF = LLSettingsBase::BlendFactor(-1.0f); } - virtual void applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE; + virtual bool applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE; inline void setTimeDeltaThreshold(const LLSettingsBase::Seconds time) { diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index ec497b4021..188e205176 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -203,7 +203,6 @@ bool LLSettingsDay::initialize(bool validate_frames) if (mSettings.has(SETTING_ASSETID)) { assetid = mSettings[SETTING_ASSETID].asUUID(); - LL_WARNS("LAPRAS") << "initializing daycycle with asset id " << assetid << LL_ENDL; } std::map used; diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index ace530ae54..37882b91ec 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -431,6 +431,18 @@ void LLSettingsSky::replaceSettings(LLSD settings) mNextHaloTextureId.setNull(); } +void LLSettingsSky::replaceWithSky(LLSettingsSky::ptr_t pother) +{ + replaceWith(pother); + + mNextSunTextureId = pother->mNextSunTextureId; + mNextMoonTextureId = pother->mNextMoonTextureId; + mNextCloudTextureId = pother->mNextCloudTextureId; + mNextBloomTextureId = pother->mNextBloomTextureId; + mNextRainbowTextureId = pother->mNextRainbowTextureId; + mNextHaloTextureId = pother->mNextHaloTextureId; +} + void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) { llassert(getSettingsType() == end->getSettingsType()); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 796120ba03..dc652dc182 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -118,6 +118,7 @@ public: virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE; + void replaceWithSky(LLSettingsSky::ptr_t pother); static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f); F32 getPlanetRadius() const; diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 7cfff954a0..1780948f0a 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -197,6 +197,14 @@ void LLSettingsWater::replaceSettings(LLSD settings) mNextTransparentTextureID.setNull(); } +void LLSettingsWater::replaceWithWater(LLSettingsWater::ptr_t other) +{ + replaceWith(other); + + mNextNormalMapID = other->mNextNormalMapID; + mNextTransparentTextureID = other->mNextTransparentTextureID; +} + LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const { return LLSettingsWater::validationList(); diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 009a72eb24..118c515743 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -65,6 +65,7 @@ public: virtual void blend(const 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); -- cgit v1.2.3 From 07bff3129adaabb90f09b71fa65c8be0c3ecef5d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 19 Dec 2018 14:59:19 -0800 Subject: Add new shaders for advanced atmo SH env lighting calcs. --- indra/llinventory/llsettingssky.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 231077c217..fb7f5e5c1c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -999,7 +999,6 @@ LLColor3 LLSettingsSky::getLightDiffuse() 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]); -- cgit v1.2.3 From 1871f03d12e7a8e388d188f87e612117bcda75c1 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 7 Jan 2019 17:00:01 -0800 Subject: SL-10067, SL-9917: Updated UUIDs for sun and moon textures and to corrected known skies. --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 231077c217..471f15e829 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -139,8 +139,8 @@ const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); -static const LLUUID DEFAULT_SUN_ID("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver -static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver +static const LLUUID DEFAULT_SUN_ID("0ed03550-9096-3c5a-27d8-c6496bff1064"); // dataserver +static const LLUUID DEFAULT_MOON_ID("db13b827-7e6a-7ace-bed4-4419ee00984d"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); -- cgit v1.2.3 From 38c84545cc8c2c3704402d009d9bce253aa77939 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 15 Jan 2019 14:40:36 -0800 Subject: SL-9917: New default sun texture, blank moon is now no image. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 12b33142e3..e8dcba516e 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -139,7 +139,7 @@ const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); -static const LLUUID DEFAULT_SUN_ID("0ed03550-9096-3c5a-27d8-c6496bff1064"); // dataserver +static const LLUUID DEFAULT_SUN_ID("8ae0acc4-9e87-7f25-e16e-2a6caa5b8fc3"); // dataserver static const LLUUID DEFAULT_MOON_ID("db13b827-7e6a-7ace-bed4-4419ee00984d"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); -- cgit v1.2.3 From f42ac5b94e384c789de0b2c4e865b087589a940e Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 22 Jan 2019 09:24:11 -0800 Subject: SL-10387: Move settings intjection to a setting object (and out of llEnvironment) --- indra/llinventory/llsettingsbase.h | 5 ++--- indra/llinventory/llsettingssky.cpp | 2 +- indra/llinventory/llsettingssky.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 87466e6570..9e03052892 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -317,6 +317,8 @@ public: mSettings.erase(SETTING_ASSETID); } + // Calculate any custom settings that may need to be cached. + virtual void updateSettings() { mDirty = false; mReplaced = false; } protected: LLSettingsBase(); @@ -347,9 +349,6 @@ protected: // rather than lerped. virtual stringset_t getSlerpKeys() const { return stringset_t(); } - // Calculate any custom settings that may need to be cached. - virtual void updateSettings() { mDirty = false; mReplaced = false; } - virtual validation_list_t getValidationList() const = 0; // Apply any settings that need special handling. diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e8dcba516e..86c8393499 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -139,7 +139,7 @@ const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); -static const LLUUID DEFAULT_SUN_ID("8ae0acc4-9e87-7f25-e16e-2a6caa5b8fc3"); // dataserver +static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver static const LLUUID DEFAULT_MOON_ID("db13b827-7e6a-7ace-bed4-4419ee00984d"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 4d0d4268b2..a09dcd2008 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -311,6 +311,7 @@ public: F32 constant_term, F32 aniso_factor = 0.0f); + virtual void updateSettings() SETTINGS_OVERRIDE; protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -320,7 +321,6 @@ protected: virtual stringset_t getSlerpKeys() const SETTINGS_OVERRIDE; virtual stringset_t getSkipInterpolateKeys() const SETTINGS_OVERRIDE; - virtual void updateSettings() SETTINGS_OVERRIDE; private: static LLSD rayleighConfigDefault(); -- cgit v1.2.3 From b465a5bf6f4f63026ff66bfee4671584c47c4119 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 22 Jan 2019 16:53:14 -0800 Subject: SL-10387: Inject individual settings. Still freezes parcel/region settings. --- indra/llinventory/llsettingssky.h | 16 ++++++++-------- indra/llinventory/llsettingswater.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index a09dcd2008..e82ab8db0c 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -115,7 +115,7 @@ public: // Settings status virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; - + virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE; void replaceWithSky(LLSettingsSky::ptr_t pother); @@ -322,6 +322,13 @@ protected: virtual stringset_t getSlerpKeys() const SETTINGS_OVERRIDE; virtual stringset_t getSkipInterpolateKeys() const SETTINGS_OVERRIDE; + LLUUID mNextSunTextureId; + LLUUID mNextMoonTextureId; + LLUUID mNextCloudTextureId; + LLUUID mNextBloomTextureId; + LLUUID mNextRainbowTextureId; + LLUUID mNextHaloTextureId; + private: static LLSD rayleighConfigDefault(); static LLSD absorptionConfigDefault(); @@ -344,13 +351,6 @@ private: mutable LLColor3 mSunDiffuse; mutable LLColor4 mTotalAmbient; - LLUUID mNextSunTextureId; - LLUUID mNextMoonTextureId; - LLUUID mNextCloudTextureId; - LLUUID mNextBloomTextureId; - LLUUID mNextRainbowTextureId; - LLUUID mNextHaloTextureId; - typedef std::map mapNameToUniformId_t; static mapNameToUniformId_t sNameToUniformMapping; diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 118c515743..9998f64fd6 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -239,9 +239,9 @@ protected: LLSettingsWater(); -private: LLUUID mNextTransparentTextureID; LLUUID mNextNormalMapID; + }; #endif -- cgit v1.2.3 From c7e02b0835cbb50777c677f618c4a957e69fabee Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 30 Jan 2019 14:36:46 -0800 Subject: SL-9925: Viewer now shows an error message if import from legacy windlight fails. --- indra/llinventory/llsettingssky.cpp | 21 +++++++++++++++++++++ indra/llinventory/llsettingswater.cpp | 15 +++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 86c8393499..f3519dc7cb 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -809,6 +809,7 @@ LLSD LLSettingsSky::translateLegacyHazeSettings(const LLSD& legacy) LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) { + bool converted_something(false); LLSD newsettings(defaults()); // Move legacy haze parameters to an inner map @@ -818,23 +819,28 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) if (legacyhazesettings.size() > 0) { newsettings[SETTING_LEGACY_HAZE] = legacyhazesettings; + converted_something |= true; } if (legacy.has(SETTING_CLOUD_COLOR)) { newsettings[SETTING_CLOUD_COLOR] = LLColor3(legacy[SETTING_CLOUD_COLOR]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_POS_DENSITY1)) { newsettings[SETTING_CLOUD_POS_DENSITY1] = LLColor3(legacy[SETTING_CLOUD_POS_DENSITY1]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_POS_DENSITY2)) { newsettings[SETTING_CLOUD_POS_DENSITY2] = LLColor3(legacy[SETTING_CLOUD_POS_DENSITY2]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_SCALE)) { newsettings[SETTING_CLOUD_SCALE] = LLSD::Real(legacy[SETTING_CLOUD_SCALE][0].asReal()); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_SCROLL_RATE)) { @@ -851,53 +857,64 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) } newsettings[SETTING_CLOUD_SCROLL_RATE] = cloud_scroll.getValue(); + converted_something |= true; } if (legacy.has(SETTING_CLOUD_SHADOW)) { newsettings[SETTING_CLOUD_SHADOW] = LLSD::Real(legacy[SETTING_CLOUD_SHADOW][0].asReal()); + converted_something |= true; } if (legacy.has(SETTING_GAMMA)) { newsettings[SETTING_GAMMA] = legacy[SETTING_GAMMA][0].asReal(); + converted_something |= true; } if (legacy.has(SETTING_GLOW)) { newsettings[SETTING_GLOW] = LLColor3(legacy[SETTING_GLOW]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_MAX_Y)) { newsettings[SETTING_MAX_Y] = LLSD::Real(legacy[SETTING_MAX_Y][0].asReal()); + converted_something |= true; } if (legacy.has(SETTING_STAR_BRIGHTNESS)) { newsettings[SETTING_STAR_BRIGHTNESS] = LLSD::Real(legacy[SETTING_STAR_BRIGHTNESS].asReal() * 250.0f); + converted_something |= true; } if (legacy.has(SETTING_SUNLIGHT_COLOR)) { newsettings[SETTING_SUNLIGHT_COLOR] = LLColor4(legacy[SETTING_SUNLIGHT_COLOR]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_PLANET_RADIUS)) { newsettings[SETTING_PLANET_RADIUS] = LLSD::Real(legacy[SETTING_PLANET_RADIUS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_SKY_BOTTOM_RADIUS)) { newsettings[SETTING_SKY_BOTTOM_RADIUS] = LLSD::Real(legacy[SETTING_SKY_BOTTOM_RADIUS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_SKY_TOP_RADIUS)) { newsettings[SETTING_SKY_TOP_RADIUS] = LLSD::Real(legacy[SETTING_SKY_TOP_RADIUS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_SUN_ARC_RADIANS)) { newsettings[SETTING_SUN_ARC_RADIANS] = LLSD::Real(legacy[SETTING_SUN_ARC_RADIANS].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE)) @@ -912,8 +929,12 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy) newsettings[SETTING_SUN_ROTATION] = sunquat.getValue(); newsettings[SETTING_MOON_ROTATION] = moonquat.getValue(); + converted_something |= true; } + if (!converted_something) + return LLSD(); + return newsettings; } diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 1780948f0a..d160a4ae0e 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -119,57 +119,72 @@ LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position) LLSD LLSettingsWater::translateLegacySettings(LLSD legacy) { + bool converted_something(false); LLSD newsettings(defaults()); if (legacy.has(SETTING_LEGACY_BLUR_MULTIPLIER)) { newsettings[SETTING_BLUR_MULTIPLIER] = LLSD::Real(legacy[SETTING_LEGACY_BLUR_MULTIPLIER].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_FOG_COLOR)) { newsettings[SETTING_FOG_COLOR] = LLColor3(legacy[SETTING_LEGACY_FOG_COLOR]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_FOG_DENSITY)) { newsettings[SETTING_FOG_DENSITY] = LLSD::Real(legacy[SETTING_LEGACY_FOG_DENSITY]); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_FOG_MOD)) { newsettings[SETTING_FOG_MOD] = LLSD::Real(legacy[SETTING_LEGACY_FOG_MOD].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_FRESNEL_OFFSET)) { newsettings[SETTING_FRESNEL_OFFSET] = LLSD::Real(legacy[SETTING_LEGACY_FRESNEL_OFFSET].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_FRESNEL_SCALE)) { newsettings[SETTING_FRESNEL_SCALE] = LLSD::Real(legacy[SETTING_LEGACY_FRESNEL_SCALE].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_NORMAL_MAP)) { newsettings[SETTING_NORMAL_MAP] = LLSD::UUID(legacy[SETTING_LEGACY_NORMAL_MAP].asUUID()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_NORMAL_SCALE)) { newsettings[SETTING_NORMAL_SCALE] = LLVector3(legacy[SETTING_LEGACY_NORMAL_SCALE]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_SCALE_ABOVE)) { newsettings[SETTING_SCALE_ABOVE] = LLSD::Real(legacy[SETTING_LEGACY_SCALE_ABOVE].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_SCALE_BELOW)) { newsettings[SETTING_SCALE_BELOW] = LLSD::Real(legacy[SETTING_LEGACY_SCALE_BELOW].asReal()); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_WAVE1_DIR)) { newsettings[SETTING_WAVE1_DIR] = LLVector2(legacy[SETTING_LEGACY_WAVE1_DIR]).getValue(); + converted_something |= true; } if (legacy.has(SETTING_LEGACY_WAVE2_DIR)) { newsettings[SETTING_WAVE2_DIR] = LLVector2(legacy[SETTING_LEGACY_WAVE2_DIR]).getValue(); + converted_something |= true; } + if (!converted_something) + return LLSD(); return newsettings; } -- cgit v1.2.3 From 50b383e5aa333d453e906ae2beb28fe1da549bef Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Feb 2019 09:45:07 -0800 Subject: Fix issue with OSX shader compiler not implementing #if correctly (nice job, Timmy). --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f3519dc7cb..44ed16e0f9 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -955,13 +955,13 @@ void LLSettingsSky::updateSettings() bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return sunDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN; } bool LLSettingsSky::getIsMoonUp() const { LLVector3 moonDir = getMoonDirection(); - return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return moonDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN; } void LLSettingsSky::calculateHeavenlyBodyPositions() const -- cgit v1.2.3 From db97bb51489dc610fd748b73c321a08e7388d668 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Feb 2019 09:49:55 -0800 Subject: Roll back attempted fix for 9996 on ALM which has unacceptable knock-on effects. --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 44ed16e0f9..f3519dc7cb 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -955,13 +955,13 @@ void LLSettingsSky::updateSettings() bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return sunDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN; + return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN; } bool LLSettingsSky::getIsMoonUp() const { LLVector3 moonDir = getMoonDirection(); - return moonDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN; + return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; } void LLSettingsSky::calculateHeavenlyBodyPositions() const -- cgit v1.2.3 From 5a8610ccb7e1f5a0e4d54170ac922e6820ce3acb Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Feb 2019 13:41:31 -0800 Subject: SL-9996, SL-1130, SL-5546 Fix bug with setting texture matrix for rigged mesh. Fix z-fighting between sea and sky in ALM by cheating sky, stars, and moon using gl_FragDepth. Fix handling of atmospheric haze glow w.r.t independent sun/moon positioning (we can no longer depend on them being mutex to each other). --- indra/llinventory/llsettingssky.cpp | 32 +++++++++++++++++++++++++++++--- indra/llinventory/llsettingssky.h | 3 +++ 2 files changed, 32 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f3519dc7cb..db54140e2c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,9 +32,13 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#if LL_WINDOWS +#pragma optimize("", off) +#endif + //========================================================================= namespace { - const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees + const F32 NIGHTTIME_ELEVATION = 8.0f; // degrees const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); const LLUUID IMG_RAINBOW("11b4c57c-56b3-04ed-1f82-2004363882e4"); @@ -952,16 +956,38 @@ void LLSettingsSky::updateSettings() calculateLightSettings(); } +F32 LLSettingsSky::getSunMoonGlowFactor() const +{ + LLVector3 sunDir = getSunDirection(); + LLVector3 moonDir = getMoonDirection(); + + // sun glow at full iff moon is not up + if (sunDir.mV[VZ] > -NIGHTTIME_ELEVATION_SIN) + { + if (moonDir.mV[2] <= 0.0f) + { + return 1.0f; + } + } + + if (moonDir.mV[2] > 0.0f) + { + return moonDir.mV[VZ] / 3.0f; // ramp moon glow at moonset + } + + return 0.0f; +} + bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return (sunDir.mV[2] >= 0.0f) || ((sunDir.mV[2] > -NIGHTTIME_ELEVATION_SIN) && !getIsMoonUp()); } bool LLSettingsSky::getIsMoonUp() const { LLVector3 moonDir = getMoonDirection(); - return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return moonDir.mV[2] > 0.0f; } void LLSettingsSky::calculateHeavenlyBodyPositions() const diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e82ab8db0c..65c0f2c581 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -272,6 +272,9 @@ public: bool getIsSunUp() const; bool getIsMoonUp() const; + // determines how much the haze glow effect occurs in rendering + F32 getSunMoonGlowFactor() const; + LLVector3 getLightDirection() const; LLColor3 getLightDiffuse() const; -- cgit v1.2.3 From 8b4a86db298335de52db114d63a153808dfde36a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Feb 2019 13:43:49 -0800 Subject: Remove MSVC pragma to make debugging feasible in RelWithDebInfo. --- indra/llinventory/llsettingssky.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index db54140e2c..612c97168c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,10 +32,6 @@ #include "llfasttimer.h" #include "v3colorutil.h" -#if LL_WINDOWS -#pragma optimize("", off) -#endif - //========================================================================= namespace { const F32 NIGHTTIME_ELEVATION = 8.0f; // degrees -- cgit v1.2.3 From ce40f88ecb09c91061f7a18ad2b52dcaa3df7ca3 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 5 Feb 2019 15:09:32 -0800 Subject: Better calculation of time remaining in span for track animator (from SL-10465) --- indra/llinventory/llsettingsbase.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 9e03052892..45d2fa0027 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -519,6 +519,7 @@ public: inline void setIgnoreTimeDeltaThreshold(bool val) { mIgnoreTimeDelta = val; } inline bool getIgnoreTimeDeltaThreshold() const { return mIgnoreTimeDelta; } + inline void setTimeSpent(LLSettingsBase::Seconds time) { mTimeSpent = time; } protected: LLSettingsBase::BlendFactor calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const; -- cgit v1.2.3 From 8890c3238ab4ae8bbf1bc123284f9c6d4db4f9d6 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 6 Feb 2019 16:42:23 -0800 Subject: SL-10478 Fix side-effects of having both sun and moon as potential directional light contributors. We pass an int to the shader indicating which to prefer instead of making per-pixel decisions and pass the moonlight color/di independently. Obsolete llsettingssky fade color which was unused elsewhere and cached for no reason. --- indra/llinventory/llsettingssky.cpp | 13 ++----------- indra/llinventory/llsettingssky.h | 3 +-- 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 612c97168c..2a503664ad 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1238,12 +1238,6 @@ LLVector3 LLSettingsSky::getMoonDirection() const return mMoonDirection; } -LLColor4U LLSettingsSky::getFadeColor() const -{ - update(); - return mFadeColor; -} - LLColor4 LLSettingsSky::getMoonAmbient() const { update(); @@ -1305,12 +1299,9 @@ void LLSettingsSky::calculateLightSettings() const mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); - mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance)); - mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); + mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); + mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.25f); mTotalAmbient = mSunAmbient; - - mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f; - mFadeColor.setAlpha(0); } LLUUID LLSettingsSky::GetDefaultAssetId() diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 65c0f2c581..cd173a6b18 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -280,7 +280,7 @@ public: LLVector3 getSunDirection() const; LLVector3 getMoonDirection() const; - LLColor4U getFadeColor() const; + LLColor4 getMoonAmbient() const; LLColor3 getMoonDiffuse() const; LLColor4 getSunAmbient() const; @@ -347,7 +347,6 @@ private: static const F32 DOME_RADIUS; static const F32 DOME_OFFSET; - mutable LLColor4U mFadeColor; mutable LLColor4 mMoonAmbient; mutable LLColor3 mMoonDiffuse; mutable LLColor4 mSunAmbient; -- cgit v1.2.3 From 4952736a063b674f5a91904686920b11b0e04b69 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 7 Feb 2019 11:06:03 -0800 Subject: SL-10486 Use brighter moon texture for both default and blank moon texture ids in picker. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 2a503664ad..72a3c7b01c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -140,7 +140,7 @@ const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver -static const LLUUID DEFAULT_MOON_ID("db13b827-7e6a-7ace-bed4-4419ee00984d"); // dataserver +static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); -- cgit v1.2.3 From 3e0c9087cd6b26a64831f99bf9be05daa1dec510 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 8 Feb 2019 14:29:55 -0800 Subject: SL-10414 --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 72a3c7b01c..af7425cca0 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -954,7 +954,7 @@ void LLSettingsSky::updateSettings() F32 LLSettingsSky::getSunMoonGlowFactor() const { - LLVector3 sunDir = getSunDirection(); + LLVector3 sunDir = getSunDirection(); LLVector3 moonDir = getMoonDirection(); // sun glow at full iff moon is not up @@ -968,7 +968,7 @@ F32 LLSettingsSky::getSunMoonGlowFactor() const if (moonDir.mV[2] > 0.0f) { - return moonDir.mV[VZ] / 3.0f; // ramp moon glow at moonset + return 0.25f; } return 0.0f; -- cgit v1.2.3 From 2a740309d01ca2ab80fd054ea8d8a79fb7ebbbe0 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 11 Feb 2019 16:50:15 -0800 Subject: SL-10406, SL-10464: Experience injections now have their own sub class of day instance (DayInjection) Montitors underlying environments and switches the sources as needed. --- indra/llinventory/llsettingsbase.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 45d2fa0027..592ae3478a 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -104,8 +104,8 @@ public: //--------------------------------------------------------------------- // Settings status inline bool hasSetting(const std::string ¶m) const { return mSettings.has(param); } - inline bool isDirty() const { return mDirty; } - inline bool isVeryDirty() const { return mReplaced; } + virtual bool isDirty() const { return mDirty; } + 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 -- cgit v1.2.3 From 65927e0a76aaf8ff4dc268acdb12007265ff3a14 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 13 Feb 2019 13:09:14 -0800 Subject: SL-10181, SL-10546 Fix distortion map rendering in deferred mode not including underwater fog effects. Fix distortion map rendering not including post-deferred content at all. Fix distortion map rendering not including anything but sky when camera is underwater. Update sun_up_factor/sunmoon_glow_factor uniforms even when sun disc isn't in use. --- indra/llinventory/llsettingswater.cpp | 14 +++++++++++++- indra/llinventory/llsettingswater.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index d160a4ae0e..0eb95dcd89 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -244,7 +244,7 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() validation.push_back(Validator(SETTING_FOG_DENSITY, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-10.0f)(10.0f))))); validation.push_back(Validator(SETTING_FOG_MOD, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1.0f)(1024.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(20.0f))))); validation.push_back(Validator(SETTING_FRESNEL_OFFSET, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_FRESNEL_SCALE, true, LLSD::TypeReal, @@ -290,3 +290,15 @@ LLUUID LLSettingsWater::GetDefaultOpaqueTextureAssetId() { return DEFAULT_OPAQUE_WATER_TEXTURE; } + +F32 LLSettingsWater::getModifiedWaterFogDensity(bool underwater) const +{ + F32 fog_density = getWaterFogDensity(); + F32 underwater_fog_mod = getFogMod(); + if (underwater && underwater_fog_mod > 0.0f) + { + underwater_fog_mod = llclamp(underwater_fog_mod, 0.0f, 10.0f); + fog_density = pow(fog_density, underwater_fog_mod); + } + return fog_density; +} diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 9998f64fd6..e0bfd29f2d 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -95,6 +95,8 @@ public: return mSettings[SETTING_FOG_DENSITY].asReal(); } + F32 getModifiedWaterFogDensity(bool underwater) const; + void setWaterFogDensity(F32 val) { setValue(SETTING_FOG_DENSITY, val); -- cgit v1.2.3 From 2401712d1073e85b4b9183d20c6e9274bc874f64 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 20 Feb 2019 15:20:30 -0800 Subject: SL-9660: Next pass cleanup. Removed and downgraded a number of logs. Removed refs to LAPAS. Better sync with legacy regions. --- indra/llinventory/llsettingsbase.cpp | 2 +- indra/llinventory/llsettingsdaycycle.cpp | 2 -- indra/llinventory/llsettingssky.cpp | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 5adb787048..7d7547ecb1 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -381,7 +381,7 @@ bool LLSettingsBase::validate() } if (result["warnings"].size() > 0) { - LL_WARNS("SETTINGS") << "Validation warnings: " << result["warnings"] << LL_ENDL; + LL_DEBUGS("SETTINGS") << "Validation warnings: " << result["warnings"] << LL_ENDL; } return result["success"].asBoolean(); diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 188e205176..feb734f64e 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -863,8 +863,6 @@ LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyframe(c F32 dist = get_wrapping_distance(startframe, (*it).first); - //LL_DEBUGS("LAPRAS") << "[" << startframe << " ... " << keyframe << " -> " << (*it).first << "@" << dist << LL_ENDL; - if (dist <= (fudge * 2.0f)) return (*it); diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index af7425cca0..744c5853e4 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -997,9 +997,6 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); - //LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; - //LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; - if (mSunDirection.lengthSquared() < 0.01f) LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; if (mMoonDirection.lengthSquared() < 0.01f) -- cgit v1.2.3 From a10ec81e82d79bd79d5b058fda1b370073bfb480 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 15 Mar 2019 08:13:04 -0700 Subject: SL-10743, SL-10744 Don't step on SUNLIGHT_COLOR uniform w/ syncLightState competing set. Put drawpool alpha render loop lighting setup changes as they were (this will give back some performance and possibly require reopening 10566). --- indra/llinventory/llsettingssky.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 744c5853e4..f1bea326c1 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1281,19 +1281,18 @@ void LLSettingsSky::calculateLightSettings() const // and vary_sunlight will work properly with moon light F32 lighty = lightnorm[1]; - - lighty = llmax(0.f, lighty); - if(lighty > 0.f) + if(fabs(lighty) > 0.001f) { lighty = 1.f / lighty; } + lighty = llmax(0.001f, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; //brightness of surface both sunlight and ambient - mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); -- cgit v1.2.3 From 446afe2d1a081a0e10a34749bbe1e4475075dae0 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 26 Mar 2019 08:21:53 -0700 Subject: Make whether the sun or moon is primary part of llrender light state so we can set uniforms for shaders along with other light params. Fix atten calcs to not use abs val. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f1bea326c1..0e597aabb0 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1281,7 +1281,7 @@ void LLSettingsSky::calculateLightSettings() const // and vary_sunlight will work properly with moon light F32 lighty = lightnorm[1]; - if(fabs(lighty) > 0.001f) + if(lighty > 0.001f) { lighty = 1.f / lighty; } -- cgit v1.2.3 From 9dee4149ae6f33e2f82b8986b041df311f0cbe88 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 26 Mar 2019 13:37:07 -0700 Subject: Remove remaining 0.5/1.5 fudge factors on lighting radius/falloff params. Make moonlight darker and slightly bluish for scotopic feel when moon is primary. --- indra/llinventory/llsettingssky.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0e597aabb0..a7b87c4d96 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1295,8 +1295,9 @@ void LLSettingsSky::calculateLightSettings() const mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); - mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f); - mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.25f); + LLColor3 moonlight(0.75, 0.75, 0.92); + mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * 0.25f); + mMoonAmbient = gammaCorrect(componentMult(moonlight, light_transmittance) * 0.125f); mTotalAmbient = mSunAmbient; } -- cgit v1.2.3 From fdcf1b8783eb19ca2c96267c46e456be8e84fdb8 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Wed, 27 Mar 2019 17:06:45 +0200 Subject: SL-10818 FIXED [EEP] Wrong selection when keyframes are close together --- indra/llinventory/llsettingsdaycycle.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index feb734f64e..403d0ff9d8 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -859,11 +859,15 @@ LLSettingsDay::CycleTrack_t::value_type LLSettingsDay::getSettingsNearKeyframe(c if (startframe < 0.0f) startframe = 1.0f + startframe; - CycleTrack_t::iterator it = get_wrapping_atafter(const_cast(mDayTracks[track]), startframe); + LLSettingsDay::CycleTrack_t collection = const_cast(mDayTracks[track]); + CycleTrack_t::iterator it = get_wrapping_atafter(collection, startframe); F32 dist = get_wrapping_distance(startframe, (*it).first); - if (dist <= (fudge * 2.0f)) + CycleTrack_t::iterator next_it = std::next(it); + if ((dist <= DEFAULT_MULTISLIDER_INCREMENT) && next_it != collection.end()) + return (*next_it); + else if (dist <= (fudge * 2.0f)) return (*it); return CycleTrack_t::value_type(TrackPosition(INVALID_TRACKPOS), LLSettingsBase::ptr_t()); -- cgit v1.2.3 From 823172cab99c55b1c26b523d7dd63a99ece9f6cb Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 28 Mar 2019 14:18:59 -0700 Subject: SL-10831 Make moon brightness env setting affect moon diffuse/ambient color combo so it affects in-world lighting. Adjust how the moon brightness affects the moon disc texture rendering (washes out less). --- indra/llinventory/llsettingssky.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index a7b87c4d96..0010e62658 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1295,9 +1295,15 @@ void LLSettingsSky::calculateLightSettings() const mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); - LLColor3 moonlight(0.75, 0.75, 0.92); - mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * 0.25f); - mMoonAmbient = gammaCorrect(componentMult(moonlight, light_transmittance) * 0.125f); + F32 moon_brightness = getMoonBrightness(); + + LLColor3 moonlight_a(0.66, 0.66, 0.66); + LLColor3 moonlight_b(0.66, 0.66, 1.0); + + LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); + + mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness * 0.25f); + mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); mTotalAmbient = mSunAmbient; } -- cgit v1.2.3 From 4490399cc5fe944fff2e81d9ba134ab0447cd9a1 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 29 Mar 2019 07:58:45 -0700 Subject: Fix windows line endings. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0010e62658..9211a48a8e 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1300,7 +1300,7 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_a(0.66, 0.66, 0.66); LLColor3 moonlight_b(0.66, 0.66, 1.0); - LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); + LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness * 0.25f); mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); -- cgit v1.2.3 From 759525040ac11a2edee541c944ad0c6e9cc04d0f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 8 Apr 2019 13:07:44 -0700 Subject: SL-10912 Fix conversion of star brightness, density mult, and distance mult to legacy ranges. Make settings look in both legacyhaze and top-level settings for haze params. --- indra/llinventory/llsettingssky.cpp | 67 +++++++++++++++++-------------------- indra/llinventory/llsettingssky.h | 3 ++ 2 files changed, 33 insertions(+), 37 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 9211a48a8e..a0d81e6d99 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -737,7 +737,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); dfltsetting[SETTING_MOON_BRIGHTNESS] = LLSD::Real(0.5f); - dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(256.0000); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(250.0000); dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); @@ -1037,72 +1037,65 @@ LLColor3 LLSettingsSky::getLightDiffuse() const return LLColor3::white; } -LLColor3 LLSettingsSky::getAmbientColor() const +LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default_value) const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key)) { - return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT]); + return LLColor3(mSettings[SETTING_LEGACY_HAZE][key]); } - if (mSettings.has(SETTING_AMBIENT)) + if (mSettings.has(key)) { - return LLColor3(mSettings[SETTING_AMBIENT]); + return LLColor3(mSettings[key]); } - return LLColor3(0.25f, 0.25f, 0.25f); + return default_value; } -LLColor3 LLSettingsSky::getBlueDensity() const +F32 LLSettingsSky::getFloat(const std::string& key, F32 default_value) const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY)) + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key)) + { + return mSettings[SETTING_LEGACY_HAZE][key].asReal(); + } + if (mSettings.has(key)) { - return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY]); + return mSettings[key].asReal(); } - return LLColor3(0.2447f, 0.4487f, 0.7599f); + return default_value; +} + +LLColor3 LLSettingsSky::getAmbientColor() const +{ + return getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f)); +} + +LLColor3 LLSettingsSky::getBlueDensity() const +{ + return getColor(SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f)); } LLColor3 LLSettingsSky::getBlueHorizon() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_HORIZON)) - { - return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON]); - } - return LLColor3(0.4954f, 0.4954f, 0.6399f); + return getColor(SETTING_BLUE_HORIZON, 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; + return getFloat(SETTING_HAZE_DENSITY, 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; + return getFloat(SETTING_HAZE_HORIZON, 0.19f); } F32 LLSettingsSky::getDensityMultiplier() const { - F32 density_multiplier = 0.0001f; - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DENSITY_MULTIPLIER)) - { - density_multiplier = mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER].asReal(); - } - return density_multiplier; + return getFloat(SETTING_DENSITY_MULTIPLIER, 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; + return getFloat(SETTING_DISTANCE_MULTIPLIER, 0.8f); } void LLSettingsSky::setPlanetRadius(F32 radius) diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index cd173a6b18..d585eeddfa 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -337,6 +337,9 @@ private: 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; + void calculateHeavenlyBodyPositions() const; void calculateLightSettings() const; -- cgit v1.2.3 From 4d76ba2d23c22e9a507a0eb7687b3750091b356f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 22 Apr 2019 10:21:10 -0700 Subject: Fix mismatch between release and EEP in sunlight and ambient color from settings. --- indra/llinventory/llsettingssky.cpp | 55 +++++++++++++++++++++---------------- indra/llinventory/llsettingssky.h | 1 + 2 files changed, 32 insertions(+), 24 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index a0d81e6d99..41e8882181 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1180,29 +1180,34 @@ void LLSettingsSky::setHazeHorizon(F32 val) setDirtyFlag(true); } +// Get total from rayleigh and mie density values for normalization +LLColor3 LLSettingsSky::getTotalDensity() const +{ + LLColor3 blue_density = getBlueDensity(); + F32 haze_density = getHazeDensity(); + LLColor3 total_density = blue_density + smear(haze_density); + return total_density; +} + // 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 { -// LEGACY_ATMOSPHERICS - LLColor3 blue_density = getBlueDensity(); - F32 haze_density = getHazeDensity(); F32 density_multiplier = getDensityMultiplier(); - LLColor3 density = (blue_density * 1.0 + smear(haze_density * 0.25f)); - LLColor3 light_atten = density * density_multiplier * distance; + LLColor3 blue_density = getBlueDensity(); + F32 haze_density = getHazeDensity(); + // Approximate line integral over requested distance + LLColor3 light_atten = (blue_density * 1.0 + smear(haze_density * 0.25f)) * density_multiplier * distance; return light_atten; } LLColor3 LLSettingsSky::getLightTransmittance() const { -// LEGACY_ATMOSPHERICS - LLColor3 blue_density = getBlueDensity(); - F32 haze_density = getHazeDensity(); - F32 density_multiplier = getDensityMultiplier(); - LLColor3 temp1 = blue_density + smear(haze_density); - // Transparency (-> temp1) - temp1 = componentExp((temp1 * -1.f) * density_multiplier); - return temp1; + LLColor3 total_density = getTotalDensity(); + F32 density_multiplier = getDensityMultiplier(); + // Transparency (-> density) from Beer's law + LLColor3 transmittance = componentExp(total_density * -density_multiplier); + return transmittance; } LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const @@ -1262,18 +1267,19 @@ void LLSettingsSky::calculateLightSettings() const { // Initialize temp variables LLColor3 sunlight = getSunlightColor(); - LLColor3 ambient = getAmbientColor(); + LLColor3 ambient = getAmbientColor(); + F32 cloud_shadow = getCloudShadow(); LLVector3 lightnorm = getLightDirection(); // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes - F32 max_y = getMaxY(); - LLColor3 light_atten = getLightAttenuation(max_y); - LLColor3 light_transmittance = getLightTransmittance(); + F32 max_y = getMaxY(); + LLColor3 light_atten = getLightAttenuation(max_y); + LLColor3 light_transmittance = getLightTransmittance(); // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[1]; + F32 lighty = lightnorm[2]; if(lighty > 0.001f) { lighty = 1.f / lighty; @@ -1282,22 +1288,23 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f; + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow; //brightness of surface both sunlight and ambient - mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); - mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5); + mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); F32 moon_brightness = getMoonBrightness(); LLColor3 moonlight_a(0.66, 0.66, 0.66); LLColor3 moonlight_b(0.66, 0.66, 1.0); - LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); - + LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); + componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); + mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness * 0.25f); mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); - mTotalAmbient = mSunAmbient; + mTotalAmbient = mSunAmbient + mMoonAmbient; } LLUUID LLSettingsSky::GetDefaultAssetId() diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index d585eeddfa..ef2a6740f0 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -252,6 +252,7 @@ public: LLColor3 getLightAttenuation(F32 distance) const; LLColor3 getLightTransmittance() const; + LLColor3 getTotalDensity() const; LLColor3 gammaCorrect(const LLColor3& in) const; LLColor3 getBlueDensity() const; -- cgit v1.2.3 From 4ed05fc84fce0fbee76c583e91feed5aff2dbbfc Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 10:59:00 -0700 Subject: Fix dark ALM and strangeness at Mid lighting (class 3 but with a darkness about it). Make a distinct class3/lighting/lightV which boosts to WL levels (* 2.0) and make lighting without WL atmo enabled use class 2 or below. Make forward shaders (alpha and materialF with alpha-blend mode on) more consistent with deferred lighting. --- indra/llinventory/llsettingssky.cpp | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 41e8882181..c41944bdbb 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -33,9 +33,8 @@ #include "v3colorutil.h" //========================================================================= -namespace { - const F32 NIGHTTIME_ELEVATION = 8.0f; // degrees - const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); +namespace +{ const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); const LLUUID IMG_RAINBOW("11b4c57c-56b3-04ed-1f82-2004363882e4"); const LLUUID IMG_HALO("12149143-f599-91a7-77ac-b52a3c0f59cd"); @@ -958,15 +957,15 @@ F32 LLSettingsSky::getSunMoonGlowFactor() const LLVector3 moonDir = getMoonDirection(); // sun glow at full iff moon is not up - if (sunDir.mV[VZ] > -NIGHTTIME_ELEVATION_SIN) + if (getIsSunUp()) { - if (moonDir.mV[2] <= 0.0f) + if (!getIsMoonUp()) { return 1.0f; } } - if (moonDir.mV[2] > 0.0f) + if (getIsMoonUp()) { return 0.25f; } @@ -977,13 +976,13 @@ F32 LLSettingsSky::getSunMoonGlowFactor() const bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return (sunDir.mV[2] >= 0.0f) || ((sunDir.mV[2] > -NIGHTTIME_ELEVATION_SIN) && !getIsMoonUp()); + return sunDir.mV[2] >= 0.0f || !getIsMoonUp(); } bool LLSettingsSky::getIsMoonUp() const { LLVector3 moonDir = getMoonDirection(); - return moonDir.mV[2] > 0.0f; + return moonDir.mV[2] >= 0.0f; } void LLSettingsSky::calculateHeavenlyBodyPositions() const @@ -997,10 +996,19 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); - if (mSunDirection.lengthSquared() < 0.01f) - LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; - if (mMoonDirection.lengthSquared() < 0.01f) - LL_WARNS("SETTINGS") << "Zero length moon direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; + // find out about degen math earlier rather than later + llassert(mSunDirection.length() >= 0.9f); + llassert(mMoonDirection.length() >= 0.9f); + + if (mSunDirection.lengthSquared() < 0.9f) + { + LL_WARNS("SETTINGS") << "Invalid sun direction." << LL_ENDL; + } + + if (mMoonDirection.lengthSquared() < 0.9f) + { + LL_WARNS("SETTINGS") << "Invalid moon direction." << LL_ENDL; + } } LLVector3 LLSettingsSky::getLightDirection() const @@ -1280,9 +1288,9 @@ void LLSettingsSky::calculateLightSettings() const // and vary_sunlight will work properly with moon light F32 lighty = lightnorm[2]; - if(lighty > 0.001f) + if(fabs(lighty) > 0.001f) { - lighty = 1.f / lighty; + lighty = 1.f / fabs(lighty); } lighty = llmax(0.001f, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); -- cgit v1.2.3 From 4d6cb310ec516fe50912293042ee95d5a10cbe73 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 11:43:16 -0700 Subject: Remove unused vars making Clang warnerror. --- indra/llinventory/llsettingssky.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c41944bdbb..549d0c4b3b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -953,9 +953,6 @@ void LLSettingsSky::updateSettings() F32 LLSettingsSky::getSunMoonGlowFactor() const { - LLVector3 sunDir = getSunDirection(); - LLVector3 moonDir = getMoonDirection(); - // sun glow at full iff moon is not up if (getIsSunUp()) { -- cgit v1.2.3 From 5f4b93466cf714df13af2056d13973071bc3d541 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 11:44:48 -0700 Subject: Remove bughunting asserts. --- indra/llinventory/llsettingssky.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 549d0c4b3b..5870fb27e3 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -994,9 +994,6 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mMoonDirection.normalize(); // find out about degen math earlier rather than later - llassert(mSunDirection.length() >= 0.9f); - llassert(mMoonDirection.length() >= 0.9f); - if (mSunDirection.lengthSquared() < 0.9f) { LL_WARNS("SETTINGS") << "Invalid sun direction." << LL_ENDL; -- cgit v1.2.3 From 48ed3f9318cf3750f1c4f72d1e7195f06d06e53c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 11:46:56 -0700 Subject: Put warnings on sun/moon direction as they were. --- indra/llinventory/llsettingssky.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 5870fb27e3..07a03f0315 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -993,16 +993,10 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const mSunDirection.normalize(); mMoonDirection.normalize(); - // find out about degen math earlier rather than later - if (mSunDirection.lengthSquared() < 0.9f) - { - LL_WARNS("SETTINGS") << "Invalid sun direction." << LL_ENDL; - } - - if (mMoonDirection.lengthSquared() < 0.9f) - { - LL_WARNS("SETTINGS") << "Invalid moon direction." << LL_ENDL; - } + if (mSunDirection.lengthSquared() < 0.01f) + LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; + if (mMoonDirection.lengthSquared() < 0.01f) + LL_WARNS("SETTINGS") << "Zero length moon direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL; } LLVector3 LLSettingsSky::getLightDirection() const -- cgit v1.2.3 From 5766325290974ee2cfa30fd655060ef396d1e87a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 13:02:24 -0700 Subject: SL-10904, SL-10998, SL-11018 Fix handling of 1/light_y when y was tiny but getting even tinier. Add similar adjustment to shader version of same calc. --- indra/llinventory/llsettingssky.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 07a03f0315..1490708ca5 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1275,12 +1275,14 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 light_transmittance = getLightTransmittance(); // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[2]; - if(fabs(lighty) > 0.001f) + const F32 LIMIT = FLT_EPSILON * 8.0f; + + F32 lighty = fabs(lightnorm[2]); + if(lighty >= LIMIT) { - lighty = 1.f / fabs(lighty); + lighty = 1.f / lighty; } - lighty = llmax(0.001f, lighty); + lighty = llmax(LIMIT, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); //increase ambient when there are more clouds -- cgit v1.2.3 From 29f8e04ddba3b36776b295949d03ac44d6cb3b11 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 29 Apr 2019 13:07:57 -0700 Subject: SL-11065 Modify is sun up logic to exclude condition of moon. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 1490708ca5..aa26cd8054 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -973,7 +973,7 @@ F32 LLSettingsSky::getSunMoonGlowFactor() const bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return sunDir.mV[2] >= 0.0f || !getIsMoonUp(); + return sunDir.mV[2] >= 0.0f; } bool LLSettingsSky::getIsMoonUp() const -- cgit v1.2.3 From 906b0be675e5467665f65180924e6117700b4cbb Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 3 May 2019 08:47:13 -0700 Subject: SL-11087, SL-11086, SL-11092 Fix sun/moon glow factor bustage. Make darkness an option. Fix moon fade shader logic getting confused when sun was below horizon. --- indra/llinventory/llsettingssky.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index aa26cd8054..a090a7be32 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1292,15 +1292,15 @@ void LLSettingsSky::calculateLightSettings() const mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); - F32 moon_brightness = getMoonBrightness(); + F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; - LLColor3 moonlight_a(0.66, 0.66, 0.66); - LLColor3 moonlight_b(0.66, 0.66, 1.0); + LLColor3 moonlight_a(0.45, 0.45, 0.66); + LLColor3 moonlight_b(0.33, 0.33, 1.0); LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness * 0.25f); + mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); mTotalAmbient = mSunAmbient + mMoonAmbient; } -- cgit v1.2.3 From 1522a9902481b69b3d04bee5edd79102a796630b Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 3 May 2019 10:12:56 -0700 Subject: SL-11070 Gave clouds the Bob Ross treatment. --- indra/llinventory/llsettingssky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index a090a7be32..def492c203 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1189,7 +1189,7 @@ LLColor3 LLSettingsSky::getTotalDensity() const // this is used later for sunlight modulation at various altitudes LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const { - F32 density_multiplier = getDensityMultiplier(); + F32 density_multiplier = getDensityMultiplier() * 0.45f; LLColor3 blue_density = getBlueDensity(); F32 haze_density = getHazeDensity(); // Approximate line integral over requested distance @@ -1200,7 +1200,7 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const LLColor3 LLSettingsSky::getLightTransmittance() const { LLColor3 total_density = getTotalDensity(); - F32 density_multiplier = getDensityMultiplier(); + F32 density_multiplier = getDensityMultiplier() * 0.45f; // Transparency (-> density) from Beer's law LLColor3 transmittance = componentExp(total_density * -density_multiplier); return transmittance; -- cgit v1.2.3 From 989de25f189276d586d5c7077e505bc697fe4112 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 7 May 2019 16:32:34 -0700 Subject: SL-11086 Re-fix sun/moon glow factor and make it depend on moon brightness. Make cloud shaders use sunlight color exclusively for consistency when moon is up or down. --- indra/llinventory/llsettingssky.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index def492c203..cfca2d0d78 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -953,21 +953,8 @@ void LLSettingsSky::updateSettings() F32 LLSettingsSky::getSunMoonGlowFactor() const { - // sun glow at full iff moon is not up - if (getIsSunUp()) - { - if (!getIsMoonUp()) - { - return 1.0f; - } - } - - if (getIsMoonUp()) - { - return 0.25f; - } - - return 0.0f; + return getIsSunUp() ? 1.0f : + getIsMoonUp() ? getMoonBrightness() * 0.25 : 0.0f; } bool LLSettingsSky::getIsSunUp() const @@ -1302,7 +1289,7 @@ void LLSettingsSky::calculateLightSettings() const mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); - mTotalAmbient = mSunAmbient + mMoonAmbient; + mTotalAmbient = mSunAmbient; } LLUUID LLSettingsSky::GetDefaultAssetId() -- cgit v1.2.3 From 22fc3409f4606459c6df219c343a002fc53a35cd Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 8 May 2019 14:30:09 -0700 Subject: SL-10878: Update default day cycle asset ID --- indra/llinventory/llsettingsdaycycle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 403d0ff9d8..b80e74791e 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -121,7 +121,7 @@ const S32 LLSettingsDay::FRAME_MAX(56); const F32 LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR(0.02501f); -const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("78751d18-6c51-3c43-2887-3654cd427a42"); +const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("5646d39e-d3d7-6aff-ed71-30fc87d64a91"); // Minimum value to prevent multislider in edit floaters from eating up frames that 'encroach' on one another's space static const F32 DEFAULT_MULTISLIDER_INCREMENT(0.005f); -- cgit v1.2.3 From ce910edb0ed6222ad402e4310ccef6a0d0207dd0 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 13 May 2019 16:28:33 +0300 Subject: SL-11150 FIXED [EEP] Settings names get truncated. --- indra/llinventory/llsettingsbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7d7547ecb1..7f2b5d4597 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -389,7 +389,7 @@ bool LLSettingsBase::validate() LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &validations, bool partial) { - static Validator validateName(SETTING_NAME, false, LLSD::TypeString, boost::bind(&Validator::verifyStringLength, _1, 32)); + static Validator validateName(SETTING_NAME, false, LLSD::TypeString, boost::bind(&Validator::verifyStringLength, _1, 63)); static Validator validateId(SETTING_ID, false, LLSD::TypeUUID); static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger); static Validator validateType(SETTING_TYPE, false, LLSD::TypeString); -- cgit v1.2.3 From b143aa96fcd6d16558464c98bcfd9984f7d29750 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 13 May 2019 15:33:48 -0700 Subject: SL-10856 Modify calc of sunlight to avoid clipping in gamma correct on values outside 0-1 range. Modify shaders to put back ambient clamp tuned to be close to ambient contrib in low/mid lighting. --- indra/llinventory/llsettingssky.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cfca2d0d78..211af6a7ae 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,10 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#if LL_WINDOWS +#pragma optimize("", off) +#endif + //========================================================================= namespace { @@ -1276,8 +1280,10 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow; //brightness of surface both sunlight and ambient - mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); - mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); + // reduce range to 0 - 1 before gamma correct to prevent clipping + // then restore to full 0 - 3 range before storage + mSunDiffuse = gammaCorrect(componentMult(sunlight * 0.33333f, light_transmittance)) * 3.0f; + mSunAmbient = gammaCorrect(componentMult(tmpAmbient * 0.33333f, light_transmittance)) * 3.0f; F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; -- cgit v1.2.3 From 041d92b6bd4212bafd51567a52b4e2147da3132a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 14 May 2019 07:56:41 -0700 Subject: Force file update. --- indra/llinventory/llsettingssky.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index cfca2d0d78..8483778e63 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1682,4 +1682,3 @@ LLUUID LLSettingsSky::getNextBloomTextureId() const { return mNextBloomTextureId; } - -- cgit v1.2.3 From b3c0218a31b9d7dd699cf3944bbcfc35e9adbd49 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 16 May 2019 14:14:02 -0700 Subject: Revert lighting changes for 10856 causing knock-on. --- indra/llinventory/llsettingssky.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 45d034cb1f..e02ecc8a33 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1684,3 +1684,4 @@ LLUUID LLSettingsSky::getNextBloomTextureId() const { return mNextBloomTextureId; } + -- cgit v1.2.3 From e9dbee00262a437e4b3f971b37ea636e92032133 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 21 May 2019 16:00:45 -0700 Subject: SL-11238 Fix ambient light inputs to the renderer. Fix 3rd sky shader w/ mistaken density mod conversion. Make ambient clamp apply to all modes. Tune ALM ambient clamp to match non-ALM. --- indra/llinventory/llsettingssky.cpp | 30 +++++++++++++++++++++++------- indra/llinventory/llsettingssky.h | 3 +++ 2 files changed, 26 insertions(+), 7 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e02ecc8a33..fecca12905 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1246,6 +1246,17 @@ LLColor4 LLSettingsSky::getTotalAmbient() const return mTotalAmbient; } +LLColor3 LLSettingsSky::getMoonlightColor() const +{ + F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; + + LLColor3 moonlight_a(0.45, 0.45, 0.66); + LLColor3 moonlight_b(0.33, 0.33, 1.0); + + LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); + return moonlight; +} + void LLSettingsSky::calculateLightSettings() const { // Initialize temp variables @@ -1278,19 +1289,24 @@ void LLSettingsSky::calculateLightSettings() const //brightness of surface both sunlight and ambient // reduce range to 0 - 1 before gamma correct to prevent clipping // then restore to full 0 - 3 range before storage - mSunDiffuse = gammaCorrect(componentMult(sunlight * 0.33333f, light_transmittance)) * 3.0f; - mSunAmbient = gammaCorrect(componentMult(tmpAmbient * 0.33333f, light_transmittance)) * 3.0f; + //mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); + //mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); + + mSunDiffuse = componentMult(sunlight, light_transmittance); + mSunAmbient = componentMult(tmpAmbient, light_transmittance); F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; - LLColor3 moonlight_a(0.45, 0.45, 0.66); - LLColor3 moonlight_b(0.33, 0.33, 1.0); + LLColor3 moonlight = getMoonlightColor(); + LLColor3 moonlight_b(0.33, 0.33, 1.0); // scotopic ambient value - LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); - mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); + //mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); + //mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); + mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; + mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; + mTotalAmbient = mSunAmbient; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index ef2a6740f0..92b8a8bd5a 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -282,6 +282,9 @@ public: LLVector3 getSunDirection() const; LLVector3 getMoonDirection() const; + // color based on brightness + LLColor3 getMoonlightColor() const; + LLColor4 getMoonAmbient() const; LLColor3 getMoonDiffuse() const; LLColor4 getSunAmbient() const; -- cgit v1.2.3 From 2f2cf6d855e1e5977ef0ed3583238636e890220a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 29 May 2019 15:57:24 -0700 Subject: SL-10969 Modify ambient handling and forward projector lighting again to stamp out alpha fires. --- indra/llinventory/llsettingssky.cpp | 38 +++++++++++++++++++++---------------- indra/llinventory/llsettingssky.h | 1 + 2 files changed, 23 insertions(+), 16 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index fecca12905..23b2b003a5 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1249,14 +1249,22 @@ LLColor4 LLSettingsSky::getTotalAmbient() const LLColor3 LLSettingsSky::getMoonlightColor() const { F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; - - LLColor3 moonlight_a(0.45, 0.45, 0.66); - LLColor3 moonlight_b(0.33, 0.33, 1.0); - + LLColor3 moonlight_a(0.9, 0.9, 1.32); + LLColor3 moonlight_b(0.66, 0.66, 2.0); LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); return moonlight; } +void LLSettingsSky::clampColor(LLColor3& color) const +{ + F32 max_color = llmax(color.mV[0], color.mV[1], color.mV[2]); + if (max_color > 1.f) + { + color *= 1.f/max_color; + } + color.clamp(); +} + void LLSettingsSky::calculateLightSettings() const { // Initialize temp variables @@ -1282,30 +1290,28 @@ void LLSettingsSky::calculateLightSettings() const } lighty = llmax(LIMIT, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); + componentMultBy(sunlight, light_transmittance); + clampColor(sunlight); //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow; + componentMultBy(tmpAmbient, light_transmittance); + clampColor(tmpAmbient); //brightness of surface both sunlight and ambient - // reduce range to 0 - 1 before gamma correct to prevent clipping - // then restore to full 0 - 3 range before storage - //mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance)); - //mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance)); - - mSunDiffuse = componentMult(sunlight, light_transmittance); - mSunAmbient = componentMult(tmpAmbient, light_transmittance); + mSunDiffuse = gammaCorrect(sunlight); + mSunAmbient = gammaCorrect(tmpAmbient); F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; LLColor3 moonlight = getMoonlightColor(); - LLColor3 moonlight_b(0.33, 0.33, 1.0); // scotopic ambient value + LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); + clampColor(moonlight); - //mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); - //mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); - mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; - mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; + mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); + mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); mTotalAmbient = mSunAmbient; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 92b8a8bd5a..d04209a1a1 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -346,6 +346,7 @@ private: void calculateHeavenlyBodyPositions() const; void calculateLightSettings() const; + void clampColor(LLColor3& color) const; mutable LLVector3 mSunDirection; mutable LLVector3 mMoonDirection; -- cgit v1.2.3 From 59275152120efd0637bbef67443b9c0d5014a321 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 31 May 2019 09:24:30 -0700 Subject: SL-11117: Set default sky asset ID to A-12PM --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 23b2b003a5..b98522c176 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -136,7 +136,7 @@ const std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level"); const std::string LLSettingsSky::SETTING_SKY_DROPLET_RADIUS("droplet_radius"); const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); -const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("eb3a7080-831f-9f37-10f0-7b1f9ea4043c"); +const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("3ae23978-ac82-bcf3-a9cb-ba6e52dcb9ad"); static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver -- cgit v1.2.3 From 16d3279995bcb4a4766b721d0897b3d2199971d5 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 3 Jun 2019 11:30:41 -0700 Subject: SL-10966 Fix light atten and transmittance calcs breaking ambient color contrib to fog. Needs to be tested on DRTSIM-415 or better to get legacy viewer settings that match EEP. --- indra/llinventory/llsettingssky.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 23b2b003a5..50a897bb77 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1176,7 +1176,7 @@ LLColor3 LLSettingsSky::getTotalDensity() const // this is used later for sunlight modulation at various altitudes LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const { - F32 density_multiplier = getDensityMultiplier() * 0.45f; + F32 density_multiplier = getDensityMultiplier(); LLColor3 blue_density = getBlueDensity(); F32 haze_density = getHazeDensity(); // Approximate line integral over requested distance @@ -1187,7 +1187,7 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const LLColor3 LLSettingsSky::getLightTransmittance() const { LLColor3 total_density = getTotalDensity(); - F32 density_multiplier = getDensityMultiplier() * 0.45f; + F32 density_multiplier = getDensityMultiplier(); // Transparency (-> density) from Beer's law LLColor3 transmittance = componentExp(total_density * -density_multiplier); return transmittance; @@ -1294,7 +1294,7 @@ void LLSettingsSky::calculateLightSettings() const clampColor(sunlight); //increase ambient when there are more clouds - LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow; + LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; componentMultBy(tmpAmbient, light_transmittance); clampColor(tmpAmbient); -- cgit v1.2.3 From cfdcd0fc8ce969ca7df4e88608ee6d3bc923954d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 26 Jun 2019 13:37:07 -0700 Subject: SL-11151 Modify env settings blender to not skip. --- indra/llinventory/llsettingsbase.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 7f2b5d4597..c051563714 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -167,6 +167,8 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c 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) { std::string key_name = (*it).first; @@ -678,9 +680,9 @@ bool LLSettingsBase::Validator::verifyStringLength(LLSD &value, S32 length) void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) { F64 res = setBlendFactor(blendf); - - if ((res >= 0.0001) && (res < 1.0)) - mTarget->update(); + llassert(res >= 0.0 && res <= 1.0); + (void)res; + mTarget->update(); } F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_in) @@ -689,17 +691,12 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_ if (blendf >= 1.0) { triggerComplete(); - return 1.0; } blendf = llclamp(blendf, 0.0f, 1.0f); if (mTarget) { mTarget->replaceSettings(mInitial->getSettings()); - if (!mFinal || (mInitial == mFinal) || (blendf == 0.0)) - { // this is a trivial blend. Results will be identical to the initial. - return blendf; - } mTarget->blend(mFinal, blendf); } else @@ -720,7 +717,7 @@ void LLSettingsBlender::triggerComplete() } //------------------------------------------------------------------------- -const LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::MIN_BLEND_DELTA(0.001); +const LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::MIN_BLEND_DELTA(FLT_EPSILON); LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const { -- cgit v1.2.3 From 8ba159fed90fc221003e85c5d2d3b82ec30d81bf Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 27 Jun 2019 09:10:38 -0700 Subject: SL-11151, SL-11504 Remove update threshold logic causing hiccups and rework sky updates. Make deferred water do double transport again to match non-ALM rendering more closely. --- indra/llinventory/llsettingsbase.cpp | 8 -------- indra/llinventory/llsettingsbase.h | 21 --------------------- 2 files changed, 29 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index c051563714..e8fdd017e3 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -727,22 +727,14 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS bool LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta) { mTimeSpent += timedelta; - mTimeDeltaPassed += timedelta; if (mTimeSpent > mBlendSpan) { - mIgnoreTimeDelta = false; triggerComplete(); return false; } - if ((mTimeDeltaPassed < mTimeDeltaThreshold) && (!mIgnoreTimeDelta)) - { - return false; - } - LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); - mTimeDeltaPassed = LLSettingsBase::Seconds(0.0); if (fabs(mLastBlendF - blendf) < mBlendFMinDelta) { diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 592ae3478a..afb5014409 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -477,9 +477,6 @@ public: mBlendSpan(blend_span), mLastUpdate(0.0f), mTimeSpent(0.0f), - mTimeDeltaThreshold(0.0f), - mTimeDeltaPassed(0.0f), - mIgnoreTimeDelta(false), mBlendFMinDelta(MIN_BLEND_DELTA), mLastBlendF(-1.0f) { @@ -499,26 +496,11 @@ public: mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch()); mLastUpdate = mTimeStart; mTimeSpent = LLSettingsBase::Seconds(0.0f); - mTimeDeltaPassed = LLSettingsBase::Seconds(0.0f); mLastBlendF = LLSettingsBase::BlendFactor(-1.0f); } virtual bool applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE; - inline void setTimeDeltaThreshold(const LLSettingsBase::Seconds time) - { - mTimeDeltaThreshold = time; - mTimeDeltaPassed = time + LLSettingsBase::Seconds(1.0); // take the next update call. - } - - inline LLSettingsBase::Seconds getTimeDeltaThreshold() const - { - return mTimeDeltaThreshold; - } - - inline void setIgnoreTimeDeltaThreshold(bool val) { mIgnoreTimeDelta = val; } - inline bool getIgnoreTimeDeltaThreshold() const { return mIgnoreTimeDelta; } - inline void setTimeSpent(LLSettingsBase::Seconds time) { mTimeSpent = time; } protected: LLSettingsBase::BlendFactor calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const; @@ -527,9 +509,6 @@ protected: LLSettingsBase::Seconds mLastUpdate; LLSettingsBase::Seconds mTimeSpent; LLSettingsBase::Seconds mTimeStart; - LLSettingsBase::Seconds mTimeDeltaThreshold; - LLSettingsBase::Seconds mTimeDeltaPassed; - bool mIgnoreTimeDelta; LLSettingsBase::BlendFactor mBlendFMinDelta; LLSettingsBase::BlendFactor mLastBlendF; }; -- cgit v1.2.3 From d23bf2c16e2d36b18c920bbd42f49c47f3c58bd9 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 10 Jul 2019 13:02:09 -0700 Subject: SL-11541 WIP Make LLSettingsSky::gammaCorrect work like the soft scale clip and gamma correct from release. Add transmittance effects to the low-end sky tex gen. --- indra/llinventory/llsettingssky.cpp | 77 ++++++++++++++++++++++++++++--------- indra/llinventory/llsettingssky.h | 6 ++- 2 files changed, 62 insertions(+), 21 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 5047f312f0..75b4415086 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1184,24 +1184,34 @@ LLColor3 LLSettingsSky::getLightAttenuation(F32 distance) const return light_atten; } -LLColor3 LLSettingsSky::getLightTransmittance() const +LLColor3 LLSettingsSky::getLightTransmittance(F32 distance) const { LLColor3 total_density = getTotalDensity(); F32 density_multiplier = getDensityMultiplier(); // Transparency (-> density) from Beer's law - LLColor3 transmittance = componentExp(total_density * -density_multiplier); + LLColor3 transmittance = componentExp(total_density * -(density_multiplier * distance)); return transmittance; } +// performs soft scale clip and gamma correction ala the shader implementation +// scales colors down to 0 - 1 range preserving relative ratios LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const { F32 gamma = getGamma(); + LLColor3 v(in); - v.clamp(); - v= smear(1.0f) - v; - v = componentPow(v, gamma); - v = smear(1.0f) - v; - return v; + // scale down to 0 to 1 range preserving relative ratio (aka homegenize) + F32 max_color = llmax(llmax(in.mV[0], in.mV[1]), in.mV[2]); + if (max_color > 1.0f) + { + v *= 1.0f / max_color; + } + + LLColor3 color = in * 2.0f; + color = smear(1.f) - componentSaturate(color); // clamping after mul seems wrong, but prevents negative colors... + componentPow(color, gamma); + color = smear(1.f) - color; + return color; } LLVector3 LLSettingsSky::getSunDirection() const @@ -1240,6 +1250,12 @@ LLColor3 LLSettingsSky::getSunDiffuse() const return mSunDiffuse; } +LLColor4 LLSettingsSky::getHazeColor() const +{ + update(); + return mHazeColor; +} + LLColor4 LLSettingsSky::getTotalAmbient() const { update(); @@ -1255,14 +1271,19 @@ LLColor3 LLSettingsSky::getMoonlightColor() const return moonlight; } -void LLSettingsSky::clampColor(LLColor3& color) const +void LLSettingsSky::clampColor(LLColor3& color, F32 gamma, F32 scale) const { F32 max_color = llmax(color.mV[0], color.mV[1], color.mV[2]); - if (max_color > 1.f) + if (max_color > scale) { - color *= 1.f/max_color; + color *= scale/max_color; } - color.clamp(); + LLColor3 linear(color); + linear *= 1.0 / scale; + linear = smear(1.0f) - linear; + linear = componentPow(linear, gamma); + linear *= scale; + color = linear; } void LLSettingsSky::calculateLightSettings() const @@ -1278,7 +1299,7 @@ void LLSettingsSky::calculateLightSettings() const // this is used later for sunlight modulation at various altitudes F32 max_y = getMaxY(); LLColor3 light_atten = getLightAttenuation(max_y); - LLColor3 light_transmittance = getLightTransmittance(); + LLColor3 light_transmittance = getLightTransmittance(max_y); // and vary_sunlight will work properly with moon light const F32 LIMIT = FLT_EPSILON * 8.0f; @@ -1291,16 +1312,34 @@ void LLSettingsSky::calculateLightSettings() const lighty = llmax(LIMIT, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); - clampColor(sunlight); + + F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); + if (max_color > 1.0f) + { + sunlight *= 1.0f/max_color; + } //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; componentMultBy(tmpAmbient, light_transmittance); - clampColor(tmpAmbient); + + //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); + max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); + if (max_color > 1.0f) + { + tmpAmbient *= 1.0f/max_color; + } //brightness of surface both sunlight and ambient - mSunDiffuse = gammaCorrect(sunlight); - mSunAmbient = gammaCorrect(tmpAmbient); + mSunDiffuse = sunlight; + mSunAmbient = tmpAmbient; + F32 haze_horizon = getHazeHorizon(); + + sunlight *= 1.0 - cloud_shadow; + sunlight += tmpAmbient; + + mHazeColor = getBlueHorizon() * getBlueDensity() * sunlight; + mHazeColor += LLColor4(haze_horizon, haze_horizon, haze_horizon, haze_horizon) * getHazeDensity() * sunlight; F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; @@ -1308,10 +1347,10 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - clampColor(moonlight); + clampColor(moonlight, getGamma(), 1.0f); - mMoonDiffuse = gammaCorrect(componentMult(moonlight, light_transmittance) * moon_brightness); - mMoonAmbient = gammaCorrect(componentMult(moonlight_b, light_transmittance) * 0.0125f); + mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; + mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; mTotalAmbient = mSunAmbient; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index d04209a1a1..e562fe38ff 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -251,7 +251,7 @@ public: static LLSD translateLegacyHazeSettings(const LLSD& legacy); LLColor3 getLightAttenuation(F32 distance) const; - LLColor3 getLightTransmittance() const; + LLColor3 getLightTransmittance(F32 distance) const; LLColor3 getTotalDensity() const; LLColor3 gammaCorrect(const LLColor3& in) const; @@ -290,6 +290,7 @@ public: LLColor4 getSunAmbient() const; LLColor3 getSunDiffuse() const; LLColor4 getTotalAmbient() const; + LLColor4 getHazeColor() const; virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); } @@ -346,7 +347,7 @@ private: void calculateHeavenlyBodyPositions() const; void calculateLightSettings() const; - void clampColor(LLColor3& color) const; + void clampColor(LLColor3& color, F32 gamma, const F32 scale = 1.0f) const; mutable LLVector3 mSunDirection; mutable LLVector3 mMoonDirection; @@ -360,6 +361,7 @@ private: mutable LLColor4 mSunAmbient; mutable LLColor3 mSunDiffuse; mutable LLColor4 mTotalAmbient; + mutable LLColor4 mHazeColor; typedef std::map mapNameToUniformId_t; -- cgit v1.2.3 From 53b71f0dc3d8a947225c2ca2ecf22b30fb7667d2 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 24 Jul 2019 13:45:03 -0700 Subject: SL-11600 Make default direction when neither sun nor moon are up straight down instead of noon. --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 75b4415086..434270d178 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1000,7 +1000,7 @@ LLVector3 LLSettingsSky::getLightDirection() const return mMoonDirection; } - return LLVector3::z_axis; + return -LLVector3::z_axis; } LLColor3 LLSettingsSky::getLightDiffuse() const -- cgit v1.2.3 From b1cab5d24687b07c124e0dcd61485fa9e368c882 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 13 Aug 2019 09:20:37 -0700 Subject: SL-11212 Remove color clamping in determining sun diffuse and moonlight diffuse color from atmo settings. --- indra/llinventory/llsettingssky.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 434270d178..35bd9a2254 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1313,23 +1313,10 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); - F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); - if (max_color > 1.0f) - { - sunlight *= 1.0f/max_color; - } - //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; componentMultBy(tmpAmbient, light_transmittance); - //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); - max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); - if (max_color > 1.0f) - { - tmpAmbient *= 1.0f/max_color; - } - //brightness of surface both sunlight and ambient mSunDiffuse = sunlight; mSunAmbient = tmpAmbient; @@ -1347,7 +1334,6 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - clampColor(moonlight, getGamma(), 1.0f); mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; -- cgit v1.2.3 From 8960a56f531745bc2d434bdddb6c65731621f596 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 22 Aug 2019 11:19:04 -0700 Subject: SL-11776 Fix false alarming sky updates and doing expensive CPU work for same sky pixels. --- indra/llinventory/llsettingssky.cpp | 41 +++++++++++++++++++++++++++++++++++++ indra/llinventory/llsettingssky.h | 3 +++ 2 files changed, 44 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 35bd9a2254..9bbeb00efe 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1051,6 +1051,19 @@ LLColor3 LLSettingsSky::getAmbientColor() const return getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f)); } +LLColor3 LLSettingsSky::getAmbientColorClamped() const +{ + LLColor3 ambient = getAmbientColor(); + + F32 max_color = llmax(ambient.mV[0], ambient.mV[1], ambient.mV[2]); + if (max_color > 1.0f) + { + ambient *= 1.0f/max_color; + } + + return ambient; +} + LLColor3 LLSettingsSky::getBlueDensity() const { return getColor(SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f)); @@ -1313,10 +1326,23 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); + //F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); + //if (max_color > 1.0f) + //{ + // sunlight *= 1.0f/max_color; + //} + //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; componentMultBy(tmpAmbient, light_transmittance); + //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); + //max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); + //if (max_color > 1.0f) + //{ + // tmpAmbient *= 1.0f/max_color; + //} + //brightness of surface both sunlight and ambient mSunDiffuse = sunlight; mSunAmbient = tmpAmbient; @@ -1334,6 +1360,7 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); + //clampColor(moonlight, getGamma(), 1.0f); mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; @@ -1676,6 +1703,20 @@ LLColor3 LLSettingsSky::getSunlightColor() const return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]); } +LLColor3 LLSettingsSky::getSunlightColorClamped() const +{ + LLColor3 sunlight = getSunlightColor(); + //clampColor(sunlight, getGamma(), 3.0f); + + F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); + if (max_color > 1.0f) + { + sunlight *= 1.0f/max_color; + } + + return sunlight; +} + void LLSettingsSky::setSunlightColor(const LLColor3 &val) { setValue(SETTING_SUNLIGHT_COLOR, val); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e562fe38ff..4127911643 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -292,6 +292,9 @@ public: LLColor4 getTotalAmbient() const; LLColor4 getHazeColor() const; + LLColor3 getSunlightColorClamped() const; + LLColor3 getAmbientColorClamped() const; + virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); } static LLUUID GetDefaultAssetId(); -- cgit v1.2.3 From 1f656735d339fc4d83da86efbb400af1361c27db Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 26 Aug 2019 11:43:45 -0700 Subject: SL-11705, SL-11706: New flags in llsettings base for tracking by simulator. --- indra/llinventory/llsettingsbase.cpp | 7 ++++++- indra/llinventory/llsettingsbase.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index e8fdd017e3..af3e84fd0f 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -59,6 +59,7 @@ const std::string LLSettingsBase::SETTING_FLAGS("flags"); const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0); const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1); const U32 LLSettingsBase::FLAG_NOTRANS(0x01 << 2); +const U32 LLSettingsBase::FLAG_NOSAVE(0x01 << 3); const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0); @@ -354,7 +355,11 @@ LLSD LLSettingsBase::getSettings() const LLSD LLSettingsBase::cloneSettings() const { - return combineSDMaps(getSettings(), LLSD()); + U32 flags = getFlags(); + LLSD settings (combineSDMaps(getSettings(), LLSD())); + if (flags) + settings[SETTING_FLAGS] = LLSD::Integer(flags); + return settings; } size_t LLSettingsBase::getHash() const diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index afb5014409..8b969d81a6 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -75,6 +75,7 @@ public: static const U32 FLAG_NOCOPY; static const U32 FLAG_NOMOD; static const U32 FLAG_NOTRANS; + static const U32 FLAG_NOSAVE; class DefaultParam { -- cgit v1.2.3 From ad26896a1086536cf47d3cb0041b0410aebf2119 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 27 Aug 2019 12:49:18 -0700 Subject: SL-11055 Remedy cloud_shadow and hack halving being done twice to ambient in some cases (i.e. artificial dimunition of necessary bullshit factor). --- indra/llinventory/llsettingsbase.h | 2 +- indra/llinventory/llsettingssky.cpp | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 8b969d81a6..26e2901968 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -353,7 +353,7 @@ protected: virtual validation_list_t getValidationList() const = 0; // Apply any settings that need special handling. - virtual void applySpecial(void *) { }; + virtual void applySpecial(void *, bool force = false) { }; virtual parammapping_t getParameterMap() const { return parammapping_t(); } diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 9bbeb00efe..c4ce3af157 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1326,26 +1326,13 @@ void LLSettingsSky::calculateLightSettings() const componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); componentMultBy(sunlight, light_transmittance); - //F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]); - //if (max_color > 1.0f) - //{ - // sunlight *= 1.0f/max_color; - //} - //increase ambient when there are more clouds LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5; - componentMultBy(tmpAmbient, light_transmittance); - - //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f); - //max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]); - //if (max_color > 1.0f) - //{ - // tmpAmbient *= 1.0f/max_color; - //} //brightness of surface both sunlight and ambient mSunDiffuse = sunlight; mSunAmbient = tmpAmbient; + F32 haze_horizon = getHazeHorizon(); sunlight *= 1.0 - cloud_shadow; @@ -1360,12 +1347,11 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty)); - //clampColor(moonlight, getGamma(), 1.0f); mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness; - mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f; + mMoonAmbient = moonlight_b * 0.0125f; - mTotalAmbient = mSunAmbient; + mTotalAmbient = ambient; } LLUUID LLSettingsSky::GetDefaultAssetId() -- cgit v1.2.3 From b3e11083cc31abfa7cebf2c3acc6aeebfc1f4205 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 19 Dec 2019 18:04:32 -0700 Subject: SL-11606 fix to match EEP light falloff vs release --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c4ce3af157..8d0b37d01f 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1000,7 +1000,7 @@ LLVector3 LLSettingsSky::getLightDirection() const return mMoonDirection; } - return -LLVector3::z_axis; + return LLVector3::z_axis_neg; } LLColor3 LLSettingsSky::getLightDiffuse() const -- cgit v1.2.3 From 16699fe8a563202c9b53b2f8e80a49c336b518d4 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 23 Jan 2020 16:29:43 +0200 Subject: SL-12591 Fixed float comparison --- indra/llinventory/llsettingsdaycycle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index b80e74791e..8498425f4e 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -724,7 +724,7 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::TrackPo return false; } - if (old_frame == new_frame) + if (llabs(old_frame - new_frame) < F_APPROXIMATELY_ZERO) { return false; } -- cgit v1.2.3 From d16a79fc4c5d5af016db6c97efc3a7b2d08f62ce Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 24 Feb 2020 21:22:21 +0200 Subject: SL-12741 Moon was using fixed color --- indra/llinventory/llsettingssky.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8d0b37d01f..306c732920 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1277,11 +1277,7 @@ LLColor4 LLSettingsSky::getTotalAmbient() const LLColor3 LLSettingsSky::getMoonlightColor() const { - F32 moon_brightness = getIsMoonUp() ? getMoonBrightness() : 0.001f; - LLColor3 moonlight_a(0.9, 0.9, 1.32); - LLColor3 moonlight_b(0.66, 0.66, 2.0); - LLColor3 moonlight = lerp(moonlight_b, moonlight_a, moon_brightness); - return moonlight; + return getSunlightColor(); //moon and sun share light color } void LLSettingsSky::clampColor(LLColor3& color, F32 gamma, F32 scale) const -- cgit v1.2.3 From a7849c6ec4fa31597121e7c8601fe427e222db0b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 26 Mar 2020 18:09:09 +0200 Subject: Removed obsolete and misleading variable --- indra/llinventory/llsettingsbase.cpp | 2 -- indra/llinventory/llsettingsbase.h | 1 - indra/llinventory/llsettingsdaycycle.h | 2 -- 3 files changed, 5 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index af3e84fd0f..ec26959718 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -67,7 +67,6 @@ const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0); LLSettingsBase::LLSettingsBase(): mSettings(LLSD::emptyMap()), mDirty(true), - mAssetID(), mBlendedFactor(0.0) { } @@ -75,7 +74,6 @@ LLSettingsBase::LLSettingsBase(): LLSettingsBase::LLSettingsBase(const LLSD setting) : mSettings(setting), mDirty(true), - mAssetID(), mBlendedFactor(0.0) { } diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 26e2901968..56e28fc899 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -359,7 +359,6 @@ protected: LLSD mSettings; bool mIsValid; - LLAssetID mAssetID; LLSD cloneSettings() const; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 8776f6725d..f7f5bb63b6 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -146,8 +146,6 @@ private: LLSettingsBase::Seconds mLastUpdateTime; - void parseFromLLSD(LLSD &data); - static CycleTrack_t::iterator getEntryAtOrBefore(CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe); static CycleTrack_t::iterator getEntryAtOrAfter(CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe); TrackBound_t getBoundingEntries(CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe); -- cgit v1.2.3 From 6620211bff5dca7df0667cf9220da1a9e7ce079c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 27 Mar 2020 00:13:33 +0200 Subject: SL-12911 Add Debug setting EnvironmentPersistAcrossLogin --- indra/llinventory/llsettingsbase.cpp | 1 + indra/llinventory/llsettingsbase.h | 1 + indra/llinventory/llsettingsdaycycle.cpp | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index ec26959718..61b59e35aa 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -39,6 +39,7 @@ namespace } const LLSettingsBase::TrackPosition LLSettingsBase::INVALID_TRACKPOS(-1.0); +const std::string LLSettingsBase::DEFAULT_SETTINGS_NAME("_default_"); //========================================================================= std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings) diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 56e28fc899..1d118f0789 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -64,6 +64,7 @@ public: typedef F64 BlendFactor; typedef F32 TrackPosition; // 32-bit as these are stored in LLSD as such static const TrackPosition INVALID_TRACKPOS; + static const std::string DEFAULT_SETTINGS_NAME; static const std::string SETTING_ID; static const std::string SETTING_NAME; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 8498425f4e..457e5b7478 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -408,7 +408,7 @@ LLSD LLSettingsDay::defaults() if (dfltsetting.size() == 0) { - dfltsetting[SETTING_NAME] = "_default_"; + dfltsetting[SETTING_NAME] = DEFAULT_SETTINGS_NAME; dfltsetting[SETTING_TYPE] = "daycycle"; LLSD frames(LLSD::emptyMap()); @@ -421,7 +421,7 @@ LLSD LLSettingsDay::defaults() F32 time = 0.0f; for (U32 i = 0; i < FRAME_COUNT; i++) { - std::string name("_default_"); + std::string name(DEFAULT_SETTINGS_NAME); name += ('a' + i); std::string water_frame_name("water:"); -- cgit v1.2.3