diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2018-10-15 16:41:47 +0100 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2018-10-15 16:41:47 +0100 |
commit | 34770cbf2ef34b7901552057a0823e502d42be1d (patch) | |
tree | c8533a2f1826a1e776263ad2979253d47c631b90 | |
parent | 1f09b90a9d5a75d7d393b55aba674e023b8cd707 (diff) |
SL-9805 - reduce frequency of dynamic box updates to every N frames, staggered. Currently N is 4.
-rw-r--r-- | indra/newview/llvoavatar.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llvoavatar.h | 1 |
2 files changed, 21 insertions, 1 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 02eae56643..321f774210 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1271,8 +1271,18 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) calculateSpatialExtents(newMin,newMax); mLastAnimExtents[0].set(newMin.getF32ptr()); mLastAnimExtents[1].set(newMax.getF32ptr()); + mLastAnimBasePos = mPelvisp->getWorldPosition(); mNeedsExtentUpdate = false; } + else + { + LLVector3 new_base_pos = mPelvisp->getWorldPosition(); + LLVector3 shift = new_base_pos-mLastAnimBasePos; + mLastAnimExtents[0] += shift; + mLastAnimExtents[1] += shift; + mLastAnimBasePos = new_base_pos; + + } if (isImpostor() && !needsImpostorUpdate()) { @@ -2443,7 +2453,16 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) } // Update should be happening max once per frame. - mNeedsExtentUpdate = true; + const S32 upd_freq = 4; // force update every upd_freq frames. + if ((mLastAnimExtents[0]==LLVector3())|| + (mLastAnimExtents[1])==LLVector3()) + { + mNeedsExtentUpdate = true; + } + else + { + mNeedsExtentUpdate = ((LLDrawable::getCurrentFrame()+mID.mData[0])%upd_freq==0); + } LLScopedContextString str("avatar_idle_update " + getFullname()); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 8c1242421e..deb22617a4 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -543,6 +543,7 @@ private: F32 mImpostorDistance; F32 mImpostorPixelArea; LLVector3 mLastAnimExtents[2]; + LLVector3 mLastAnimBasePos; LLCachedControl<bool> mRenderUnloadedAvatar; |