Removal and Replacement of the CryTimer (gEnv->pTimer) (#5409)
Replaced and removed the CryTimer (gEnv->pTimer). The new TimeSystem is a merger of the current time functionality found in the engine.
* Rename TimeSystemComponent.h/.cpp to TimeSystem.h/.cpp
* Adding New TimeSystem
* remove old timer cvars
* small improvements to the time system.
- updated parts to use the time conversion functions.
- in AdvanceTickDeltaTimes applying t_simulationTickScale is now uses doubles instead of floats.
* Replace gEnv->pTimer / ITimer usages with TimeSystem
* Updating usages of AZ::TimeMs{ 0 } and AZ::TimeUs{ 0 } to AZ::Time::ZeroTimeMs and AZ::Time::ZeroTimeUs
* red code the CryTimer
* using TimeUs instead of TimeMs is some cases + updating usages of old cvars to new
Signed-off-by: amzn-sean <75276488+amzn-sean@users.noreply.github.com>
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "Include/IObjectManager.h"
|
||||
#include "Objects/EntityObject.h"
|
||||
|
||||
#include <AzCore/Time/ITime.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Movie Callback.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -499,25 +501,24 @@ void CAnimationContext::Update()
|
||||
return;
|
||||
}
|
||||
|
||||
ITimer* pTimer = GetIEditor()->GetSystem()->GetITimer();
|
||||
const AZ::TimeUs frameDeltaTimeUs = AZ::GetSimulationTickDeltaTimeUs();
|
||||
const float frameDeltaTime = AZ::TimeUsToSeconds(frameDeltaTimeUs);
|
||||
|
||||
if (!m_bAutoRecording)
|
||||
{
|
||||
AnimateActiveSequence();
|
||||
|
||||
float dt = pTimer->GetFrameTime();
|
||||
m_currTime += dt * m_fTimeScale;
|
||||
m_currTime += frameDeltaTime * m_fTimeScale;
|
||||
|
||||
if (!m_recording)
|
||||
{
|
||||
GetIEditor()->GetMovieSystem()->PreUpdate(dt);
|
||||
GetIEditor()->GetMovieSystem()->PostUpdate(dt);
|
||||
GetIEditor()->GetMovieSystem()->PreUpdate(frameDeltaTime);
|
||||
GetIEditor()->GetMovieSystem()->PostUpdate(frameDeltaTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float dt = pTimer->GetFrameTime();
|
||||
m_fRecordingCurrTime += dt * m_fTimeScale;
|
||||
m_fRecordingCurrTime += frameDeltaTime * m_fTimeScale;
|
||||
if (fabs(m_fRecordingCurrTime - m_currTime) > m_fRecordingTimeStep)
|
||||
{
|
||||
m_currTime += m_fRecordingTimeStep;
|
||||
@@ -644,7 +645,9 @@ void CAnimationContext::OnPostRender()
|
||||
{
|
||||
SAnimContext ac;
|
||||
ac.dt = 0;
|
||||
ac.fps = GetIEditor()->GetSystem()->GetITimer()->GetFrameRate();
|
||||
const AZ::TimeUs frameDeltaTimeUs = AZ::GetSimulationTickDeltaTimeUs();
|
||||
const float frameDeltaTime = AZ::TimeUsToSeconds(frameDeltaTimeUs);
|
||||
ac.fps = 1.0f / frameDeltaTime;
|
||||
ac.time = m_currTime;
|
||||
ac.singleFrame = true;
|
||||
ac.forcePlay = true;
|
||||
@@ -797,7 +800,9 @@ void CAnimationContext::AnimateActiveSequence()
|
||||
|
||||
SAnimContext ac;
|
||||
ac.dt = 0;
|
||||
ac.fps = GetIEditor()->GetSystem()->GetITimer()->GetFrameRate();
|
||||
const AZ::TimeUs frameDeltaTimeUs = AZ::GetSimulationTickDeltaTimeUs();
|
||||
const float frameDeltaTime = AZ::TimeUsToSeconds(frameDeltaTimeUs);
|
||||
ac.fps = 1.0f / frameDeltaTime;
|
||||
ac.time = m_currTime;
|
||||
ac.singleFrame = true;
|
||||
ac.forcePlay = true;
|
||||
|
||||
Reference in New Issue
Block a user