pub struct KeyframeAnimation { /* private fields */ }Expand description
Holds keyframe animation data as a PointCloud.
The first attribute is always the timestamp track. Each additional attribute is one keyframe track with the same number of frames.
Implementations§
Source§impl KeyframeAnimation
impl KeyframeAnimation
Sourcepub fn from_point_cloud(point_cloud: PointCloud) -> Self
pub fn from_point_cloud(point_cloud: PointCloud) -> Self
Wraps an existing point cloud (e.g. a freshly decoded one).
Sourcepub fn num_frames(&self) -> i32
pub fn num_frames(&self) -> i32
Returns the number of animation frames (equal to the point count).
Sourcepub fn set_num_frames(&mut self, num_frames: i32)
pub fn set_num_frames(&mut self, num_frames: i32)
Sets the number of animation frames (equal to the point count).
Sourcepub fn num_animations(&self) -> i32
pub fn num_animations(&self) -> i32
Returns the number of keyframe tracks (attributes minus the timestamp).
Sourcepub fn set_timestamps(&mut self, timestamps: &[f32]) -> bool
pub fn set_timestamps(&mut self, timestamps: &[f32]) -> bool
Sets the per-frame timestamps. Must be called only once, before any keyframe data is added unless a track was added first.
Returns false if a timestamp track already holds data or if the frame
count is inconsistent with previously added keyframes. Mirrors C++
KeyframeAnimation::SetTimestamps.
Sourcepub fn add_keyframes<T: NoUninit>(
&mut self,
data_type: DataType,
num_components: u32,
data: &[T],
) -> i32
pub fn add_keyframes<T: NoUninit>( &mut self, data_type: DataType, num_components: u32, data: &[T], ) -> i32
Adds one keyframe track and returns its animation id, or -1 on error.
num_components is the number of scalar components per frame, and data
holds num_components * num_frames values laid out frame-major. Mirrors
C++ KeyframeAnimation::AddKeyframes.
Sourcepub fn timestamps(&self) -> Option<&PointAttribute>
pub fn timestamps(&self) -> Option<&PointAttribute>
Returns the timestamp track, if present.
Sourcepub fn keyframes(&self, animation_id: i32) -> Option<&PointAttribute>
pub fn keyframes(&self, animation_id: i32) -> Option<&PointAttribute>
Returns the keyframe track identified by animation_id, if present.
Sourcepub fn point_cloud(&self) -> &PointCloud
pub fn point_cloud(&self) -> &PointCloud
Returns the underlying point cloud.
Sourcepub fn into_point_cloud(self) -> PointCloud
pub fn into_point_cloud(self) -> PointCloud
Consumes the animation, returning the underlying point cloud.
Trait Implementations§
Source§impl Clone for KeyframeAnimation
impl Clone for KeyframeAnimation
Source§fn clone(&self) -> KeyframeAnimation
fn clone(&self) -> KeyframeAnimation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more