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
impl SpriteDense
Sourcepub fn from_kv6_with_materials(kv6: &Kv6, material_map: &[(u32, u8)]) -> Self
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.
Sourcepub fn from_voxel_frame(
frame: &VoxelFrame,
dims: [u32; 3],
pivot: [f32; 3],
) -> Self
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.
Sourcepub fn from_voxel_frame_with_materials(
frame: &VoxelFrame,
dims: [u32; 3],
pivot: [f32; 3],
material_map: &[(u32, u8)],
) -> Self
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§
impl Freeze for SpriteDense
impl RefUnwindSafe for SpriteDense
impl Send for SpriteDense
impl Sync for SpriteDense
impl Unpin for SpriteDense
impl UnsafeUnpin for SpriteDense
impl UnwindSafe for SpriteDense
Blanket Implementations§
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
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