diff options
author | Rider Linden <rider@lindenlab.com> | 2018-01-08 15:10:25 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-01-08 15:10:25 -0800 |
commit | 8211f57205f0008d8ffb9bfcd465ca26d906e19c (patch) | |
tree | d5ab9820e70d6828220841141abad38c548759ba /indra/llinventory | |
parent | 1df10afa2a7802763330475e1a90547c3cff7c06 (diff) |
MAINT-7699: Deliver new settings to viewer via cap
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 16 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.h | 39 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 41 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.h | 28 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 2 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.h | 10 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.cpp | 2 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.h | 23 |
8 files changed, 103 insertions, 58 deletions
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<LLSettingsBase *>(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<std::string> 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<void(const ptr_t &)> 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<F32>(seconds.value() % daylength.value()) / static_cast<F32>(daylength.value()), 0.0f, 1.0f); + return llclamp(static_cast<F32>((seconds.value() + dayoffset.value()) % daylength.value()) / static_cast<F32>(daylength.value()), 0.0f, 1.0f); } F64Seconds LLSettingsDay::keyframeToSeconds(F32 keyframe) { S64Seconds daylength = getDayLength(); + S64Seconds dayoffset = getDayOffset(); - return F64Seconds(static_cast<S32>(keyframe * static_cast<F32>(daylength.value()))); + return F64Seconds(static_cast<S64>(keyframe * static_cast<F32>(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<LLSettingsSky>(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<LLSettingsWater>(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 |