Skip to main content

ChunkGrid

Struct ChunkGrid 

Source
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: i32

Z index of the chunk at chunks[0]. Subsequent z slabs lie at +chunks_x * chunks_y strides into Self::chunks.

§chunks_x: u32

Number of chunks along the X axis. Row stride in Self::chunks.

§chunks_y: u32

Number of chunks along the Y axis.

§chunks_z: u32

Number of chunks along the Z axis. 1 for non-stacked worlds (matches every pre-S4B.6.a caller).

Trait Implementations§

Source§

impl<'a> Clone for ChunkGrid<'a>

Source§

fn clone(&self) -> ChunkGrid<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for ChunkGrid<'a>

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.