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
impl BoneTransformComputer
Sourcepub fn new(pivot_points: &[Vec3], parents: &[i16], raw_flags: &[u32]) -> Self
pub fn new(pivot_points: &[Vec3], parents: &[i16], raw_flags: &[u32]) -> Self
Create a new bone transform computer
§Arguments
pivots- Pivot points for each boneparents- Parent bone index for each bone (-1 for root)flags- Bone flags for each bone
Sourcepub fn bone_count(&self) -> usize
pub fn bone_count(&self) -> usize
Get number of bones
Sourcepub fn update(
&mut self,
translations: &[Vec3],
rotations: &[Quat],
scales: &[Vec3],
)
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 bonerotations- Interpolated rotation for each bonescales- Interpolated scale for each bone
Sourcepub fn bones(&self) -> &[ComputedBone]
pub fn bones(&self) -> &[ComputedBone]
Get computed bone data
Sourcepub fn get_transform(&self, bone_index: usize) -> Mat4
pub fn get_transform(&self, bone_index: usize) -> Mat4
Get transform for a specific bone
Sourcepub fn get_post_billboard_transform(&self, bone_index: usize) -> Mat4
pub fn get_post_billboard_transform(&self, bone_index: usize) -> Mat4
Get post-billboard transform for a specific bone
Sourcepub fn get_skinning_transform(&self, bone_index: usize) -> Mat4
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.
Sourcepub fn is_spherical_billboard(&self, bone_index: usize) -> bool
pub fn is_spherical_billboard(&self, bone_index: usize) -> bool
Check if a bone uses spherical billboard
Sourcepub fn get_gpu_data(&self) -> Vec<f32>
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§
impl Freeze for BoneTransformComputer
impl RefUnwindSafe for BoneTransformComputer
impl Send for BoneTransformComputer
impl Sync for BoneTransformComputer
impl Unpin for BoneTransformComputer
impl UnwindSafe for BoneTransformComputer
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
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