long CConvert::GetEncodeFramerate(void) { // simplistic fps formula. A more accurate one will // be built into the encoder soon if (m_pGraph == NULL) { // if the mpegstats is gone, then we return the average fps return (long)((double)GetFramesEncoded() / (double)GetTimeElapsed()); } else { long n = GetFramesEncoded(); long fps = n - m_nLastEncodedFrameCount; m_nLastEncodedFrameCount = n; return fps; } }
//------------------------------------------------------------------------------ void CEnvMapWaterEffect::OnFrameUpdate() { CWaterEffect::OnFrameUpdate(); float deltaTime = GetTimeElapsed() * 0.001f; // update texture coordinate offsets m_WaveOffset.x += m_WaveSpeed[0].x * deltaTime; m_WaveOffset.y += m_WaveSpeed[0].y * deltaTime; m_WaveOffset.z += m_WaveSpeed[1].x * deltaTime; m_WaveOffset.w += m_WaveSpeed[1].y * deltaTime; // repeate in range [0,1] or [-1,0] if (m_WaveOffset.x >= 1.0f || m_WaveOffset.x <= -1.0f) m_WaveOffset.x = 0.0f; if (m_WaveOffset.y >= 1.0f || m_WaveOffset.y <= -1.0f) m_WaveOffset.y = 0.0f; if (m_WaveOffset.z >= 1.0f || m_WaveOffset.z <= -1.0f) m_WaveOffset.z = 0.0f; if (m_WaveOffset.w >= 1.0f || m_WaveOffset.w <= -1.0f) m_WaveOffset.w = 0.0f; }
void KT_API Clock::Stop() { myRefTime = GetTimeElapsed(); }