From de622ea576e106382d59e38cb966fe1a29f80ec0 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 19 Oct 2017 11:24:16 -0700 Subject: Put the timer block back in. --- indra/newview/llsettingsdaycycle.cpp | 32 ++++++++++++++++++++++++++++++++ indra/newview/llsettingsdaycycle.h | 28 ++++++++++++++++++++++++++++ indra/newview/llsettingswater.cpp | 8 ++++---- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/indra/newview/llsettingsdaycycle.cpp b/indra/newview/llsettingsdaycycle.cpp index 859fc5822f..abf73877ed 100644 --- a/indra/newview/llsettingsdaycycle.cpp +++ b/indra/newview/llsettingsdaycycle.cpp @@ -42,6 +42,10 @@ #include "llagent.h" #include "pipeline.h" + +#include "llsettingssky.h" +#include "llsettingswater.h" + //========================================================================= namespace { @@ -50,7 +54,10 @@ namespace } //========================================================================= +const std::string LLSettingsDayCycle::SETTING_DAYLENGTH("day_length"); +const S32 LLSettingsDayCycle::MINIMUM_DAYLENGTH( 14400); // 4 hours +const S32 LLSettingsDayCycle::MAXIMUM_DAYLENGTH(604800); // 7 days //========================================================================= LLSettingsDayCycle::LLSettingsDayCycle(const LLSD &data) : @@ -104,6 +111,14 @@ LLSettingsDayCycle::ptr_t LLSettingsDayCycle::buildClone() return dayp; } +//========================================================================= +F32 LLSettingsDayCycle::secondsToOffset(S32 seconds) +{ + S32 daylength = getDayLength(); + + return static_cast(seconds % daylength) / static_cast(daylength); +} + //========================================================================= void LLSettingsDayCycle::updateSettings() { @@ -111,3 +126,20 @@ void LLSettingsDayCycle::updateSettings() } //========================================================================= +void LLSettingsDayCycle::setDayLength(S32 seconds) +{ + seconds = llclamp(seconds, MINIMUM_DAYLENGTH, MAXIMUM_DAYLENGTH); + + setValue(SETTING_DAYLENGTH, seconds); +} + +void LLSettingsDayCycle::setWaterAt(const LLSettingsSkyPtr_t &water, S32 seconds) +{ +// F32 offset = secondsToOffset(seconds); + +} + +void setSkyAtOnTrack(const LLSettingsSkyPtr_t &water, S32 seconds, S32 track) +{ + +} diff --git a/indra/newview/llsettingsdaycycle.h b/indra/newview/llsettingsdaycycle.h index c562844bca..9aaa30c24f 100644 --- a/indra/newview/llsettingsdaycycle.h +++ b/indra/newview/llsettingsdaycycle.h @@ -30,9 +30,19 @@ #include "llsettingsbase.h" +class LLSettingsWater; +class LLSettingsSky; + +typedef boost::shared_ptr LLSettingsWaterPtr_t; +typedef boost::shared_ptr LLSettingsSkyPtr_t; + class LLSettingsDayCycle : public LLSettingsBase { public: + static const std::string SETTING_DAYLENGTH; + + static const S32 MINIMUM_DAYLENGTH; + static const S32 MAXIMUM_DAYLENGTH; typedef boost::shared_ptr ptr_t; @@ -53,14 +63,32 @@ public: static LLSD defaults(); //--------------------------------------------------------------------- + S32 getDayLength() const + { + return mSettings[SETTING_DAYLENGTH].asInteger(); + } + + void setDayLength(S32 seconds); + + void setWaterAt(const LLSettingsSkyPtr_t &water, S32 seconds); + void setSkyAtOnTrack(const LLSettingsSkyPtr_t &water, S32 seconds, S32 track); + //--------------------------------------------------------------------- protected: LLSettingsDayCycle(); virtual void updateSettings(); + typedef std::map CycleTrack_t; + typedef std::vector CycleList_t; + typedef std::pair TrackBound_t; + + CycleList_t mDayTracks; + + F32 secondsToOffset(S32 seconds); private: + }; #endif diff --git a/indra/newview/llsettingswater.cpp b/indra/newview/llsettingswater.cpp index 9b7d4dd647..d6b1234336 100644 --- a/indra/newview/llsettingswater.cpp +++ b/indra/newview/llsettingswater.cpp @@ -43,11 +43,11 @@ #include "pipeline.h" //========================================================================= -// namespace -// { +namespace +{ // LLTrace::BlockTimerStatHandle FTM_BLEND_WATERVALUES("Blending Water Environment"); -// LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERVALUES("Update Water Environment"); -// } + LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERVALUES("Update Water Environment"); +} //========================================================================= const std::string LLSettingsWater::SETTING_BLUR_MULTIPILER("blur_multiplier"); -- cgit v1.2.3