Skip to main content

KeyframeAnimation

Struct KeyframeAnimation 

Source
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

Source

pub fn new() -> Self

Creates an empty keyframe animation.

Source

pub fn from_point_cloud(point_cloud: PointCloud) -> Self

Wraps an existing point cloud (e.g. a freshly decoded one).

Source

pub fn num_frames(&self) -> i32

Returns the number of animation frames (equal to the point count).

Source

pub fn set_num_frames(&mut self, num_frames: i32)

Sets the number of animation frames (equal to the point count).

Source

pub fn num_animations(&self) -> i32

Returns the number of keyframe tracks (attributes minus the timestamp).

Source

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.

Source

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.

Source

pub fn timestamps(&self) -> Option<&PointAttribute>

Returns the timestamp track, if present.

Source

pub fn keyframes(&self, animation_id: i32) -> Option<&PointAttribute>

Returns the keyframe track identified by animation_id, if present.

Source

pub fn point_cloud(&self) -> &PointCloud

Returns the underlying point cloud.

Source

pub fn into_point_cloud(self) -> PointCloud

Consumes the animation, returning the underlying point cloud.

Trait Implementations§

Source§

impl Clone for KeyframeAnimation

Source§

fn clone(&self) -> KeyframeAnimation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KeyframeAnimation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for KeyframeAnimation

Source§

fn default() -> KeyframeAnimation

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.