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
impl Transition3
Sourcepub fn new() -> Transition3
pub fn new() -> Transition3
Empty, unheld, generation zero; equivalent to Default. See module recipe.
Sourcepub fn pose(&self) -> Option<Pose3>
pub fn pose(&self) -> Option<Pose3>
Last displayed pose, or None before initialization/after reset.
Sourcepub fn projection(&self) -> Option<Perspective3>
pub fn projection(&self) -> Option<Perspective3>
Lens of the displayed pose, or None when empty. See module recipe.
Sourcepub fn is_blending(&self) -> bool
pub fn is_blending(&self) -> bool
Whether a positive-duration segment has unfinished work, even while held.
Sourcepub fn is_held(&self) -> bool
pub fn is_held(&self) -> bool
Whether valid advances retain the displayed pose and segment time.
Sourcepub fn generation(&self) -> u64
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.
Sourcepub fn hold(&mut self) -> bool
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.
Sourcepub fn resume(&mut self) -> bool
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.
Sourcepub fn reset(&mut self)
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.
Sourcepub fn cut(
&mut self,
pose: Pose3,
projection: Perspective3,
) -> Result<(), TransitionError>
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.
Sourcepub fn retarget(
&mut self,
pose: Pose3,
projection: Perspective3,
duration: f32,
) -> Result<(), TransitionError>
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);Sourcepub fn retarget_frame(
&mut self,
frame: &Frame3,
projection: Perspective3,
duration: f32,
) -> Result<(), TransitionError>
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.
Sourcepub fn advance(&mut self, delta: f32) -> Result<Option<Pose3>, TransitionError>
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
impl Clone for Transition3
Source§fn clone(&self) -> Transition3
fn clone(&self) -> Transition3
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more