summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-07-11 16:46:14 -0700
committerRider Linden <rider@lindenlab.com>2018-07-11 16:46:14 -0700
commitca5d5be4fb51fa1ee7ffda24a0aa58c71facd7dd (patch)
tree12d3778f18c0fa2b1a2fea182abf3fa370f7fdab
parentd8ca452163256344aac51fed1f3141eb33fe5412 (diff)
Minor change from the simulator to throttle the minimum blend in a time based blend.
-rw-r--r--indra/llinventory/llsettingsbase.cpp10
-rw-r--r--indra/llinventory/llsettingsbase.h11
2 files changed, 19 insertions, 2 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index f282f0c7dc..8bcf8a4973 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -607,6 +607,8 @@ void LLSettingsBlender::triggerComplete()
}
//-------------------------------------------------------------------------
+const LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::MIN_BLEND_DELTA(0.001);
+
LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const
{
return LLSettingsBase::BlendFactor(fmod((F64)spanpos, (F64)spanlen) / (F64)spanlen);
@@ -629,9 +631,15 @@ void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& t
return;
}
+ LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan);
mTimeDeltaPassed = LLSettingsBase::Seconds(0.0);
- LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan);
+ if (fabs(mLastBlendF - blendf) < mBlendFMinDelta)
+ {
+ return;
+ }
+
+ mLastBlendF = blendf;
update(blendf);
}
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 6c3b9e23ee..a74579e7a6 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -57,6 +57,8 @@ class LLSettingsBase :
friend std::ostream &operator <<(std::ostream& os, LLSettingsBase &settings);
+protected:
+ LOG_CLASS(LLSettingsBase);
public:
typedef F64Seconds Seconds;
typedef F64 BlendFactor;
@@ -384,6 +386,8 @@ class LLSettingsBlenderTimeDelta : public LLSettingsBlender
{
LOG_CLASS(LLSettingsBlenderTimeDelta);
public:
+ static const LLSettingsBase::BlendFactor MIN_BLEND_DELTA;
+
LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target,
const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, const LLSettingsBase::Seconds& blend_span) :
LLSettingsBlender(target, initsetting, endsetting),
@@ -392,7 +396,9 @@ public:
mTimeSpent(0.0f),
mTimeDeltaThreshold(0.0f),
mTimeDeltaPassed(0.0f),
- mIgnoreTimeDelta(false)
+ mIgnoreTimeDelta(false),
+ mBlendFMinDelta(MIN_BLEND_DELTA),
+ mLastBlendF(-1.0f)
{
mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch());
mLastUpdate = mTimeStart;
@@ -411,6 +417,7 @@ public:
mLastUpdate = mTimeStart;
mTimeSpent = LLSettingsBase::Seconds(0.0f);
mTimeDeltaPassed = LLSettingsBase::Seconds(0.0f);
+ mLastBlendF = LLSettingsBase::BlendFactor(-1.0f);
}
virtual void applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE;
@@ -439,6 +446,8 @@ protected:
LLSettingsBase::Seconds mTimeDeltaThreshold;
LLSettingsBase::Seconds mTimeDeltaPassed;
bool mIgnoreTimeDelta;
+ LLSettingsBase::BlendFactor mBlendFMinDelta;
+ LLSettingsBase::BlendFactor mLastBlendF;
};