pub struct Animation {
pub per_frame_joint_poses: Array3<f32>,
pub per_frame_root_trans: Array2<f32>,
pub per_frame_expression_coeffs: Option<Array2<f32>>,
pub start_offset: usize,
pub runner: AnimationRunner,
pub config: AnimationConfig,
}Expand description
Animation struct for all data regarding a certain animation
Fields§
§per_frame_joint_poses: Array3<f32>§per_frame_root_trans: Array2<f32>§per_frame_expression_coeffs: Option<Array2<f32>>§start_offset: usize§runner: AnimationRunner§config: AnimationConfigImplementations§
Source§impl Animation
impl Animation
Sourcepub fn new_from_matrices(
per_frame_joint_poses: Array3<f32>,
per_frame_global_trans: Array2<f32>,
per_frame_expression_coeffs: Option<Array2<f32>>,
config: AnimationConfig,
) -> Self
pub fn new_from_matrices( per_frame_joint_poses: Array3<f32>, per_frame_global_trans: Array2<f32>, per_frame_expression_coeffs: Option<Array2<f32>>, config: AnimationConfig, ) -> Self
§Panics
Will panic if the translation and rotation do not cover the same number of timesteps
Sourcepub fn new_from_npz(anim_npz_path: &str, config: AnimationConfig) -> Self
pub fn new_from_npz(anim_npz_path: &str, config: AnimationConfig) -> Self
§Panics
Will panic if the path cannot be opened Will panic if the translation and rotation do not cover the same number of timesteps
Sourcepub async fn new_from_npz_async(
anim_npz_path: &str,
config: AnimationConfig,
) -> Self
pub async fn new_from_npz_async( anim_npz_path: &str, config: AnimationConfig, ) -> Self
§Panics
Will panic if the path cannot be opened Will panic if the translation and rotation do not cover the same number of timesteps
Sourcepub fn new_from_json(
path: &str,
_anim_fps: f32,
config: AnimationConfig,
) -> Self
pub fn new_from_json( path: &str, _anim_fps: f32, config: AnimationConfig, ) -> Self
§Panics
Will panic if the path cannot be opened Will panic if the translation and rotation do not cover the same number of timesteps
Sourcepub fn new_from_smpl_codec(
codec: &SmplCodec,
wrap_behaviour: AnimWrap,
) -> Option<Self>
pub fn new_from_smpl_codec( codec: &SmplCodec, wrap_behaviour: AnimWrap, ) -> Option<Self>
Create an Animation component from a SmplCodec
§Panics
Will panic if the individual body part poses in the codec don’t have the correct shape to be concatenated together into a full pose for the whole body
Sourcepub fn new_from_smpl_file(path: &str, wrap_behaviour: AnimWrap) -> Option<Self>
pub fn new_from_smpl_file(path: &str, wrap_behaviour: AnimWrap) -> Option<Self>
Create an Animation component from a .smpl file
Sourcepub fn new_from_smpl_buf(buf: &[u8], wrap_behaviour: AnimWrap) -> Option<Self>
pub fn new_from_smpl_buf(buf: &[u8], wrap_behaviour: AnimWrap) -> Option<Self>
Create an Animation component from a .smpl buffer
pub fn num_active_joints(&self) -> usize
pub fn num_animation_frames(&self) -> usize
Sourcepub fn advance(&mut self, dt_raw: Duration, first_time: bool)
pub fn advance(&mut self, dt_raw: Duration, first_time: bool)
Advances the animation by the amount of time elapsed since last time we got the current pose
pub fn has_expression(&self) -> bool
pub fn get_smooth_time_indices(&self) -> (usize, usize, f32)
Sourcepub fn get_current_pose(&mut self) -> Pose
pub fn get_current_pose(&mut self) -> Pose
Get the pose and translation at the current time, interpolates if necessary
Sourcepub fn get_pose_at_idx(&self, idx: usize) -> Pose
pub fn get_pose_at_idx(&self, idx: usize) -> Pose
Get pose at a certain frame ID
Sourcepub fn get_current_expression(&mut self) -> Option<Expression>
pub fn get_current_expression(&mut self) -> Option<Expression>
Get expression at current time
Sourcepub fn get_expression_at_idx(&self, idx: usize) -> Option<Expression>
pub fn get_expression_at_idx(&self, idx: usize) -> Option<Expression>
Get expression at a given frame ID
pub fn slice_time_range(&self, start_sec: f32, end_sec: f32) -> Animation
Sourcepub fn align_y_axis_quadrant(
&mut self,
current_axis: &Array1<f32>,
desired_axis: &Array1<f32>,
)
pub fn align_y_axis_quadrant( &mut self, current_axis: &Array1<f32>, desired_axis: &Array1<f32>, )
Rotates multiple of 90 until the axis of the body is aligned with some arbitrary vector
pub fn get_cur_time(&self) -> Duration
pub fn set_cur_time_as_sec(&mut self, time_sec: f32)
pub fn pause(&mut self)
pub fn play(&mut self)
pub fn is_finished(&self) -> bool
pub fn nr_repetitions(&self) -> u32
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Animation
impl RefUnwindSafe for Animation
impl Send for Animation
impl Sync for Animation
impl Unpin for Animation
impl UnwindSafe for Animation
Blanket Implementations§
Source§impl<T> AlignerFor<1> for T
impl<T> AlignerFor<1> for T
Source§impl<T> AlignerFor<1024> for T
impl<T> AlignerFor<1024> for T
Source§type Aligner = AlignTo1024<T>
type Aligner = AlignTo1024<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<128> for T
impl<T> AlignerFor<128> for T
Source§type Aligner = AlignTo128<T>
type Aligner = AlignTo128<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<16> for T
impl<T> AlignerFor<16> for T
Source§impl<T> AlignerFor<16384> for T
impl<T> AlignerFor<16384> for T
Source§type Aligner = AlignTo16384<T>
type Aligner = AlignTo16384<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<2> for T
impl<T> AlignerFor<2> for T
Source§impl<T> AlignerFor<2048> for T
impl<T> AlignerFor<2048> for T
Source§type Aligner = AlignTo2048<T>
type Aligner = AlignTo2048<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<256> for T
impl<T> AlignerFor<256> for T
Source§type Aligner = AlignTo256<T>
type Aligner = AlignTo256<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<32> for T
impl<T> AlignerFor<32> for T
Source§impl<T> AlignerFor<32768> for T
impl<T> AlignerFor<32768> for T
Source§type Aligner = AlignTo32768<T>
type Aligner = AlignTo32768<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<4> for T
impl<T> AlignerFor<4> for T
Source§impl<T> AlignerFor<4096> for T
impl<T> AlignerFor<4096> for T
Source§type Aligner = AlignTo4096<T>
type Aligner = AlignTo4096<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<512> for T
impl<T> AlignerFor<512> for T
Source§type Aligner = AlignTo512<T>
type Aligner = AlignTo512<T>
AlignTo* type which aligns Self to ALIGNMENT.Source§impl<T> AlignerFor<64> for T
impl<T> AlignerFor<64> for T
Source§impl<T> AlignerFor<8> for T
impl<T> AlignerFor<8> for T
Source§impl<T> AlignerFor<8192> for T
impl<T> AlignerFor<8192> for T
Source§type Aligner = AlignTo8192<T>
type Aligner = AlignTo8192<T>
AlignTo* type which aligns Self to ALIGNMENT.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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
impl<'a, T> RCowCompatibleRef<'a> for Twhere
T: Clone + 'a,
Source§fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
fn as_c_ref(from: &'a T) -> <T as RCowCompatibleRef<'a>>::RefC
Source§fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
fn as_rust_ref(from: <T as RCowCompatibleRef<'a>>::RefC) -> &'a T
Source§impl<S> ROExtAcc for S
impl<S> ROExtAcc for S
Source§fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
fn f_get<F>(&self, offset: FieldOffset<S, F, Aligned>) -> &F
offset. Read moreSource§fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
fn f_get_mut<F>(&mut self, offset: FieldOffset<S, F, Aligned>) -> &mut F
offset. Read moreSource§fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
fn f_get_ptr<F, A>(&self, offset: FieldOffset<S, F, A>) -> *const F
offset. Read moreSource§fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
fn f_get_mut_ptr<F, A>(&mut self, offset: FieldOffset<S, F, A>) -> *mut F
offset. Read moreSource§impl<S> ROExtOps<Aligned> for S
impl<S> ROExtOps<Aligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Aligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Aligned>) -> Fwhere
F: Copy,
Source§impl<S> ROExtOps<Unaligned> for S
impl<S> ROExtOps<Unaligned> for S
Source§fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
fn f_replace<F>(&mut self, offset: FieldOffset<S, F, Unaligned>, value: F) -> F
offset) with value,
returning the previous value of the field. Read moreSource§fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
fn f_get_copy<F>(&self, offset: FieldOffset<S, F, Unaligned>) -> Fwhere
F: Copy,
Source§impl<T> SelfOps for Twhere
T: ?Sized,
impl<T> SelfOps for Twhere
T: ?Sized,
Source§fn piped<F, U>(self, f: F) -> U
fn piped<F, U>(self, f: F) -> U
Source§fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
fn piped_ref<'a, F, U>(&'a self, f: F) -> Uwhere
F: FnOnce(&'a Self) -> U,
piped except that the function takes &Self
Useful for functions that take &Self instead of Self. Read moreSource§fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
fn piped_mut<'a, F, U>(&'a mut self, f: F) -> Uwhere
F: FnOnce(&'a mut Self) -> U,
piped, except that the function takes &mut Self.
Useful for functions that take &mut Self instead of Self.Source§fn mutated<F>(self, f: F) -> Self
fn mutated<F>(self, f: F) -> Self
Source§fn observe<F>(self, f: F) -> Self
fn observe<F>(self, f: F) -> Self
Source§fn as_ref_<T>(&self) -> &T
fn as_ref_<T>(&self) -> &T
AsRef,
using the turbofish .as_ref_::<_>() syntax. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.