Struct skeletal_animation::animation::AnimationClip
source · pub struct AnimationClip<T: Transform> {
pub samples: Vec<AnimationSample<T>>,
pub samples_per_second: f32,
}
Expand description
A sequence of skeletal pose samples at some sample rate
Fields§
§samples: Vec<AnimationSample<T>>
The sequence of skeletal poses
samples_per_second: f32
Sample rate for the clip. Assumes a constant sample rate.
Implementations§
source§impl<T: Transform> AnimationClip<T>
impl<T: Transform> AnimationClip<T>
sourcepub fn from_def(
clip_def: &AnimationClipDef,
parent_folder: PathBuf
) -> AnimationClip<T>
pub fn from_def( clip_def: &AnimationClipDef, parent_folder: PathBuf ) -> AnimationClip<T>
parent_folder
is the folder to search for the AnimationClip
’s source file
sourcepub fn set_duration(&mut self, duration: f32)
pub fn set_duration(&mut self, duration: f32)
Overrides the sampling rate of the clip to give the given duration (in seconds).
sourcepub fn get_duration(&self) -> f32
pub fn get_duration(&self) -> f32
Return the duration of the clip in seconds
sourcepub fn get_pose_at_time(&self, elapsed_time: f32, blended_poses: &mut [T])
pub fn get_pose_at_time(&self, elapsed_time: f32, blended_poses: &mut [T])
Obtains the interpolated skeletal pose at the given sampling time.
Arguments
time
- The time to sample with, relative to the start of the animationblended_poses
- The output array slice of joint transforms that will be populated for each joint in the skeleton.
sourcepub fn as_difference_clip(
source_clip: &AnimationClip<T>,
reference_clip: &AnimationClip<T>
) -> AnimationClip<T>
pub fn as_difference_clip( source_clip: &AnimationClip<T>, reference_clip: &AnimationClip<T> ) -> AnimationClip<T>
Create a difference clip from a source and reference clip for additive blending.
sourcepub fn from_collada(
skeleton: &Skeleton,
animations: &Vec<Animation>,
transform: &Matrix4<f32>
) -> AnimationClip<T>
pub fn from_collada( skeleton: &Skeleton, animations: &Vec<Animation>, transform: &Matrix4<f32> ) -> AnimationClip<T>
Creates an AnimationClip
from a collection of collada::Animation
.
Arguments
skeleton
- TheSkeleton
that theAnimationClip
will be created for.animations
- The collection ofcollada::Animation
s that will be converted into anAnimationClip
, using the givenSkeleton
.transform
- An offset transform to apply to the root pose of each animation sample, useful for applying rotation, translation, or scaling when loading an animation.
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for AnimationClip<T>where T: RefUnwindSafe,
impl<T> Send for AnimationClip<T>where T: Send,
impl<T> Sync for AnimationClip<T>where T: Sync,
impl<T> Unpin for AnimationClip<T>where T: Unpin,
impl<T> UnwindSafe for AnimationClip<T>where T: UnwindSafe,
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
Mutably borrows from an owned value. Read more