Struct PreparedRetarget

Source
pub struct PreparedRetarget<'s> { /* private fields */ }
Expand description

Immutable prepared map tied by shared borrows to the exact two skeletons. Names are discarded; normalized rest locals and indexed offsets are owned. Skeleton mutation/replacement while borrowed is prevented by Rust. Raw pose slices carry no identity: the caller must supply source-order locals and use the target-order output with Self::target, not an unrelated same-size rig.

Construction allocates O(joints) bounded storage and compares names O(n²). Mapping is O(joints), with no allocation/name lookup and at most two 256-local stack buffers. There is no clock, playback state or mutable reconfiguration. To reconfigure, construct a replacement first, then assign it only on success; construction failure cannot mutate the last-good map. See the module recipe.

Implementations§

Source§

impl<'s> PreparedRetarget<'s>

Source

pub fn try_new( source: &'s Skeleton, source_names: &[&str], source_rest: &[Transform], target: &'s Skeleton, target_names: &[&str], target_rest: &[Transform], policy: MissingJointPolicy, ) -> Result<PreparedRetarget<'s>, RetargetError>

Validate all metadata/rest locals before constructing reusable offsets. Names/rest arrays need only live for this call; both skeleton borrows live as long as the returned map. Bounds and names are checked before lookup; no automatic aliases, ancestor skipping or case folding occurs. Numeric failure on an offset is reported at its target joint index.

Source

pub fn source(&self) -> &'s Skeleton

The exact source skeleton whose joint order the input slice must use.

Source

pub fn target(&self) -> &'s Skeleton

The exact target skeleton whose joint order the output prefix uses.

Source

pub fn map_pose_into( &self, source_pose: &[Transform], output: &mut [Transform], ) -> Result<(), RetargetError>

Remap a complete source local pose into the target-length output prefix. Checks exact source length first, then sufficient output capacity. All inputs (including unused joints) and results are checked before any writes; all output bits/tails survive failure. Success preserves the unused tail. Quaternions are normalized using checked existing math. Feeding the original source rest metadata again returns the stored, normalized target rest exactly. Reusing the map after errors or feeding rest again requires no reset. Downstream world/skin evaluation remains a separate checked operation.

Trait Implementations§

Source§

impl<'s> Debug for PreparedRetarget<'s>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'s> Freeze for PreparedRetarget<'s>

§

impl<'s> RefUnwindSafe for PreparedRetarget<'s>

§

impl<'s> Send for PreparedRetarget<'s>

§

impl<'s> Sync for PreparedRetarget<'s>

§

impl<'s> Unpin for PreparedRetarget<'s>

§

impl<'s> UnwindSafe for PreparedRetarget<'s>

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> 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, 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.