Struct BonePose

Source
pub struct BonePose<'a> { /* private fields */ }
Expand description

A pose of a Bone, referring to it so that many poses can use the same Bone.

A BonePose has a current Transformation which indicates how it is posed; the Bone contains mapping matrices for going from bone-parent space to bone space, and for going from mesh space to bone space

Implementations§

Source§

impl<'a> BonePose<'a>

Source

pub fn new(bone: &'a Bone) -> Self

Create a new pose of a bone

Source

pub fn transformation_reset(&mut self)

Reset the pose transformation to that of the bone in the skeleton

Source

pub fn set_transformation(&mut self, transform: Transformation)

Set a new pose transformation for the posed bone

Source

pub fn derive_animation( &mut self, is_root: bool, parent_animated_pbtm: &Mat4, ) -> &Mat4

Derive the animation matrices given a parent animated-posed-bone-to-mesh matrix

If there is no parent (is_root true) then the animated bone-to-mesh is just the posed-bone-to-parent transformation

If there is a parent then its pose transformation must be preapplied to this; when this animated_btm is applied to a vector (in this local bone space) one must first generate the vector in the parent-bone space (by applying pbtp) and then apply parent pbtm to generate model space

Vectors in the model mesh space can be multiplied by the bones mtb matrix to get a vector in this local bone space, to which the animated_btm can be applied to get a model space vector. Hence multiplying animated_btm and bone.mtb together.

Source

pub fn borrow_animated_mtm(&self) -> &Mat4

Borrow the animated mesh-to-model-space matrix

This assumes it has been derived

Trait Implementations§

Source§

impl<'a> Display for BonePose<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> DefaultIndentedDisplay for BonePose<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for BonePose<'a>

§

impl<'a> RefUnwindSafe for BonePose<'a>

§

impl<'a> Send for BonePose<'a>

§

impl<'a> Sync for BonePose<'a>

§

impl<'a> Unpin for BonePose<'a>

§

impl<'a> UnwindSafe for BonePose<'a>

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<'a, O, T> IndentedDisplay<'a, O> for T

Source§

fn indent(&self, ind: &mut Indenter<'a, O>) -> Result<(), Error>

Display for humans with indent
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.