Skip to main content

FixedTimestep3DSession

Struct FixedTimestep3DSession 

Source
pub struct FixedTimestep3DSession { /* private fields */ }
Expand description

Decoupled 3D fixed-timestep simulation loop maintaining invariant physics step counts across 60/120/144/240Hz presentation cadences.

Implementations§

Source§

impl FixedTimestep3DSession

Decoupled fixed-timestep simulation stepping and render interpolation helpers for FixedTimestep3DSession.

Source

pub fn new(sim_hz: u32, max_substeps: u32, present_hz: f32) -> Self

Constructs a FixedTimestep3DSession with explicit fixed simulation frequency, substep cap, and presentation cadence.

§Arguments
  • u32 - Fixed simulation frequency in Hertz (1..=1000).
  • u32 - Maximum fixed substeps allowed per presentation frame to prevent spiral-of-death stalls.
  • f32 - Display presentation cadence in Hertz (e.g. 60.0, 120.0, 144.0, 240.0).
§Returns
  • Self - Configured decoupled 3D simulation session.
Source

pub fn set_present_cadence_hz(&mut self, present_hz: f32)

Updates the display presentation cadence in Hertz without altering the fixed simulation timestep or accumulator.

§Arguments
  • &Self - Mutable simulation session.
  • f32 - New presentation cadence in Hertz (1.0..=1000.0).
Source

pub fn advance_present_ns<F>( &mut self, present_dt_ns: u64, step_sim: F, ) -> SimPresentFrame
where F: FnMut(f32),

Advances the decoupled loop by present_dt_ns nanoseconds, executing only the required fixed simulation steps and returning render interpolation alpha.

§Arguments
  • &Self - Mutable simulation session.
  • u64 - Elapsed presentation interval in integer nanoseconds.
  • F - Fixed-timestep simulation callback invoked once per fixed substep with fixed_dt_secs.
§Returns
  • SimPresentFrame - Per-present step count, interpolation alpha, and clamp flags.
Source

pub fn advance_present<F>( &mut self, present_dt_secs: f32, step_sim: F, ) -> SimPresentFrame
where F: FnMut(f32),

Advances the decoupled loop by present_dt_secs seconds (converted to integer nanoseconds) and returns render interpolation metadata.

§Arguments
  • &Self - Mutable simulation session.
  • f32 - Elapsed presentation interval in seconds.
  • F - Fixed-timestep simulation callback invoked once per fixed substep with fixed_dt_secs.
§Returns
  • SimPresentFrame - Per-present step count, interpolation alpha, and clamp flags.
Source

pub fn interpolate_scalar(prev: f32, next: f32, alpha: f32) -> f32

Linearly interpolates between prev and next simulation scalar values using alpha clamped to [0.0, 1.0].

§Arguments
  • f32 - Previous fixed simulation scalar value.
  • f32 - Latest fixed simulation scalar value.
  • f32 - Render interpolation factor in [0.0, 1.0].
§Returns
  • f32 - Smoothly interpolated render scalar value.
Source§

impl FixedTimestep3DSession

Source

pub fn get_clock(&self) -> FrameClock

Source

pub fn get_mut_clock(&mut self) -> &mut FrameClock

Source

pub fn set_clock(&mut self, val: FrameClock) -> &mut Self

Source

pub fn get_present_hz(&self) -> f32

Source

pub fn get_mut_present_hz(&mut self) -> &mut f32

Source

pub fn set_present_hz(&mut self, val: f32) -> &mut Self

Source

pub fn get_sim_steps_total(&self) -> u64

Source

pub fn get_mut_sim_steps_total(&mut self) -> &mut u64

Source

pub fn set_sim_steps_total(&mut self, val: u64) -> &mut Self

Source

pub fn get_present_frames_total(&self) -> u64

Source

pub fn get_mut_present_frames_total(&mut self) -> &mut u64

Source

pub fn set_present_frames_total(&mut self, val: u64) -> &mut Self

Source

pub fn get_interpolated_only_frames(&self) -> u64

Source

pub fn get_mut_interpolated_only_frames(&mut self) -> &mut u64

Source

pub fn set_interpolated_only_frames(&mut self, val: u64) -> &mut Self

Source

pub fn get_clamped_stall_frames(&self) -> u64

Source

pub fn get_mut_clamped_stall_frames(&mut self) -> &mut u64

Source

pub fn set_clamped_stall_frames(&mut self, val: u64) -> &mut Self

Source

pub fn get_last_alpha(&self) -> f32

Source

pub fn get_mut_last_alpha(&mut self) -> &mut f32

Source

pub fn set_last_alpha(&mut self, val: f32) -> &mut Self

Source

pub fn get_last_steps(&self) -> u32

Source

pub fn get_mut_last_steps(&mut self) -> &mut u32

Source

pub fn set_last_steps(&mut self, val: u32) -> &mut Self

Trait Implementations§

Source§

impl Clone for FixedTimestep3DSession

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FixedTimestep3DSession

Source§

impl Debug for FixedTimestep3DSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FixedTimestep3DSession

Default 60Hz fixed simulation / 60Hz presentation FixedTimestep3DSession.

Source§

fn default() -> Self

Creates a FixedTimestep3DSession with 60Hz fixed simulation, 8 max substeps, and 60Hz presentation cadence.

§Returns
  • Self - Default decoupled 3D simulation session.
Source§

impl PartialEq for FixedTimestep3DSession

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FixedTimestep3DSession

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.