Skip to main content

ClipFlipbook

Struct ClipFlipbook 

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

CPU-side decoded animated voxel clip: every frame’s SpriteDense is cached at construction, so per-frame playback is a grid select — not the per-frame voxel-volume decode draw_sprite_dda pays each call. The CPU counterpart to the GPU flipbook (VCL.2). Build once from a DecodedClip, then draw_frame the active frame each render.

Implementations§

Source§

impl ClipFlipbook

Source

pub fn empty() -> Self

An empty flipbook (no frames) — a tombstone for a removed clip; draw_frame always draws nothing.

Source

pub fn from_decoded(clip: &DecodedClip) -> Self

Decode + cache every frame of clip (one SpriteDense each).

Source

pub fn from_decoded_with_materials( clip: &DecodedClip, material_map: &[(u32, u8)], ) -> Self

Like from_decoded but classifies every frame’s voxels into per-voxel material ids by colour (TV.3 mixed models) via material_map — the clip analogue of SpriteDense::from_kv6_with_materials. An empty map yields the same all-opaque result as from_decoded.

Source

pub fn frame_count(&self) -> usize

Source

pub fn frame(&self, frame: usize) -> Option<&SpriteDense>

Borrow frame frame’s cached dense grid, if in range.

Source

pub fn set_frame(&mut self, frame: usize, dense: SpriteDense) -> bool

Replace one frame’s cached dense grid in place — the CPU side of an editor’s single-frame edit (no re-decode of the other frames). Returns false if frame is out of range.

Source

pub fn draw_frame( &self, fb: &mut [u32], zb: &mut [f32], pitch_pixels: usize, width: u32, height: u32, cam: &CameraState, settings: &OpticastSettings, frame: usize, pos: [f32; 3], s: [f32; 3], h: [f32; 3], f: [f32; 3], flags: u32, ) -> u32

Draw frame frame at a world pose via draw_sprite_densepos is the world pivot, s/h/f the model→world basis columns. Returns pixels written (0 if frame is out of range).

Source

pub fn draw_frame_shaded( &self, fb: &mut [u32], zb: &mut [f32], pitch_pixels: usize, width: u32, height: u32, cam: &CameraState, settings: &OpticastSettings, frame: usize, pos: [f32; 3], s: [f32; 3], h: [f32; 3], f: [f32; 3], flags: u32, shade_ctx: Option<SpriteShade<'_>>, ) -> u32

Draw frame frame, optionally with a translucent material (TV stage) — the draw_sprite_dense_shaded counterpart of draw_frame. shade_ctx == None (or an opaque effective material) renders the frame opaque, unchanged.

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.