Beispiel #1
0
int VFixStepSceneUpdateController::GetUpdateTickCount()
{
  uint64 iTimeNow = VGLGetTimer();
  const uint64 iTicksPerSec = VGLGetTimerResolution() / m_iTicksPerSecond;
  if (m_iLastUpdateTickCount==0)
    m_iLastUpdateTickCount = iTimeNow;

  VASSERT(m_iLastUpdateTickCount<=iTimeNow);

  int iCount = (int)((iTimeNow-m_iLastUpdateTickCount) / iTicksPerSec);
  m_iLastUpdateTickCount += iTicksPerSec*iCount;
  if (m_iMaxTickCount>0 && iCount>m_iMaxTickCount)
    return m_iMaxTickCount;
  return iCount;
}
 /// \brief
 ///   Returns the elapsed time since the last call to GetDiff().
 inline float GetDiff()
 {
   float fDiff = float(VGLGetTimer() - m_uiLastTime) / float(VGLGetTimerResolution());
   m_uiLastTime = VGLGetTimer();
   return fDiff;
 }
 /// \brief
 ///   Returns the elapsed time since creation of the timer instance or the last call to reset.
 inline float GetTime() const
 {
   return float(VGLGetTimer() - m_uiStartTime) / float(VGLGetTimerResolution());
 }