Skip to content

Commit

Permalink
UPBGE: Fix first frame timing gap.
Browse files Browse the repository at this point in the history
Previously when the engine started (StartEngine called) the
clock time and the frame time were set to the system real time.
But as the system (LA_System) was created before the conversion
of the blender data, at each run the engine started with a
different clock and frame time. This produce that render test
failed in most of case because animation were played with a
time gap due to the first frame.

To solve this issue the clock and frame time are let to 0 and
only m_previousRealTime is set in StartEngine. Indeed the
clock time is incremented in NextFrame based on m_previousRealTime
gap with current time and frame time is also incremented in the
same function.
  • Loading branch information
panzergame committed Aug 8, 2017
1 parent fa20294 commit 09866ee
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
4 changes: 0 additions & 4 deletions source/gameengine/Ketsji/KX_KetsjiEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem *system)
m_flags(AUTO_ADD_DEBUG_PROPERTIES),
m_frameTime(0.0f),
m_clockTime(0.0f),
m_previousClockTime(0.0f),
m_previousAnimTime(0.0f),
m_timescale(1.0f),
m_previousRealTime(0.0f),
Expand Down Expand Up @@ -234,9 +233,6 @@ void KX_KetsjiEngine::SetConverter(KX_BlenderConverter *converter)

void KX_KetsjiEngine::StartEngine()
{
m_clockTime = m_kxsystem->GetTimeInSeconds();
m_frameTime = m_kxsystem->GetTimeInSeconds();
m_previousClockTime = m_kxsystem->GetTimeInSeconds();
m_previousRealTime = m_kxsystem->GetTimeInSeconds();

m_bInitialized = true;
Expand Down
2 changes: 0 additions & 2 deletions source/gameengine/Ketsji/KX_KetsjiEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ class KX_KetsjiEngine
double m_frameTime;
/// game time for the next rendering step
double m_clockTime;
/// game time of the previous rendering step
double m_previousClockTime;
///game time when the animations were last updated
double m_previousAnimTime;
double m_remainingTime;
Expand Down

0 comments on commit 09866ee

Please sign in to comment.