Skip to main content

SkeletalPlayer

Struct SkeletalPlayer 

pub struct SkeletalPlayer { /* private fields */ }
Expand description

Buffers are allocated once on validated scene admission, never on advance. Geometry stays in the authored bind frame; output can receive a uniform orbit transform without altering the rig or losing attachment alignment.

Implementations§

§

impl SkeletalPlayer

pub fn from_section<S>( section: &S, positions: &[[f32; 3]], normals: &[[f32; 3]], uv: &[[f32; 2]], indices: &[u32], ) -> Result<SkeletalPlayer, PlayerError>

Builds a player from a skeletal section + mesh attributes with the default 42 MiB resident budget; validates vertex/index/normal inputs and fails closed (InvalidInput/BudgetExceeded).

pub fn from_section_with_budget<S>( section: &S, positions: &[[f32; 3]], normals: &[[f32; 3]], uv: &[[f32; 2]], indices: &[u32], resident_budget: usize, ) -> Result<SkeletalPlayer, PlayerError>

As from_section with an explicit caller byte budget — the admission pass counts borrowed inputs plus encoded section size and refuses before allocating beyond either bound.

pub fn allocated_bytes(&self) -> usize

Estimated resident bytes for joints, clips, tracks, keys, fit data — tracked against the 42 MiB budget.

pub fn positions(&self) -> &[[f32; 3]]

Vertex positions slice.

pub fn normals(&self) -> &[[f32; 3]]

Vertex normals slice.

pub fn tangents(&self) -> &[[f32; 4]]

Vertex tangents slice.

pub fn has_clip(&self, id: u64) -> bool

true when a clip with id is registered.

pub fn set_body_fit<F>( &mut self, fit: &F, min: [f32; 3], max: [f32; 3], ) -> Result<(), PlayerError>
where F: BodyFitSource + ?Sized,

Applies a BodyFitSource inside [min,max] bounds; validates all scale fields are finite (≤100) and hidden-key payloads bounded (128 keys / 4 KiB); identity fit clears the override. Fails closed on BudgetExceeded.

pub fn set_output_frame( &mut self, origin: [f32; 3], scale: f32, ) -> Result<(), PlayerError>

Sets world origin/scale; rejects non-finite or out-of-range values.

pub fn set_root(&mut self, root: Motor) -> Result<(), PlayerError>

Sets the root Motor transform; InvalidInput on a non-unit/invalid motor.

pub fn has_joint(&self, id: u64) -> bool

true when id is a known joint.

pub fn set_joint_delta( &mut self, id: u64, delta: Motor, ) -> Result<(), PlayerError>

Persistent local control delta, composed after the sampled clip pose. Wheels, steering and authored constraints use the same skinning path.

pub fn select_clip( &mut self, id: u64, fade_seconds: f64, ) -> Result<(), PlayerError>

Switches to clip id with fade_seconds blend; no-op when already active (still validates fade range); delegates to restart_clip otherwise.

pub fn restart_clip( &mut self, id: u64, fade_seconds: f64, ) -> Result<(), PlayerError>

Restarts clip id at t=0, snapshotting current pose for the fade_seconds transition (≤10 s); UnknownClip when id is not registered.

pub fn seek(&mut self, time: f64) -> Result<(), PlayerError>

Deterministic fixture/replay positioning, without a wall-clock source.

pub fn advance_pose_only( &mut self, dt_seconds: f64, ) -> Result<PlaybackReceipt, PlayerError>

Evaluates hierarchical joint Motors and updates the GPU dual-quaternion skinning palette (current + prev for TAA motion vectors) with zero heap allocation and without executing the CPU per-vertex skinning loop.

pub fn advance_pose_only_with_mode( &mut self, dt_seconds: f64, reduced_motion: bool, ) -> Result<PlaybackReceipt, PlayerError>

As Self::advance_pose_only, with an explicit reduced_motion flag.

pub fn advance_pose_only_with_policy( &mut self, dt_seconds: f64, reduced_motion: bool, policy: PoseTimePolicy, ) -> Result<PlaybackReceipt, PlayerError>

Explicit closed-interval sampling avoids wrapping a requested final contact boundary to the first pose. Stored clip metadata is unchanged.

pub fn advance( &mut self, dt_seconds: f64, reduced_motion: bool, ) -> Result<PlaybackReceipt, PlayerError>

Samples and deforms from immutable bind data, avoiding accumulated drift. Reduced motion selects the authored first pose and disables transitions.

pub fn advance_with_policy( &mut self, dt_seconds: f64, reduced_motion: bool, policy: PoseTimePolicy, ) -> Result<PlaybackReceipt, PlayerError>

The same policy is used for pose evaluation and skinning. Hosts with a separate contact pass must select it consistently for both phases.

pub fn gpu_motor_palette(&self) -> &[GpuJointMotorPair]

Current GPU dual-quaternion skinning motor palette (current_r/d + prev_r/d).

pub fn world_motors(&self) -> &[Motor]

Current world-space joint Motors.

pub fn skinning_palette(&self) -> &[Motor]

Current skinning Motor palette ($M_{\text{world}} \circ M_{\text{inv_bind}}$).

pub fn prev_skinning_palette(&self) -> &[Motor]

Previous frame’s skinning Motor palette.

pub fn attachment(&self, joint_id: u64) -> Option<Motor>

Attachment globals are in authored world space, as are rig roots.

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,