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:
Aleric Inglewood
2011-08-01 21:00:27 +02:00
committed by Siana Gearz
parent 7a739f4915
commit dfa10281ea
19 changed files with 189 additions and 191 deletions

View File

@@ -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 );