Skip to main content

Uncompressed

Struct Uncompressed 

Source
pub struct Uncompressed { /* private fields */ }
Expand description

Uncompressed animation asset (r3d2anmd format)

Supports versions 3 (legacy), 4, and 5. Uses palette-based storage where frames reference indices into shared vector and quaternion arrays.

Implementations§

Source§

impl Uncompressed

Source

pub fn from_reader<R: Read + Seek + ?Sized>(reader: &mut R) -> Result<Self>

Parses an uncompressed animation from a reader

Only use this if you already know the animation asset is uncompressed! If you aren’t sure, please use AnimationAsset::from_reader

Source§

impl Uncompressed

Source

pub fn to_writer<W: Write + Seek + ?Sized>(&self, writer: &mut W) -> Result<()>

Writes the animation to a writer in v5 format

Source§

impl Uncompressed

Source

pub fn new( fps: f32, vector_palette: Vec<Vec3>, quat_palette: Vec<Quat>, joint_frames: HashMap<u32, Vec<UncompressedFrame>>, ) -> Self

Creates a new uncompressed animation

Source

pub fn duration(&self) -> f32

Returns the duration of the animation in seconds

Source

pub fn fps(&self) -> f32

Returns the frames per second

Source

pub fn frame_count(&self) -> usize

Returns the total number of frames

Source

pub fn vector_palette(&self) -> &[Vec3]

Returns the vector palette (translations and scales)

Source

pub fn quat_palette(&self) -> &[Quat]

Returns the quaternion palette (rotations)

Source

pub fn joint_frames(&self) -> &HashMap<u32, Vec<UncompressedFrame>>

Returns the joint frames map

Source

pub fn joint_hashes(&self) -> impl Iterator<Item = &u32>

Returns the joint hashes

Source

pub fn get_joint_frames(&self, joint_hash: u32) -> Option<&[UncompressedFrame]>

Gets the frame data for a specific joint

Source

pub fn evaluate_frame( &self, joint_hash: u32, frame_id: usize, ) -> Option<(Quat, Vec3, Vec3)>

Evaluates the animation at the given frame index for a joint

Source

pub fn joint_count(&self) -> usize

Returns the number of joints in the animation

Source

pub fn joints(&self) -> Cow<'_, [u32]>

Returns the joint hashes as a slice

Note: This allocates a new Vec since joints are stored in a HashMap.

Source

pub fn evaluate(&self, time: f32) -> HashMap<u32, (Quat, Vec3, Vec3)>

Evaluates the animation at the given time for all joints

Interpolates between frames using linear interpolation for vectors and slerp for rotations.

The time is clamped to [0, duration].

Trait Implementations§

Source§

impl Animation for Uncompressed

Source§

fn duration(&self) -> f32

Returns the animation duration in seconds
Source§

fn fps(&self) -> f32

Returns the animation frames per second
Source§

fn joint_count(&self) -> usize

Returns the number of joints in the animation
Source§

fn joints(&self) -> Cow<'_, [u32]>

Returns the joint hashes
Source§

fn evaluate(&self, time: f32) -> HashMap<u32, (Quat, Vec3, Vec3)>

Evaluates the animation at the given time Read more
Source§

impl Clone for Uncompressed

Source§

fn clone(&self) -> Uncompressed

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Uncompressed

Source§

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

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

impl From<Uncompressed> for AnimationAsset

Source§

fn from(val: Uncompressed) -> Self

Converts to this type from the input type.

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.