diff options
author | Rider Linden <rider@lindenlab.com> | 2018-01-30 16:42:34 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-01-30 16:42:34 -0800 |
commit | 0bf50e2f8cfa5f3ccd6165ce935cf0fd9c174ced (patch) | |
tree | 4a161b5eaa5150775f13869d3d32ad5ae83d5904 /indra/llinventory | |
parent | fbd8a98300277bdbc1885c25eea290560fd8c6c1 (diff) |
Cleanup on daycyle selection and stack. Move blenders into environment.
(Transition bronken, instant only. Shaddows moved based on region, not parcel)
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/llparcel.cpp | 15 | ||||
-rw-r--r-- | indra/llinventory/llparcel.h | 16 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 2 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.h | 17 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 160 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.h | 50 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 2 |
7 files changed, 21 insertions, 241 deletions
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<U32>(), 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<S32>(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; @@ -457,23 +448,6 @@ LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track) } //========================================================================= -F32 LLSettingsDay::secondsToKeyframe(S64Seconds seconds) -{ - S64Seconds daylength = getDayLength(); - S64Seconds dayoffset = getDayOffset(); - - 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<S64>(keyframe * static_cast<F32>(daylength.value())) - dayoffset.value()); -} - -//========================================================================= void LLSettingsDay::startDayCycle() { F64Seconds now(LLDate::now().secondsSinceEpoch()); @@ -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<LLSettingsWater>((*(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<LLSettingsBlender>(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<LLSettingsSky>( (*(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<LLSettingsBlender>(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<LLSettingsBlender>(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<LLSettingsBlender>(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<LLSettingsSky> 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<F32, LLSettingsBase::ptr_t> CycleTrack_t; typedef std::vector<CycleTrack_t> CycleList_t; typedef boost::shared_ptr<LLSettingsDay> ptr_t; - typedef std::vector<S64Seconds> TimeList_t; typedef std::vector<F32> KeyframeList_t; typedef std::pair<CycleTrack_t::iterator, CycleTrack_t::iterator> 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; |