Struct FixedTimestepAccumulator
pub struct FixedTimestepAccumulator {
pub fixed_delta: f64,
pub accumulator: f64,
pub max_substeps: usize,
pub total_steps: u64,
pub elapsed_sim_time: f64,
}Expand description
64 Hz Fixed Timestep Accumulator.
Fields§
§fixed_delta: f64Fixed delta time per step in seconds ($0.015625$)
accumulator: f64Accumulated real time in seconds awaiting consumption
max_substeps: usizeMaximum substeps allowed in a single frame update
total_steps: u64Total fixed steps executed since initialization
elapsed_sim_time: f64Elapsed simulation time in seconds ($total_steps \times fixed_delta$)
Implementations§
§impl FixedTimestepAccumulator
impl FixedTimestepAccumulator
pub const fn new() -> FixedTimestepAccumulator
pub fn advance(&mut self, raw_delta_seconds: f64) -> usize
pub fn advance(&mut self, raw_delta_seconds: f64) -> usize
Feeds raw frame delta time into the accumulator.
Returns the number of fixed 64 Hz simulation steps that must be executed this frame.
pub fn interpolation_alpha(&self) -> f32
pub fn interpolation_alpha(&self) -> f32
Returns the fractional blend factor $\alpha \in [0, 1)$ between the previous and current simulation states for renderer interpolation.
pub fn reset(&mut self)
pub fn reset(&mut self)
Resets accumulator state.
Trait Implementations§
§impl Clone for FixedTimestepAccumulator
impl Clone for FixedTimestepAccumulator
§fn clone(&self) -> FixedTimestepAccumulator
fn clone(&self) -> FixedTimestepAccumulator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for FixedTimestepAccumulator
§impl Debug for FixedTimestepAccumulator
impl Debug for FixedTimestepAccumulator
§impl Default for FixedTimestepAccumulator
impl Default for FixedTimestepAccumulator
§fn default() -> FixedTimestepAccumulator
fn default() -> FixedTimestepAccumulator
Returns the “default value” for a type. Read more
§impl PartialEq for FixedTimestepAccumulator
impl PartialEq for FixedTimestepAccumulator
impl StructuralPartialEq for FixedTimestepAccumulator
Auto Trait Implementations§
impl Freeze for FixedTimestepAccumulator
impl RefUnwindSafe for FixedTimestepAccumulator
impl Send for FixedTimestepAccumulator
impl Sync for FixedTimestepAccumulator
impl Unpin for FixedTimestepAccumulator
impl UnsafeUnpin for FixedTimestepAccumulator
impl UnwindSafe for FixedTimestepAccumulator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more