Struct Transition3

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

Bounded presentation segment, initially empty. See the module’s runnable recipe.

This is a timed camera blend, not a second tick interpolation/history system. Task202’s engine InterpolationPair remains the host’s optional authoritative tick-to-presentation adapter; this lower-level crate does not depend on engine.

Implementations§

Source§

impl Transition3

Source

pub fn new() -> Transition3

Empty, unheld, generation zero; equivalent to Default. See module recipe.

Source

pub fn pose(&self) -> Option<Pose3>

Last displayed pose, or None before initialization/after reset.

Source

pub fn projection(&self) -> Option<Perspective3>

Lens of the displayed pose, or None when empty. See module recipe.

Source

pub fn is_blending(&self) -> bool

Whether a positive-duration segment has unfinished work, even while held.

Source

pub fn is_held(&self) -> bool

Whether valid advances retain the displayed pose and segment time.

Source

pub fn generation(&self) -> u64

Local discontinuity counter: initializations, cuts and resets increment it. Wraps at u64::MAX; clones copy it. Not a tick ID or globally unique token. Ordinary blends, retargets, holds and resumes do not increment it.

Source

pub fn hold(&mut self) -> bool

Freeze presentation time; returns true only on entering hold. Empty holds are allowed; initialization/cut releases them. See the module recipe.

Source

pub fn resume(&mut self) -> bool

Release a hold without consuming elapsed time or changing the pose. Returns true only on leaving hold. See the module recipe.

Source

pub fn reset(&mut self)

Forget all pose/segment/lens state, release hold, advance generation. The next valid retarget initializes exactly. See the module recipe.

Source

pub fn cut( &mut self, pose: Pose3, projection: Perspective3, ) -> Result<(), TransitionError>

Immediately replace endpoints and lens, release hold, advance generation. Validation is atomic. Lens changes are allowed. See the module recipe.

Source

pub fn retarget( &mut self, pose: Pose3, projection: Perspective3, duration: f32, ) -> Result<(), TransitionError>

Start from the last displayed pose, retaining any hold. No time advances. Empty state or zero duration initializes/cuts directly, allowing lens change. Duration is checked even for an empty state or a cut frame.

use ferravex_math::projection::NdcDepth;
use ferravex_play::camera::{Pose3, transition::*};
let lens = Perspective3 { aspect: 1., near: 0.1, far: 100.,
    handedness: ViewHandedness::Right, depth: NdcDepth::ZeroToOne };
let mut view = Transition3::new();
view.retarget(Pose3::default(), lens, 0.).unwrap();
let before = view;
assert_eq!(view.retarget(Pose3::default(), lens, f32::NAN),
    Err(TransitionError::InvalidDuration));
assert_eq!(view, before);
assert_eq!(view.advance(f32::INFINITY), Err(TransitionError::InvalidDelta));
assert_eq!(view, before);
Source

pub fn retarget_frame( &mut self, frame: &Frame3, projection: Perspective3, duration: f32, ) -> Result<(), TransitionError>

Honor the host’s cut flag, borrowing only pose/cut. Other flags/queries are neither interpolated nor returned. All inputs, including duration, are validated before mutation. See the actual Rig3 frame in the module recipe.

Source

pub fn advance(&mut self, delta: f32) -> Result<Option<Pose3>, TransitionError>

Advance caller-owned presentation seconds in 0..=0.25. Valid zero time, hold, completion or empty state returns the last pose unchanged. Reaching duration returns the exact supplied endpoint; overshoot is discarded. Errors leave time and every other field unchanged. See the module recipe.

Trait Implementations§

Source§

impl Clone for Transition3

Source§

fn clone(&self) -> Transition3

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 Transition3

Source§

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

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

impl Default for Transition3

Source§

fn default() -> Transition3

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Transition3

Source§

fn eq(&self, other: &Transition3) -> 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 Transition3

Source§

impl StructuralPartialEq for Transition3

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.