BoneTransformComputer

Struct BoneTransformComputer 

Source
pub struct BoneTransformComputer { /* private fields */ }
Expand description

Bone transform computer for hierarchical bone matrices

Handles the transformation chain from local bone space to model space, accounting for parent bones, pivot points, and billboard modes.

Implementations§

Source§

impl BoneTransformComputer

Source

pub fn new(pivot_points: &[Vec3], parents: &[i16], raw_flags: &[u32]) -> Self

Create a new bone transform computer

§Arguments
  • pivots - Pivot points for each bone
  • parents - Parent bone index for each bone (-1 for root)
  • flags - Bone flags for each bone
Source

pub fn empty() -> Self

Create an empty computer (no bones)

Source

pub fn bone_count(&self) -> usize

Get number of bones

Source

pub fn update( &mut self, translations: &[Vec3], rotations: &[Quat], scales: &[Vec3], )

Update all bone transforms from interpolated animation values

§Arguments
  • translations - Interpolated translation for each bone
  • rotations - Interpolated rotation for each bone
  • scales - Interpolated scale for each bone
Source

pub fn bones(&self) -> &[ComputedBone]

Get computed bone data

Source

pub fn get_transform(&self, bone_index: usize) -> Mat4

Get transform for a specific bone

Source

pub fn get_post_billboard_transform(&self, bone_index: usize) -> Mat4

Get post-billboard transform for a specific bone

Source

pub fn get_skinning_transform(&self, bone_index: usize) -> Mat4

Get combined transform for skinning (uses post_billboard for most bones)

For regular bones, this returns post_billboard_transform. For billboard bones, the shader combines transform and post_billboard with the camera rotation.

Source

pub fn is_spherical_billboard(&self, bone_index: usize) -> bool

Check if a bone uses spherical billboard

Source

pub fn get_gpu_data(&self) -> Vec<f32>

Get all bone matrices as flat array for GPU upload

Each bone contributes 2 mat4x3 matrices (24 floats):

  • transform (for billboard positioning)
  • post_billboard_transform (for final skinning)

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
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.