Enum SampleState

Source
pub enum SampleState {
    Empty,
    BeforeStart {
        first: Sample,
    },
    AfterEnd {
        last: Sample,
    },
    Exact(Sample),
    Interpolated {
        sample: Sample,
        from_tick: u64,
        to_tick: u64,
    },
    Held {
        sample: Sample,
        from_tick: u64,
        teleport_tick: u64,
    },
}
Expand description

Placement and presentation pose of a checked ghost query.

Exact keys retain their stored teleport flag. Synthesized poses clear it; Held explicitly identifies a discontinuous interval instead. These states describe the requested time, not an event stream: repeating an exact query returns the same key, including its teleport flag. See GhostTrack::sample_checked for a complete example.

Variants§

§

Empty

No recorded poses, including a zero-capacity track.

§

BeforeStart

Earlier than the first recorded tick; no pose is synthesized.

Fields

§first: Sample

First recorded pose, available for an explicit caller-owned hold.

§

AfterEnd

Later than the last recorded tick; no pose is synthesized.

Fields

§last: Sample

Last recorded pose, available for an explicit caller-owned hold.

§

Exact(Sample)

Exactly a recorded tick with zero alpha; the stored pose is unchanged.

§

Interpolated

Continuous motion between two distinct recorded ticks.

Fields

§sample: Sample

Interpolated pose, with the query’s integer tick and no teleport flag.

§from_tick: u64

Recorded tick preceding the query.

§to_tick: u64

Recorded tick following the query.

§

Held

Holding the preceding pose until a marked teleport; neither position nor rotation is blended across the discontinuity.

Fields

§sample: Sample

Held pose, with the query’s integer tick and no teleport flag.

§from_tick: u64

Tick of the recorded pose being held.

§teleport_tick: u64

Tick at which the new pose becomes visible.

Implementations§

Source§

impl SampleState

Source

pub fn sample(self) -> Option<Sample>

Return an in-range presentation pose without clamping or extrapolation.

use ferravex_play::replay::ghost::{GhostTrack, Sample};
use ferravex_math::{Quat, Vec3};

let mut track = GhostTrack::new(7, 60, 1)?;
track.push(Sample {
    tick: 10, position: Vec3::ZERO, rotation: Quat::IDENTITY, teleport: true,
})?;
assert!(track.sample_checked(10, 0.0)?.sample().unwrap().teleport);
assert!(track.sample_checked(10, 0.5)?.sample().is_none());

Trait Implementations§

Source§

impl Clone for SampleState

Source§

fn clone(&self) -> SampleState

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SampleState

Source§

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

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

impl PartialEq for SampleState

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for SampleState

Source§

impl StructuralPartialEq for SampleState

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.