Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Model

Struct Model 

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

A validated HMA1 blob.

The decoder reads keys without bounds checks, so the only way to build one is Model::new, which walks every clip and bone once and proves that no playback position can read outside the blob. The fields are private so safe code cannot widen what was proven.

Implementations§

Source§

impl Model

Source

pub fn new(d: &'static [u8]) -> Option<Model>

Validate and wrap an HMA1 blob. None when any clip, at any playback position, would read outside d, when a bone’s parent does not come before it (the decoder composes parents first), or when there are no clips.

Source

pub fn bone_count(&self) -> usize

Number of bones; decode needs this many Affine slots.

Source

pub fn clip_count(&self) -> usize

Number of clips in the blob (at least one).

Source

pub fn clip_intervals(&self, clip: usize) -> u32

Source frame intervals of clip (numframes - 1, at least 1): the clip’s position runs 0..=clip_intervals * 256. Clips past the last read the last.

Source

pub fn decode(&self, clip: usize, pos_q8: u32, out: &mut [Affine])

Decode every bone of clip at pos_q8 into model-space affines. Clips past the last decode the last; an out shorter than Model::bone_count is left untouched.

Source

pub fn decode_with( &self, clip: usize, pos_q8: u32, jaw: &Jaw, out: &mut [Affine], )

Model::decode with a local controller rotation on one bone. out must hold at least n_bones entries.

Trait Implementations§

Source§

impl Clone for Model

Source§

fn clone(&self) -> Model

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Model

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl !Send for Model

§

impl !Sync for Model

§

impl Unpin for Model

§

impl UnsafeUnpin for Model

§

impl UnwindSafe for Model

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.