diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llsettingsdaycycle.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llsettingsdaycycle.h | 28 | ||||
-rw-r--r-- | 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) : @@ -105,9 +112,34 @@ LLSettingsDayCycle::ptr_t LLSettingsDayCycle::buildClone() } //========================================================================= +F32 LLSettingsDayCycle::secondsToOffset(S32 seconds) +{ + S32 daylength = getDayLength(); + + return static_cast<F32>(seconds % daylength) / static_cast<F32>(daylength); +} + +//========================================================================= 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<LLSettingsWater> LLSettingsWaterPtr_t; +typedef boost::shared_ptr<LLSettingsSky> 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<LLSettingsDayCycle> 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<F32, LLSettingsBase::ptr_t> CycleTrack_t; + typedef std::vector<CycleTrack_t> CycleList_t; + typedef std::pair<CycleTrack_t::iterator, CycleTrack_t::iterator> 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"); |