diff options
author | Graham Linden <graham@lindenlab.com> | 2018-06-02 23:28:48 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-06-02 23:28:48 +0100 |
commit | 7136956b90614bbd236be0e30231781c04346220 (patch) | |
tree | 01c0a7477370652fdbdeebb5a3ad5d3a422e3929 | |
parent | 7d6743f42d09bfcc39c0930aa342638d8273b722 (diff) |
Use more typedefs to simplify sync between viewer and sim env settings code.
-rw-r--r-- | indra/llcommon/llmemory.cpp | 6 | ||||
-rw-r--r-- | indra/llcommon/llunittype.h | 37 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 51 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.h | 64 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 93 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.h | 65 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 40 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.h | 30 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.cpp | 19 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.h | 25 | ||||
-rw-r--r-- | indra/llmessage/llcircuit.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llenvironment.cpp | 45 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 7 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llpaneleditwater.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 13 |
16 files changed, 294 insertions, 226 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index b3debf3550..1884d6f04f 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -77,7 +77,7 @@ void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) //static void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure) { - sMaxHeapSizeInKB = max_heap_size; + sMaxHeapSizeInKB = U32Kilobytes::convert(max_heap_size); sEnableMemoryFailurePrevention = prevent_heap_failure ; } @@ -93,9 +93,9 @@ void LLMemory::updateMemoryInfo() return ; } - sAllocatedMemInKB = U64Bytes(counters.WorkingSetSize) ; + sAllocatedMemInKB = U32Kilobytes::convert(U64Bytes(counters.WorkingSetSize)); sample(sAllocatedMem, sAllocatedMemInKB); - sAllocatedPageSizeInKB = U64Bytes(counters.PagefileUsage) ; + sAllocatedPageSizeInKB = U32Kilobytes::convert(U64Bytes(counters.PagefileUsage)); sample(sVirtualMem, sAllocatedPageSizeInKB); U32Kilobytes avail_phys, avail_virtual; diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h index ac8504ca61..81f244e422 100644 --- a/indra/llcommon/llunittype.h +++ b/indra/llcommon/llunittype.h @@ -132,23 +132,34 @@ struct LLUnit return mValue; } - LL_FORCE_INLINE void value(storage_t value) + LL_FORCE_INLINE void value(const storage_t& value) { mValue = value; } template<typename NEW_UNITS> - storage_t valueInUnits() + storage_t valueInUnits() const { return LLUnit<storage_t, NEW_UNITS>(*this).value(); } template<typename NEW_UNITS> - void valueInUnits(storage_t value) + void valueInUnits(const storage_t& value) const { *this = LLUnit<storage_t, NEW_UNITS>(value); } + LL_FORCE_INLINE operator storage_t() const + { + return value(); + } + + /*LL_FORCE_INLINE self_t& operator= (storage_t v) + { + value(v); + return *this; + }*/ + LL_FORCE_INLINE void operator += (self_t other) { mValue += convert(other).mValue; @@ -159,60 +170,60 @@ struct LLUnit mValue -= convert(other).mValue; } - LL_FORCE_INLINE void operator *= (storage_t multiplicand) + LL_FORCE_INLINE void operator *= (const storage_t& multiplicand) { mValue *= multiplicand; } - LL_FORCE_INLINE void operator *= (self_t multiplicand) + LL_FORCE_INLINE void operator *= (const self_t& multiplicand) { // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE, "Multiplication of unit types not supported."); } - LL_FORCE_INLINE void operator /= (storage_t divisor) + LL_FORCE_INLINE void operator /= (const storage_t& divisor) { mValue /= divisor; } - void operator /= (self_t divisor) + void operator /= (const self_t& divisor) { // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE, "Illegal in-place division of unit types."); } template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> - LL_FORCE_INLINE bool operator == (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + LL_FORCE_INLINE bool operator == (const LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS>& other) const { return mValue == convert(other).value(); } template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> - LL_FORCE_INLINE bool operator != (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + LL_FORCE_INLINE bool operator != (const LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS>& other) const { return mValue != convert(other).value(); } template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> - LL_FORCE_INLINE bool operator < (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + LL_FORCE_INLINE bool operator < (const LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS>& other) const { return mValue < convert(other).value(); } template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> - LL_FORCE_INLINE bool operator <= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + LL_FORCE_INLINE bool operator <= (const LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS>& other) const { return mValue <= convert(other).value(); } template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> - LL_FORCE_INLINE bool operator > (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + LL_FORCE_INLINE bool operator > (const LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS>& other) const { return mValue > convert(other).value(); } template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> - LL_FORCE_INLINE bool operator >= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + LL_FORCE_INLINE bool operator >= (const LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS>& other) const { return mValue >= convert(other).value(); } 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<LLSD>{}(hash_settings); + boost::hash<LLSD> 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<LLSettingsBase>, + public PTR_NAMESPACE::enable_shared_from_this<LLSettingsBase>, 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<std::string, S32> parammapping_t; - typedef std::shared_ptr<LLSettingsBase> ptr_t; + typedef PTR_NAMESPACE::shared_ptr<LLSettingsBase> 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<LLSettingsBase *>(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<std::string> 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<LLSettingsBlender> +class LLSettingsBlender : public PTR_NAMESPACE::enable_shared_from_this<LLSettingsBlender> { public: - typedef std::shared_ptr<LLSettingsBlender> ptr_t; + typedef PTR_NAMESPACE::shared_ptr<LLSettingsBlender> ptr_t; typedef boost::signals2::signal<void(const ptr_t )> 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<typename T> + 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<std::string, LLSettingsBase::ptr_t>::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<LLSettingsWater>(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<LLSettingsSky>(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<LLSettingsWater> LLSettingsWaterPtr_t; -typedef std::shared_ptr<LLSettingsSky> LLSettingsSkyPtr_t; +typedef PTR_NAMESPACE::shared_ptr<LLSettingsWater> LLSettingsWaterPtr_t; +typedef PTR_NAMESPACE::shared_ptr<LLSettingsSky> 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<F32, LLSettingsBase::ptr_t> CycleTrack_t; - typedef std::vector<CycleTrack_t> CycleList_t; - typedef std::shared_ptr<LLSettingsDay> ptr_t; - typedef std::vector<F32> KeyframeList_t; - typedef std::pair<CycleTrack_t::iterator, CycleTrack_t::iterator> TrackBound_t; + typedef std::map<LLSettingsBase::TrackPosition, LLSettingsBase::ptr_t> CycleTrack_t; + typedef std::vector<CycleTrack_t> CycleList_t; + typedef PTR_NAMESPACE::shared_ptr<LLSettingsDay> ptr_t; + typedef PTR_NAMESPACE::weak_ptr<LLSettingsDay> wptr_t; + typedef std::vector<LLSettingsBase::TrackPosition> KeyframeList_t; + typedef std::pair<CycleTrack_t::iterator, CycleTrack_t::iterator> 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<LLSettingsSky>(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<LLSettingsSky> ptr_t; + typedef PTR_NAMESPACE::shared_ptr<LLSettingsSky> 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<LLSettingsWater>(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<LLSettingsWater> ptr_t; + typedef PTR_NAMESPACE::shared_ptr<LLSettingsWater> 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 diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index 8dbe2f8411..8baa2e328b 100644 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -543,7 +543,7 @@ void LLCircuitData::checkPeriodTime() mBytesOutLastPeriod = mBytesOutThisPeriod; mBytesInThisPeriod = S32Bytes(0); mBytesOutThisPeriod = S32Bytes(0); - mLastPeriodLength = period_length; + mLastPeriodLength = F32Seconds::convert(period_length); mPeriodTime = mt_sec; } @@ -1378,8 +1378,8 @@ F32Milliseconds LLCircuitData::getPingInTransitTime() if (mPingsInTransit) { - time_since_ping_was_sent = ((mPingsInTransit*mHeartbeatInterval - F32Seconds(1)) - + (LLMessageSystem::getMessageTimeSeconds() - mPingTime)); + time_since_ping_was_sent = F32Milliseconds::convert(((mPingsInTransit*mHeartbeatInterval - F32Seconds(1)) + + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))); } return time_since_ping_was_sent; diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 3b0bc4cd55..3f6241fa0b 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -66,7 +66,7 @@ namespace LLTrace::BlockTimerStatHandle FTM_SHADER_PARAM_UPDATE("Update Shader Parameters"); //--------------------------------------------------------------------- - inline F32 get_wrapping_distance(F32 begin, F32 end) + inline LLSettingsBase::TrackPosition get_wrapping_distance(LLSettingsBase::TrackPosition begin, LLSettingsBase::TrackPosition end) { if (begin < end) { @@ -74,13 +74,13 @@ namespace } else if (begin > end) { - return 1.0 - (begin - end); + return LLSettingsBase::TrackPosition(1.0) - (begin - end); } return 0; } - LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, F32 key) + LLSettingsDay::CycleTrack_t::iterator get_wrapping_atafter(LLSettingsDay::CycleTrack_t &collection, const LLSettingsBase::TrackPosition& key) { if (collection.empty()) return collection.end(); @@ -95,7 +95,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(); @@ -116,7 +116,7 @@ namespace return it; } - LLSettingsDay::TrackBound_t get_bounding_entries(LLSettingsDay::CycleTrack_t &track, F32 keyframe) + LLSettingsDay::TrackBound_t get_bounding_entries(LLSettingsDay::CycleTrack_t &track, const LLSettingsBase::TrackPosition& keyframe) { return LLSettingsDay::TrackBound_t(get_wrapping_atbefore(track, keyframe), get_wrapping_atafter(track, keyframe)); } @@ -144,7 +144,7 @@ namespace } - void switchTrack(S32 trackno, F64) override + void switchTrack(S32 trackno, const LLSettingsBase::BlendFactor&) override { S32 use_trackno = selectTrackNumber(trackno); @@ -159,17 +159,16 @@ namespace LLSettingsBase::Seconds now = getAdjustedNow() + LLEnvironment::TRANSITION_ALTITUDE; LLSettingsDay::TrackBound_t bounds = getBoundingEntries(now); - LLSettingsBase::ptr_t pendsetting = (*bounds.first).second->buildDerivedClone(); - F64 targetpos = convertTimeToPosition(now) - (*bounds.first).first; - F64 targetspan = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); + LLSettingsBase::ptr_t pendsetting = (*bounds.first).second->buildDerivedClone(); + LLSettingsBase::TrackPosition targetpos = convertTimeToPosition(now) - (*bounds.first).first; + LLSettingsBase::TrackPosition targetspan = get_wrapping_distance((*bounds.first).first, (*bounds.second).first); - F64 blendf = calculateBlend(targetpos, targetspan); + LLSettingsBase::BlendFactor blendf = calculateBlend(targetpos, targetspan); pendsetting->blend((*bounds.second).second, blendf); - reset(mTrackTransitionStart, pendsetting, LLEnvironment::TRANSITION_ALTITUDE.value()); + reset(mTrackTransitionStart, pendsetting, LLEnvironment::TRANSITION_ALTITUDE); } - protected: S32 selectTrackNumber(S32 trackno) { @@ -210,9 +209,9 @@ namespace return mCycleLength * get_wrapping_distance((*bounds.first).first, (*bounds.second).first); } - F64 convertTimeToPosition(LLSettingsBase::Seconds time) + LLSettingsBase::TrackPosition convertTimeToPosition(const LLSettingsBase::Seconds& time) { - F64 position = static_cast<F64>(fmod(time.value(), mCycleLength.value())) / static_cast<F64>(mCycleLength.value()); + F64 position = fmod((F64)time, (F64)mCycleLength) / (F64)mCycleLength; return llclamp(position, 0.0, 1.0); } @@ -223,11 +222,11 @@ namespace LLSettingsBase::Seconds mCycleOffset; LLSettingsBase::ptr_t mTrackTransitionStart; - void onFinishedSpan() + void onFinishedSpan() { LLSettingsDay::TrackBound_t next = getBoundingEntries(getAdjustedNow()); LLSettingsBase::Seconds nextspan = getSpanTime(next); - reset((*next.first).second, (*next.second).second, nextspan.value()); + reset((*next.first).second, (*next.second).second, nextspan); } }; @@ -241,10 +240,6 @@ const F32Seconds LLEnvironment::TRANSITION_SLOW(10.0f); const F32Seconds LLEnvironment::TRANSITION_ALTITUDE(5.0f); //*TODO* Change these when available on Agni (these are Damballah asset IDs). -const LLUUID LLEnvironment::KNOWN_SKY_DEFAULT(LLSettingsSky::DEFAULT_ASSET_ID); -const LLUUID LLEnvironment::KNOWN_WATER_DEFAULT(LLSettingsWater::DEFAULT_ASSET_ID); -const LLUUID LLEnvironment::KNOWN_DAY_DEFAULT(LLSettingsDay::DEFAULT_ASSET_ID); - const LLUUID LLEnvironment::KNOWN_SKY_SUNRISE("645d7475-19d6-d05c-6eb2-29eeacf76e06"); const LLUUID LLEnvironment::KNOWN_SKY_MIDDAY("68f5a7ec-2785-d9d8-be7c-cca93976759a"); const LLUUID LLEnvironment::KNOWN_SKY_SUNSET("06420773-757b-4b7c-a1f9-85fceb2f7bd4"); @@ -1741,7 +1736,7 @@ void LLEnvironment::DayInstance::setSkyTrack(S32 trackno) mSkyTrack = trackno; if (mBlenderSky) { - mBlenderSky->switchTrack(trackno); + mBlenderSky->switchTrack(trackno, 0.0); } } @@ -1803,7 +1798,7 @@ void LLEnvironment::DayInstance::animate() { mSky = LLSettingsVOSky::buildDefaultSky(); mBlenderSky = std::make_shared<LLTrackBlenderLoopingTime>(mSky, mDayCycle, 1, mDayLength, mDayOffset); - mBlenderSky->switchTrack(mSkyTrack); + mBlenderSky->switchTrack(mSkyTrack, 0.0); } } @@ -1869,7 +1864,7 @@ LLTrackBlenderLoopingManual::LLTrackBlenderLoopingManual(const LLSettingsBase::p } } -F64 LLTrackBlenderLoopingManual::setPosition(F64 position) +LLSettingsBase::BlendFactor LLTrackBlenderLoopingManual::setPosition(const LLSettingsBase::TrackPosition& position) { mPosition = llclamp(position, 0.0, 1.0); @@ -1891,11 +1886,11 @@ F64 LLTrackBlenderLoopingManual::setPosition(F64 position) return LLSettingsBlender::setPosition(blendf); } -void LLTrackBlenderLoopingManual::switchTrack(S32 trackno, F64 position) +void LLTrackBlenderLoopingManual::switchTrack(S32 trackno, const LLSettingsBase::TrackPosition& position) { mTrackNo = trackno; - F64 useposition = (position < 0.0) ? mPosition : position; + LLSettingsBase::TrackPosition useposition = (position < 0.0) ? mPosition : position; setPosition(useposition); } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 56be88f371..1be846b710 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -56,9 +56,6 @@ public: static const F32Seconds TRANSITION_SLOW; static const F32Seconds TRANSITION_ALTITUDE; - static const LLUUID KNOWN_SKY_DEFAULT; - static const LLUUID KNOWN_WATER_DEFAULT; - static const LLUUID KNOWN_DAY_DEFAULT; static const LLUUID KNOWN_SKY_SUNRISE; static const LLUUID KNOWN_SKY_MIDDAY; static const LLUUID KNOWN_SKY_SUNSET; @@ -413,8 +410,8 @@ class LLTrackBlenderLoopingManual : public LLSettingsBlender public: LLTrackBlenderLoopingManual(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno); - F64 setPosition(F64 position) override; - virtual void switchTrack(S32 trackno, F64 position) override; + F64 setPosition(const LLSettingsBase::TrackPosition& position) override; + virtual void switchTrack(S32 trackno, const LLSettingsBase::TrackPosition& position) override; S32 getTrack() const { return mTrackNo; } typedef std::shared_ptr<LLTrackBlenderLoopingManual> ptr_t; diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index cac9154c98..788f58d480 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -311,9 +311,9 @@ void LLFloaterEditExtDayCycle::onAddTrack() { // todo: 2.5% safety zone std::string sldr_key = mFramesSlider->getCurSlider(); - F32 frame = mTimeSlider->getCurSliderValue(); + LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); LLSettingsBase::ptr_t setting; - if (mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack).get() != NULL) + if (mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack) != nullptr) { return; } @@ -322,13 +322,15 @@ void LLFloaterEditExtDayCycle::onAddTrack() { // scratch water should always have the current water settings. setting = mScratchWater->buildClone(); - mEditDay->setWaterAtKeyframe(std::dynamic_pointer_cast<LLSettingsWater>(setting), frame); + LLSettingsWater::ptr_t water((LLSettingsWater*)setting.get()); + mEditDay->setWaterAtKeyframe(water, frame); } else { // scratch sky should always have the current sky settings. setting = mScratchSky->buildClone(); - mEditDay->setSkyAtKeyframe(std::dynamic_pointer_cast<LLSettingsSky>(setting), frame, mCurrentTrack); + LLSettingsSky::ptr_t sky((LLSettingsSky*)setting.get()); + mEditDay->setSkyAtKeyframe(sky, frame, mCurrentTrack); } addSliderFrame(frame, setting); @@ -657,7 +659,7 @@ void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable) void LLFloaterEditExtDayCycle::updateButtons() { - F32 frame = mTimeSlider->getCurSliderValue(); + LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); LLSettingsBase::ptr_t settings = mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack); bool can_add = settings.get() == NULL; mAddFrameButton->setEnabled(can_add); @@ -744,7 +746,8 @@ void LLFloaterEditExtDayCycle::removeCurrentSliderFrame() { LL_DEBUGS() << "Removing frame from " << iter->second.mFrame << LL_ENDL; mSliderKeyMap.erase(iter); - mEditDay->removeTrackKeyframe(mCurrentTrack, iter->second.mFrame); + LLSettingsBase::Seconds seconds(iter->second.mFrame); + mEditDay->removeTrackKeyframe(mCurrentTrack, seconds); } mLastFrameSlider = mFramesSlider->getCurSlider(); @@ -852,7 +855,7 @@ void LLFloaterEditExtDayCycle::syncronizeTabs() { // This should probably get moved into "updateTabs" - F32 frame = mTimeSlider->getCurSliderValue(); + LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); bool canedit(false); LLSettingsWater::ptr_t psettingWater; diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp index 940b171dfe..b0a300abe3 100644 --- a/indra/newview/llpaneleditwater.cpp +++ b/indra/newview/llpaneleditwater.cpp @@ -87,7 +87,7 @@ BOOL LLPanelSettingsWaterMainTab::postBuild() // getChild<LLUICtrl>(FIELD_WATER_FOG_DENSITY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogDensityChanged(getChild<LLUICtrl>(FIELD_WATER_FOG_DENSITY)->getValue().asReal()); }); getChild<LLUICtrl>(FIELD_WATER_UNDERWATER_MOD)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogUnderWaterChanged(); }); - mTxtNormalMap->setDefaultImageAssetID(LLSettingsWater::DEFAULT_WATER_NORMAL_ID); + mTxtNormalMap->setDefaultImageAssetID(LLSettingsWater::GetDefaultWaterNormalAssetId()); mTxtNormalMap->setCommitCallback([this](LLUICtrl *, const LLSD &) { onNormalMapChanged(); }); getChild<LLUICtrl>(FIELD_WATER_WAVE1_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onLargeWaveChanged(); }); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 0e3bc87719..5991c42c97 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -449,14 +449,13 @@ void LLSettingsVOSky::convertAtmosphericsToLegacy(LLSD& legacy, LLSD& settings) if (settings.has(SETTING_LEGACY_HAZE)) { LLSD legacyhaze = settings[SETTING_LEGACY_HAZE]; - - legacy[SETTING_AMBIENT] = ensureArray4(legacyhaze[SETTING_AMBIENT], 1.0f); - legacy[SETTING_BLUE_DENSITY] = ensureArray4(legacyhaze[SETTING_BLUE_DENSITY], 1.0); - legacy[SETTING_BLUE_HORIZON] = ensureArray4(legacyhaze[SETTING_BLUE_HORIZON], 1.0); - legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(legacyhaze[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); + legacy[SETTING_AMBIENT] = ensure_array_4(legacyhaze[SETTING_AMBIENT], 1.0f); + legacy[SETTING_BLUE_DENSITY] = ensure_array_4(legacyhaze[SETTING_BLUE_DENSITY], 1.0); + legacy[SETTING_BLUE_HORIZON] = ensure_array_4(legacyhaze[SETTING_BLUE_HORIZON], 1.0); + legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(legacyhaze[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(legacyhaze[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); - legacy[SETTING_HAZE_DENSITY] = LLSDArray(legacyhaze[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f); - legacy[SETTING_HAZE_HORIZON] = LLSDArray(legacyhaze[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f); + legacy[SETTING_HAZE_DENSITY] = LLSDArray(legacyhaze[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f); + legacy[SETTING_HAZE_HORIZON] = LLSDArray(legacyhaze[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f); } } |