diff options
Diffstat (limited to 'indra/llinventory/llsettingsbase.h')
-rw-r--r-- | indra/llinventory/llsettingsbase.h | 79 |
1 files changed, 52 insertions, 27 deletions
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 2220cca336..ee0a86010c 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -264,67 +264,92 @@ public: typedef boost::signals2::signal<void(const ptr_t )> finish_signal_t; typedef boost::signals2::connection connection_t; - static const F64Seconds DEFAULT_THRESHOLD; - LLSettingsBlender(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, F64 span = 1.0) : + mOnFinished(), mTarget(target), mInitial(initsetting), - mFinal(endsetting), - mSeconds(seconds), - mOnFinished(), - mLastUpdate(0.0f), - mTimeSpent(0.0f) + mFinal(endsetting) { mTarget->replaceSettings(mInitial->getSettings()); - mTimeStart = F64Seconds(LLDate::now().secondsSinceEpoch()); - mLastUpdate = mTimeStart; } - ~LLSettingsBlender() {} + virtual ~LLSettingsBlender() {} - void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds ) + virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0) { mInitial = initsetting; mFinal = endsetting; - mSeconds = 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); } - LLSettingsBase::ptr_t getTarget() const + LLSettingsBase::ptr_t getTarget() const { return mTarget; } - LLSettingsBase::ptr_t getInitial() const + LLSettingsBase::ptr_t getInitial() const { return mInitial; } - LLSettingsBase::ptr_t getFinal() const + LLSettingsBase::ptr_t getFinal() const { return mFinal; } - void update(F64Seconds time); + connection_t setOnFinished(const finish_signal_t::slot_type &onfinished) + { + return mOnFinished.connect(onfinished); + } + + virtual void update(F64 blendf); + virtual F64 setPosition(F64 blendf); private: + finish_signal_t mOnFinished; + LLSettingsBase::ptr_t mTarget; LLSettingsBase::ptr_t mInitial; LLSettingsBase::ptr_t mFinal; - F64Seconds mSeconds; - finish_signal_t mOnFinished; +}; + +class LLSettingsBlenderTimeDelta : public LLSettingsBlender +{ +public: + LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target, + const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds) : + LLSettingsBlender(target, initsetting, endsetting, seconds.value()), + mBlendSpan(seconds), + mLastUpdate(0.0f), + mTimeSpent(0.0f) + { + mTimeStart = F64Seconds(LLDate::now().secondsSinceEpoch()); + mLastUpdate = mTimeStart; + } + + virtual ~LLSettingsBlenderTimeDelta() + { + } + + virtual void reset(LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0) override + { + LLSettingsBlender::reset(initsetting, endsetting, span); + + mBlendSpan.value(span); + mTimeStart.value(LLDate::now().secondsSinceEpoch()); + mLastUpdate = mTimeStart; + mTimeSpent.value(0.0f); + } + + virtual void update(F64 timedelta) override; + +private: + F64Seconds mBlendSpan; F64Seconds mLastUpdate; F64Seconds mTimeSpent; F64Seconds mTimeStart; }; + #endif |