pub struct Skeleton { /* private fields */ }Expand description
A joint hierarchy — parent/child relationships plus each joint’s fixed
bind-pose data. Immutable once built; combine it with a per-frame
Vec<Transform> (one local pose per joint, e.g. from
AnimationClip::sample) via
world_matrices/skinning_matrices
to get the matrices your own shader/buffer actually needs.
Implementations§
Source§impl Skeleton
impl Skeleton
Sourcepub fn new(joints: Vec<Joint>) -> Self
pub fn new(joints: Vec<Joint>) -> Self
Panics if any parent index is out of range, or the joint graph
contains a cycle — both are a malformed skeleton (a genuine bug in
whatever built joints), not a “not ready yet” condition worth
tolerating. Does not require joints to already be in
parent-before-child order.
pub fn joint_count(&self) -> usize
pub fn joint(&self, index: usize) -> &Joint
pub fn joint_index_by_name(&self, name: &str) -> Option<usize>
Sourcepub fn world_matrices(&self, local_poses: &[Transform]) -> Vec<Mat4>
pub fn world_matrices(&self, local_poses: &[Transform]) -> Vec<Mat4>
Computes each joint’s world-space matrix from a set of local
(parent-relative) poses — one linear pass over the precomputed
topological order, no recursion needed. Panics if
local_poses.len() != self.joint_count().
Sourcepub fn skinning_matrices(&self, local_poses: &[Transform]) -> Vec<Mat4>
pub fn skinning_matrices(&self, local_poses: &[Transform]) -> Vec<Mat4>
The matrix palette your shader/buffer actually needs: each joint’s
world matrix (from world_matrices) times
its own inverse_bind_matrix, so the
result transforms a vertex straight from mesh-bind space into the
current pose.
Auto Trait Implementations§
impl Freeze for Skeleton
impl RefUnwindSafe for Skeleton
impl Send for Skeleton
impl Sync for Skeleton
impl Unpin for Skeleton
impl UnsafeUnpin for Skeleton
impl UnwindSafe for Skeleton
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Component for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more