pub struct FrameClock { /* private fields */ }Expand description
Integer-nanosecond fixed-timestep accumulator with VSync-boundary hysteresis and dt-invariant FPS telemetry.
Implementations§
Source§impl FrameClock
Nanosecond fixed-step accumulation, VSync hysteresis snapping, and dt-invariant FPS telemetry for FrameClock.
impl FrameClock
Nanosecond fixed-step accumulation, VSync hysteresis snapping, and dt-invariant FPS telemetry for FrameClock.
Sourcepub fn from_fixed_step_ns(fixed_step_ns: u64, max_substeps: u32) -> Self
pub fn from_fixed_step_ns(fixed_step_ns: u64, max_substeps: u32) -> Self
Constructs a FrameClock directly from an exact integer-nanosecond simulation period.
§Arguments
u64- Fixed simulation step duration in nanoseconds (16_666_667for 60Hz,8_333_333for 120Hz).u32- Upper cap on fixed substeps executed per rendered frame.
§Returns
Self- Configured integer-nanosecond frame clock.
Sourcepub fn for_sim_hz(sim_hz: u32, max_substeps: u32) -> Self
pub fn for_sim_hz(sim_hz: u32, max_substeps: u32) -> Self
Sourcepub fn hysteresis_window_ns(&self) -> u64
pub fn hysteresis_window_ns(&self) -> u64
Sourcepub fn tick_ns(&mut self, raw_dt_ns: u64) -> u32
pub fn tick_ns(&mut self, raw_dt_ns: u64) -> u32
Advances the clock by raw_dt_ns nanoseconds using ±0.5% VSync-boundary hysteresis snapping and dt-invariant FPS smoothing.
§Arguments
&Self- Mutable frame clock.u64- Unclamped elapsed nanoseconds since the previous frame.
§Returns
u32- Number of fixed-timestep simulation updates to execute this frame.
Source§impl FrameClock
impl FrameClock
pub fn get_fixed_dt(&self) -> f32
pub fn get_mut_fixed_dt(&mut self) -> &mut f32
pub fn set_fixed_dt(&mut self, val: f32) -> &mut Self
pub fn get_fixed_step_ns(&self) -> u64
pub fn get_mut_fixed_step_ns(&mut self) -> &mut u64
pub fn set_fixed_step_ns(&mut self, val: u64) -> &mut Self
pub fn get_max_substeps(&self) -> u32
pub fn get_mut_max_substeps(&mut self) -> &mut u32
pub fn set_max_substeps(&mut self, val: u32) -> &mut Self
pub fn get_accumulator_ns(&self) -> u64
pub fn get_mut_accumulator_ns(&mut self) -> &mut u64
pub fn set_accumulator_ns(&mut self, val: u64) -> &mut Self
pub fn get_accumulator(&self) -> f32
pub fn get_mut_accumulator(&mut self) -> &mut f32
pub fn set_accumulator(&mut self, val: f32) -> &mut Self
pub fn get_delta_ns(&self) -> u64
pub fn get_mut_delta_ns(&mut self) -> &mut u64
pub fn set_delta_ns(&mut self, val: u64) -> &mut Self
pub fn get_delta_secs(&self) -> f32
pub fn get_mut_delta_secs(&mut self) -> &mut f32
pub fn set_delta_secs(&mut self, val: f32) -> &mut Self
pub fn get_elapsed_ns(&self) -> u64
pub fn get_mut_elapsed_ns(&mut self) -> &mut u64
pub fn set_elapsed_ns(&mut self, val: u64) -> &mut Self
pub fn get_elapsed_secs(&self) -> f64
pub fn get_mut_elapsed_secs(&mut self) -> &mut f64
pub fn set_elapsed_secs(&mut self, val: f64) -> &mut Self
pub fn get_alpha(&self) -> f32
pub fn get_mut_alpha(&mut self) -> &mut f32
pub fn set_alpha(&mut self, val: f32) -> &mut Self
pub fn get_fps(&self) -> f32
pub fn get_mut_fps(&mut self) -> &mut f32
pub fn set_fps(&mut self, val: f32) -> &mut Self
pub fn get_frame_count(&self) -> u64
pub fn get_mut_frame_count(&mut self) -> &mut u64
pub fn set_frame_count(&mut self, val: u64) -> &mut Self
pub fn get_fixed_step_count(&self) -> u64
pub fn get_mut_fixed_step_count(&mut self) -> &mut u64
pub fn set_fixed_step_count(&mut self, val: u64) -> &mut Self
Trait Implementations§
Source§impl Clone for FrameClock
impl Clone for FrameClock
impl Copy for FrameClock
Source§impl Debug for FrameClock
impl Debug for FrameClock
Source§impl Default for FrameClock
Default 60Hz integer-nanosecond fixed-timestep FrameClock with 8-substep safety cap.
impl Default for FrameClock
Default 60Hz integer-nanosecond fixed-timestep FrameClock with 8-substep safety cap.
Source§impl PartialEq for FrameClock
impl PartialEq for FrameClock
impl StructuralPartialEq for FrameClock
Auto Trait Implementations§
impl Forget for FrameClock
impl Freeze for FrameClock
impl Move for FrameClock
impl RefUnwindSafe for FrameClock
impl Send for FrameClock
impl Sync for FrameClock
impl Unpin for FrameClock
impl UnsafeUnpin for FrameClock
impl UnwindSafe for FrameClock
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