LLFrameTimer review and resulting changes.
This makes the class API a bit more sane, although only a bit, because I had to leave it working with possibly new code merged in from LL: the API can't really change. I also removed some unused code. While reviewing how LLFrameTimer worked however, I did find a few instances where things where broken: * sFrameDeltaTime wasn't correctly updated (more than once per frame and therefore erratic). This only influenced scrolling speed, but still. * While dragging an inventory item, the scroll arrows of a tab container didn't work (LLTabContainer::handleDragAndDrop). * Map zoom interpolation was broken (it interpolated between A and B, but used the already updated interpolation for A the next frame... (added mCurZoomValInterpolationStart).
This commit is contained in:
committed by
Siana Gearz
parent
7a739f4915
commit
dfa10281ea
@@ -3545,8 +3545,7 @@ void LLAppViewer::idle()
|
||||
// Update frame timers
|
||||
static LLTimer idle_timer;
|
||||
|
||||
LLFrameTimer::updateFrameTime();
|
||||
LLFrameTimer::updateFrameCount();
|
||||
LLFrameTimer::updateFrameTimeAndCount();
|
||||
LLEventTimer::updateClass();
|
||||
LLCriticalDamp::updateInterpolants();
|
||||
LLMortician::updateClass();
|
||||
|
||||
@@ -91,7 +91,7 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const std::string& name, const ESpeakerTy
|
||||
|
||||
gVoiceClient->setUserVolume(id, LLMuteList::getInstance()->getSavedResidentVolume(id));
|
||||
|
||||
mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT);
|
||||
mActivityTimer.reset(SPEAKER_TIMEOUT);
|
||||
}
|
||||
|
||||
|
||||
@@ -1021,7 +1021,7 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
|
||||
{
|
||||
// keep highest priority status (lowest value) instead of overriding current value
|
||||
speakerp->mStatus = llmin(speakerp->mStatus, status);
|
||||
speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT);
|
||||
speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT);
|
||||
// RN: due to a weird behavior where IMs from attached objects come from the wearer's agent_id
|
||||
// we need to override speakers that we think are objects when we find out they are really
|
||||
// residents
|
||||
@@ -1329,7 +1329,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
|
||||
{
|
||||
speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL;
|
||||
speakerp->mDotColor = INACTIVE_COLOR;
|
||||
speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT);
|
||||
speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT);
|
||||
}
|
||||
else if (agent_data["transition"].asString() == "ENTER")
|
||||
{
|
||||
@@ -1377,7 +1377,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update)
|
||||
{
|
||||
speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL;
|
||||
speakerp->mDotColor = INACTIVE_COLOR;
|
||||
speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT);
|
||||
speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT);
|
||||
}
|
||||
else if ( agent_transition == "ENTER")
|
||||
{
|
||||
@@ -1476,7 +1476,7 @@ void LLLocalSpeakerMgr::updateSpeakerList()
|
||||
{
|
||||
speakerp->mStatus = LLSpeaker::STATUS_NOT_IN_CHANNEL;
|
||||
speakerp->mDotColor = INACTIVE_COLOR;
|
||||
speakerp->mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT);
|
||||
speakerp->mActivityTimer.reset(SPEAKER_TIMEOUT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,6 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :
|
||||
mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR)
|
||||
{
|
||||
setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality"));
|
||||
mSnapshotDelayTimer.setTimerExpirySec(0.0f);
|
||||
mSnapshotDelayTimer.start();
|
||||
// gIdleCallbacks.addFunction( &LLSnapshotLivePreview::onIdle, (void*)this );
|
||||
sList.insert(this);
|
||||
@@ -350,8 +349,7 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail
|
||||
mShineAnimTimer.stop();
|
||||
if (new_snapshot)
|
||||
{
|
||||
mSnapshotDelayTimer.start();
|
||||
mSnapshotDelayTimer.setTimerExpirySec(delay);
|
||||
mSnapshotDelayTimer.start(delay);
|
||||
}
|
||||
if(new_thumbnail)
|
||||
{
|
||||
@@ -754,7 +752,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
|
||||
|
||||
// see if it's time yet to snap the shot and bomb out otherwise.
|
||||
previewp->mSnapshotActive =
|
||||
(previewp->mSnapshotDelayTimer.getStarted() && previewp->mSnapshotDelayTimer.hasExpired())
|
||||
(previewp->mSnapshotDelayTimer.getStarted() && previewp->mSnapshotDelayTimer.hasExpired())
|
||||
&& !LLToolCamera::getInstance()->hasMouseCapture(); // don't take snapshots while ALT-zoom active
|
||||
if ( ! previewp->mSnapshotActive)
|
||||
{
|
||||
|
||||
@@ -502,17 +502,26 @@ void LLFloaterWorldMap::draw()
|
||||
getDragHandle()->setMouseOpaque(TRUE);
|
||||
|
||||
//RN: snaps to zoom value because interpolation caused jitter in the text rendering
|
||||
if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)childGetValue("zoom slider").asReal())
|
||||
F32 interp = 1.f;
|
||||
if (!mZoomTimer.getStarted())
|
||||
{
|
||||
mZoomTimer.start();
|
||||
mCurZoomValInterpolationStart = mCurZoomVal;
|
||||
if (mCurZoomVal < (F32)childGetValue("zoom slider").asReal())
|
||||
{
|
||||
mZoomTimer.start();
|
||||
}
|
||||
}
|
||||
F32 interp = mZoomTimer.getElapsedTimeF32() / MAP_ZOOM_TIME;
|
||||
if (interp > 1.f)
|
||||
if (mZoomTimer.getStarted())
|
||||
{
|
||||
interp = mZoomTimer.getElapsedTimeF32() / MAP_ZOOM_TIME;
|
||||
}
|
||||
if (interp >= 1.f)
|
||||
{
|
||||
interp = 1.f;
|
||||
mZoomTimer.stop();
|
||||
}
|
||||
mCurZoomVal = lerp(mCurZoomVal, (F32)childGetValue("zoom slider").asReal(), interp);
|
||||
// Interpolate between mCurZoomValInterpolationStart and "zoom slider".
|
||||
mCurZoomVal = lerp(mCurZoomValInterpolationStart, (F32)childGetValue("zoom slider").asReal(), interp);
|
||||
F32 map_scale = 256.f*pow(2.f, mCurZoomVal);
|
||||
LLWorldMapView::setScale( map_scale );
|
||||
|
||||
|
||||
@@ -164,6 +164,7 @@ protected:
|
||||
|
||||
// Sets sMapScale, in pixels per region
|
||||
F32 mCurZoomVal;
|
||||
F32 mCurZoomValInterpolationStart; // Used during mZoomTimer interpolation.
|
||||
LLFrameTimer mZoomTimer;
|
||||
|
||||
LLDynamicArray<LLUUID> mLandmarkAssetIDList;
|
||||
|
||||
@@ -396,9 +396,8 @@ void LLPanelMediaHUD::updateShape()
|
||||
}
|
||||
}
|
||||
// If we need to start fading the UI (and we have not already started)
|
||||
else if(! mFadeTimer.getStarted())
|
||||
else if (!mFadeTimer.getStarted())
|
||||
{
|
||||
mFadeTimer.reset();
|
||||
mFadeTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,8 +446,7 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success,
|
||||
}
|
||||
else
|
||||
{
|
||||
self->mSavedFileTimer.reset();
|
||||
self->mSavedFileTimer.setTimerExpirySec( SECONDS_TO_SHOW_FILE_SAVED_MSG );
|
||||
self->mSavedFileTimer.reset(SECONDS_TO_SHOW_FILE_SAVED_MSG);
|
||||
}
|
||||
|
||||
self->mSaveFileName.clear();
|
||||
|
||||
@@ -683,8 +683,7 @@ void LLStatusBar::setBalance(S32 balance)
|
||||
|
||||
if( balance != mBalance )
|
||||
{
|
||||
mBalanceTimer->reset();
|
||||
mBalanceTimer->setTimerExpirySec( ICON_TIMER_EXPIRY );
|
||||
mBalanceTimer->reset(ICON_TIMER_EXPIRY);
|
||||
mBalance = balance;
|
||||
}
|
||||
}
|
||||
@@ -728,8 +727,7 @@ void LLStatusBar::setHealth(S32 health)
|
||||
}
|
||||
}
|
||||
|
||||
mHealthTimer->reset();
|
||||
mHealthTimer->setTimerExpirySec( ICON_TIMER_EXPIRY );
|
||||
mHealthTimer->reset(ICON_TIMER_EXPIRY);
|
||||
}
|
||||
|
||||
mHealth = health;
|
||||
|
||||
@@ -390,7 +390,7 @@ LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& uuid,
|
||||
mVersion(LLViewerInventoryCategory::VERSION_UNKNOWN),
|
||||
mDescendentCount(LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN)
|
||||
{
|
||||
mDescendentsRequested.reset();
|
||||
mDescendentsRequested.stop();
|
||||
}
|
||||
|
||||
LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& owner_id) :
|
||||
@@ -398,7 +398,7 @@ LLViewerInventoryCategory::LLViewerInventoryCategory(const LLUUID& owner_id) :
|
||||
mVersion(LLViewerInventoryCategory::VERSION_UNKNOWN),
|
||||
mDescendentCount(LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN)
|
||||
{
|
||||
mDescendentsRequested.reset();
|
||||
mDescendentsRequested.stop();
|
||||
}
|
||||
|
||||
LLViewerInventoryCategory::LLViewerInventoryCategory(const LLViewerInventoryCategory* other)
|
||||
@@ -489,12 +489,12 @@ bool LLViewerInventoryCategory::fetchDescendents()
|
||||
// <edit>
|
||||
if((mUUID == gSystemFolderRoot) || (gInventory.isObjectDescendentOf(mUUID, gSystemFolderRoot))) return false;
|
||||
// </edit>
|
||||
if((VERSION_UNKNOWN == mVersion)
|
||||
&& mDescendentsRequested.hasExpired()) //Expired check prevents multiple downloads.
|
||||
if (VERSION_UNKNOWN == mVersion &&
|
||||
(!mDescendentsRequested.getStarted() ||
|
||||
mDescendentsRequested.hasExpired())) // Expired check prevents multiple downloads.
|
||||
{
|
||||
const F32 FETCH_TIMER_EXPIRY = 10.0f;
|
||||
mDescendentsRequested.reset();
|
||||
mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY);
|
||||
mDescendentsRequested.start(FETCH_TIMER_EXPIRY);
|
||||
|
||||
// bitfield
|
||||
// 1 = by date
|
||||
|
||||
@@ -3964,7 +3964,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
|
||||
}
|
||||
//idle text
|
||||
std::string idle_string;
|
||||
if(!mIsSelf && mIdleTimer.getElapsedTimeF32() > 120 && gSavedSettings.getBOOL("AscentShowIdleTime"))
|
||||
if(!mIsSelf && mIdleTimer.getElapsedTimeF32() > 120.f && gSavedSettings.getBOOL("AscentShowIdleTime"))
|
||||
{
|
||||
idle_string = getIdleTime();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user