pub struct AnimationManager { /* private fields */ }Expand description
M2 Animation Manager
Manages animation state and provides interpolated values for animated properties. Modeled after noclip.website’s WowM2AnimationManager.
Implementations§
Source§impl AnimationManager
impl AnimationManager
Sourcepub fn new(
global_sequence_durations: Vec<u32>,
sequences: Vec<AnimSequence>,
bones: Vec<ResolvedBone>,
) -> Self
pub fn new( global_sequence_durations: Vec<u32>, sequences: Vec<AnimSequence>, bones: Vec<ResolvedBone>, ) -> Self
Create a new AnimationManager
§Arguments
global_sequence_durations- Durations of global sequencessequences- Animation sequence definitionsbones- Resolved bone animation data
Sourcepub fn update(&mut self, delta_time_ms: f64)
pub fn update(&mut self, delta_time_ms: f64)
Update animation state by the given delta time (milliseconds)
Sourcepub fn set_animation_id(&mut self, id: u16)
pub fn set_animation_id(&mut self, id: u16)
Set the current animation by ID
Sourcepub fn set_animation_index(&mut self, index: usize)
pub fn set_animation_index(&mut self, index: usize)
Set the current animation by index
Sourcepub fn get_animation_ids(&self) -> Vec<u16>
pub fn get_animation_ids(&self) -> Vec<u16>
Get available animation IDs
Sourcepub fn current_time(&self) -> f64
pub fn current_time(&self) -> f64
Get current animation time (milliseconds)
Sourcepub fn current_animation_index(&self) -> Option<usize>
pub fn current_animation_index(&self) -> Option<usize>
Get current animation index
Sourcepub fn bone_count(&self) -> usize
pub fn bone_count(&self) -> usize
Get number of bones
Sourcepub fn sequence_count(&self) -> usize
pub fn sequence_count(&self) -> usize
Get number of sequences
Sourcepub fn get_current_value<T: Lerp + Clone + Default>(
&self,
track: &ResolvedTrack<T>,
) -> T
pub fn get_current_value<T: Lerp + Clone + Default>( &self, track: &ResolvedTrack<T>, ) -> T
Get interpolated value from a track with current animation blending
Sourcepub fn get_current_value_with_default<T: Lerp + Clone>(
&self,
track: &ResolvedTrack<T>,
default: T,
) -> T
pub fn get_current_value_with_default<T: Lerp + Clone>( &self, track: &ResolvedTrack<T>, default: T, ) -> T
Get interpolated value with a custom default
Sourcepub fn get_bone_translation(&self, bone_index: usize) -> Vec3
pub fn get_bone_translation(&self, bone_index: usize) -> Vec3
Get bone translation for the given bone index
Sourcepub fn get_bone_rotation(&self, bone_index: usize) -> Quat
pub fn get_bone_rotation(&self, bone_index: usize) -> Quat
Get bone rotation for the given bone index
Sourcepub fn get_bone_scale(&self, bone_index: usize) -> Vec3
pub fn get_bone_scale(&self, bone_index: usize) -> Vec3
Get bone scale for the given bone index
Sourcepub fn bones(&self) -> &[ResolvedBone]
pub fn bones(&self) -> &[ResolvedBone]
Get bone data (for computing transforms)
Sourcepub fn sequences(&self) -> &[AnimSequence]
pub fn sequences(&self) -> &[AnimSequence]
Get sequences
Sourcepub fn global_times(&self) -> &[f64]
pub fn global_times(&self) -> &[f64]
Get global sequence times
Sourcepub fn blend_factor(&self) -> f32
pub fn blend_factor(&self) -> f32
Get blend factor
Trait Implementations§
Source§impl Clone for AnimationManager
impl Clone for AnimationManager
Source§fn clone(&self) -> AnimationManager
fn clone(&self) -> AnimationManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AnimationManager
impl RefUnwindSafe for AnimationManager
impl Send for AnimationManager
impl Sync for AnimationManager
impl Unpin for AnimationManager
impl UnwindSafe for AnimationManager
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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