-
Notifications
You must be signed in to change notification settings - Fork 203
tweak(gui): Decouple GUI transition and world animation timing from render update #2056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
95357c3
cff9563
e6cd525
901bd6c
5e51f64
e5c8d45
c714914
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,7 @@ | |
| #include "GameClient/GameWindowTransitions.h" | ||
| #include "GameClient/GameWindow.h" | ||
| #include "GameClient/GameWindowManager.h" | ||
| #include "Common/FramePacer.h" | ||
| //----------------------------------------------------------------------------- | ||
| // DEFINES //////////////////////////////////////////////////////////////////// | ||
| //----------------------------------------------------------------------------- | ||
|
|
@@ -239,7 +240,7 @@ Int TransitionWindow::getTotalFrames( void ) | |
| //----------------------------------------------------------------------------- | ||
| TransitionGroup::TransitionGroup( void ) | ||
| { | ||
| m_currentFrame = 0; | ||
| m_currentFrame = 0.0f; | ||
| m_fireOnce = FALSE; | ||
| } | ||
|
|
||
|
|
@@ -256,7 +257,7 @@ TransitionGroup::~TransitionGroup( void ) | |
|
|
||
| void TransitionGroup::init( void ) | ||
| { | ||
| m_currentFrame = 0; | ||
| m_currentFrame = 0.0f; | ||
| m_directionMultiplier = 1; | ||
| TransitionWindowList::iterator it = m_transitionWindowList.begin(); | ||
| while (it != m_transitionWindowList.end()) | ||
|
|
@@ -270,13 +271,34 @@ void TransitionGroup::init( void ) | |
|
|
||
| void TransitionGroup::update( void ) | ||
| { | ||
| m_currentFrame += m_directionMultiplier; // we go forward or backwards depending. | ||
| TransitionWindowList::iterator it = m_transitionWindowList.begin(); | ||
| while (it != m_transitionWindowList.end()) | ||
| // TheSuperHackers @tweak bobtista GUI transition timing is now decoupled from the render update. | ||
| // Step every integer frame between the old and new accumulator value so discrete-state-machine | ||
| // transitions cannot skip a state when the render frame rate dips below the base rate. | ||
| const Real timeScale = TheFramePacer->getBaseOverUpdateFpsRatio(); | ||
| const Int prevFrame = (Int)m_currentFrame; | ||
| m_currentFrame += m_directionMultiplier * timeScale; | ||
| const Int newFrame = (Int)m_currentFrame; | ||
|
|
||
| if( newFrame == prevFrame ) | ||
| { | ||
| TransitionWindow *tWin = *it; | ||
| tWin->update(m_currentFrame); | ||
| it++; | ||
| return; | ||
| } | ||
|
|
||
| const Int step = (newFrame > prevFrame) ? 1 : -1; | ||
| for( Int frame = prevFrame + step; frame != newFrame + step; frame += step ) | ||
| { | ||
| TransitionWindowList::iterator it = m_transitionWindowList.begin(); | ||
| while (it != m_transitionWindowList.end()) | ||
| { | ||
| TransitionWindow *tWin = *it; | ||
| tWin->update(frame); | ||
| it++; | ||
| } | ||
|
|
||
| if( isFinished() ) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This goes through the list a second time. This can probably be optimized by returning finished result in update function above and then use that to determine finished status. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or just check isFinished for each transition group after each update. |
||
| { | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -315,7 +337,7 @@ void TransitionGroup::reverse( void ) | |
| tWin->reverse(totalFrames); | ||
| it++; | ||
| } | ||
| m_currentFrame = totalFrames; | ||
| m_currentFrame = (Real)totalFrames; | ||
| // m_currentFrame ++; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.