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>
impl<'s> PreparedRetarget<'s>
Sourcepub 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>
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.
Sourcepub fn source(&self) -> &'s Skeleton
pub fn source(&self) -> &'s Skeleton
The exact source skeleton whose joint order the input slice must use.
Sourcepub fn target(&self) -> &'s Skeleton
pub fn target(&self) -> &'s Skeleton
The exact target skeleton whose joint order the output prefix uses.
Sourcepub fn map_pose_into(
&self,
source_pose: &[Transform],
output: &mut [Transform],
) -> Result<(), RetargetError>
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.