pub struct SkeletalSection<'a> { /* private fields */ }Expand description
Zero-copy validated record view. Private fields prevent unchecked construction.
Implementations§
Source§impl<'a> SkeletalSection<'a>
impl<'a> SkeletalSection<'a>
Sourcepub fn parse(
bytes: &'a [u8],
expected_vertices: usize,
) -> Result<Self, SkeletalSectionError>
pub fn parse( bytes: &'a [u8], expected_vertices: usize, ) -> Result<Self, SkeletalSectionError>
Validate an SKL1 payload and return a zero-copy view over it.
Checks magic/version/reserved header fields, computes the expected
length from the five counts (rejecting overflow via CountLimit),
requires bytes.len() to match exactly and the declared vertex
count to equal expected_vertices, scans joint/clip records for
non-zero reserved bytes, then runs validation::validate for
cross-record consistency. No allocation — the view borrows bytes.
Sourcepub fn counts(&self) -> Counts
pub fn counts(&self) -> Counts
Record counts decoded from the header (joints, vertices, clips, tracks, keys).
Sourcepub fn joint(&self, i: usize) -> Option<Joint>
pub fn joint(&self, i: usize) -> Option<Joint>
Joint record i (parent index, rest pose, inverse bind motor), or
None when out of range.
Sourcepub fn joint_id(&self, i: usize) -> Option<u64>
pub fn joint_id(&self, i: usize) -> Option<u64>
Stable 64-bit identifier of joint i, or None when out of range.
Sourcepub fn clip(&self, i: usize) -> Option<ClipRecord>
pub fn clip(&self, i: usize) -> Option<ClipRecord>
Animation clip record i (id, duration, track span, loop flag),
or None when out of range.
Sourcepub fn track(&self, i: usize) -> Option<Track>
pub fn track(&self, i: usize) -> Option<Track>
Track record i (target joint + key span), or None when out of
range.
Sourcepub fn key(&self, i: usize) -> Option<Key>
pub fn key(&self, i: usize) -> Option<Key>
Keyframe i (time + local-space motor pose), or None when out
of range.
Sourcepub fn skin(&self, i: usize) -> Option<SkinWeight>
pub fn skin(&self, i: usize) -> Option<SkinWeight>
Skin weights for vertex i (up to four joint/weight pairs), or
None when out of range.
Sourcepub fn decode_into(
&self,
joints: &mut [Joint],
ids: &mut [u64],
skin: &mut [SkinWeight],
clips: &mut [ClipRecord],
tracks: &mut [Track],
keys: &mut [Key],
) -> Result<Counts, SkeletalSectionError>
pub fn decode_into( &self, joints: &mut [Joint], ids: &mut [u64], skin: &mut [SkinWeight], clips: &mut [ClipRecord], tracks: &mut [Track], keys: &mut [Key], ) -> Result<Counts, SkeletalSectionError>
Copy every decoded record into caller-supplied buffers.
All six buffers must be at least as large as the corresponding
count — joints/ids ≥ joints, skin ≥ vertices, clips ≥
clips, tracks ≥ tracks, keys ≥ keys — otherwise
SkeletalSectionError::OutputTooSmall is returned before any
writes. Returns the decoded Counts.
Trait Implementations§
Source§impl SkeletalSectionSource for SkeletalSection<'_>
impl SkeletalSectionSource for SkeletalSection<'_>
Source§fn section_counts(&self) -> SkeletalCounts
fn section_counts(&self) -> SkeletalCounts
Source§fn decode_section_into(
&self,
joints: &mut [Joint],
joint_ids: &mut [u64],
skin: &mut [SkinWeight],
clips: &mut [ClipRecord],
tracks: &mut [Track],
keys: &mut [Key],
) -> Result<(), PlayerError>
fn decode_section_into( &self, joints: &mut [Joint], joint_ids: &mut [u64], skin: &mut [SkinWeight], clips: &mut [ClipRecord], tracks: &mut [Track], keys: &mut [Key], ) -> Result<(), PlayerError>
Auto Trait Implementations§
impl<'a> Freeze for SkeletalSection<'a>
impl<'a> RefUnwindSafe for SkeletalSection<'a>
impl<'a> Send for SkeletalSection<'a>
impl<'a> Sync for SkeletalSection<'a>
impl<'a> Unpin for SkeletalSection<'a>
impl<'a> UnsafeUnpin for SkeletalSection<'a>
impl<'a> UnwindSafe for SkeletalSection<'a>
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 more