- Object
-
- TimeStep
-
-
Constructor Summary
Constructors Constructor Description TimeStep(double dt)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getDeltaTime()
Returns the elapsed time since the last time step in seconds.double
getDeltaTimeRatio()
Returns the ratio of the last elapsed time to the current elapsed time.double
getInverseDeltaTime()
Returns the inverse of the elapsed time (in seconds) since the last time step.double
getPreviousInverseDeltaTime()
Returns the previous frame's inverse elapsed time (in seconds).double
getPrevousDeltaTime()
Returns the previous frame's elapsed time in seconds.String
toString()
void
update(double dt)
Updates the currentTimeStep
using the new elapsed time.
-
-
-
Method Detail
-
update
public void update(double dt)
Updates the currentTimeStep
using the new elapsed time.- Parameters:
dt
- in delta time in seconds; must be positive or zero
-
getDeltaTime
public double getDeltaTime()
Returns the elapsed time since the last time step in seconds.- Returns:
- double
-
getInverseDeltaTime
public double getInverseDeltaTime()
Returns the inverse of the elapsed time (in seconds) since the last time step.- Returns:
- double
-
getDeltaTimeRatio
public double getDeltaTimeRatio()
Returns the ratio of the last elapsed time to the current elapsed time.This is used to cope with a variable time step.
- Returns:
- double
-
getPrevousDeltaTime
public double getPrevousDeltaTime()
Returns the previous frame's elapsed time in seconds.- Returns:
- double
-
getPreviousInverseDeltaTime
public double getPreviousInverseDeltaTime()
Returns the previous frame's inverse elapsed time (in seconds).- Returns:
- double
-
-