pub struct ChunkGrid<'a> {
pub chunks: &'a [Option<GridView<'a>>],
pub origin_chunk_xy: [i32; 2],
pub origin_chunk_z: i32,
pub chunks_x: u32,
pub chunks_y: u32,
pub chunks_z: u32,
}Expand description
S4B.2.c.1: chunk-grid metadata for multi-chunk GridView
lookups.
Stores a 2D table of optional per-chunk GridView borrows so
GridView::chunk_at_xy can resolve an XY chunk index to the
matching chunk’s (slab_buf, column_offsets, ...) view. Empty
table entries (None) signal “no chunk at that index” — the
grouscan column-step treats them as fully-air (the chunk renders
as sky / empty until the ray crosses into a populated chunk).
Sized to match the chunk grid’s full XYZ footprint:
chunks.len() == chunks_x * chunks_y * chunks_z. Chunk at
relative position (dx, dy, dz) from
(origin_chunk_xy, origin_chunk_z) lives at index
(dz * chunks_y + dy) * chunks_x + dx. The per-chunk
GridView entries should have chunk_grid: None (they
describe individual chunks, not the parent grid).
S4B.6.a: chunks_z + origin_chunk_z added for tall worlds.
Pre-S4B.6 callers built ChunkGrid with implicit chunks_z=1 origin_chunk_z=0; the new layout is backwards-compatible —
dz=0 substitution gives the same index dy * chunks_x + dx,
so a flat chunks_x * chunks_y slice indexes identically.
Fields§
§chunks: &'a [Option<GridView<'a>>]Per-chunk views. Length chunks_x * chunks_y * chunks_z.
Index layout: [(dz * chunks_y + dy) * chunks_x + dx].
origin_chunk_xy: [i32; 2]XY index of the chunk at chunks[0]. Subsequent chunks lie
along +x (next in the row) then +y (next row).
origin_chunk_z: i32Z index of the chunk at chunks[0]. Subsequent z slabs lie
at +chunks_x * chunks_y strides into Self::chunks.
chunks_x: u32Number of chunks along the X axis. Row stride in
Self::chunks.
chunks_y: u32Number of chunks along the Y axis.
chunks_z: u32Number of chunks along the Z axis. 1 for non-stacked
worlds (matches every pre-S4B.6.a caller).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ChunkGrid<'a>
impl<'a> RefUnwindSafe for ChunkGrid<'a>
impl<'a> Send for ChunkGrid<'a>
impl<'a> Sync for ChunkGrid<'a>
impl<'a> Unpin for ChunkGrid<'a>
impl<'a> UnsafeUnpin for ChunkGrid<'a>
impl<'a> UnwindSafe for ChunkGrid<'a>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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