Skip to main content

SpriteDense

Struct SpriteDense 

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

Dense occupancy + colour grid for one sprite frame, plus its pivot — the decoded form the per-pixel raycaster marches. Built once from a Kv6 (SpriteDense::from_kv6) or a voxel-clip VoxelFrame (SpriteDense::from_voxel_frame); the latter lets an animated clip cache every frame’s grid up front instead of rebuilding per frame.

Both sources store only surface voxels (a from-air ray’s first hit is the visible surface), so the grid is the visible hull.

Implementations§

Source§

impl SpriteDense

Source

pub fn from_kv6(kv6: &Kv6) -> Self

Decode a Kv6’s surface-voxel run tables into a dense grid.

Source

pub fn from_kv6_with_materials(kv6: &Kv6, material_map: &[(u32, u8)]) -> Self

Like from_kv6 but classifies each voxel into a material id by colour (TV.3 mixed models) via material_map ((rgb, material_id) pairs; see material_for_color). The resulting per-voxel mat array is consulted by the draw_sprite_dense_shaded accumulate path. An empty map yields the same all-opaque (uniform) result as from_kv6.

Source

pub fn from_voxel_frame( frame: &VoxelFrame, dims: [u32; 3], pivot: [f32; 3], ) -> Self

Decode a voxel-clip VoxelFrame (dense-column layout) into the dense grid, given the clip’s dims + pivot. The frame’s columns are col = x + y*dims[0], each a per-column occupancy bitmask with an ascending-z colour run — walked here into the raycaster’s (x·my + y)·mz + z grid.

Source

pub fn from_voxel_frame_with_materials( frame: &VoxelFrame, dims: [u32; 3], pivot: [f32; 3], material_map: &[(u32, u8)], ) -> Self

Like from_voxel_frame but classifies each voxel into a material id by colour (TV.3 mixed models) via material_map — the clip analogue of from_kv6_with_materials. An empty map yields the same all-opaque (uniform) result as from_voxel_frame.

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.