pub struct NoiseChunk<N: DimensionNoises> {
slices: Vec<Box<[f64; 4096]>>,
interp_count: usize,
corners_y: usize,
block_ys: Vec<i32>,
first_cell_x: i32,
first_cell_z: i32,
cell_min_y: i32,
cell_count_y: usize,
cell_count_xz: usize,
_phantom: PhantomData<N>,
}Expand description
Stores density values at cell corners for a single chunk and provides trilinear interpolation between corners for block-level resolution.
Supports multiple interpolation channels matching vanilla’s multi-interpolator
system. Each Interpolated marker in the density function tree gets its own
channel, filled at cell corners and interpolated independently.
Storage is per-corner SoA — slice[corner_idx * MAX_INTERP + ch] — so 4
adjacent channels’ values at a given corner sit in contiguous memory,
enabling a single f64x4 load and SIMD-batched trilinear interpolation
across 4 channels per block.
Fields§
§slices: Vec<Box<[f64; 4096]>>One slice per cell-X boundary, holding density values at the cell
corners on that X-plane. Length is cell_count_xz + 1. Indexed as
slices[cx][corner_idx * MAX_INTERP + ch] where
corner_idx = z_corner * corners_y + y_corner (range [0, slice_len))
and ch is the interpolation channel (range [0, interp_count)).
We keep all slices materialized rather than alternating two buffers so
the slice-fill phase can run in parallel: each cx boundary’s noise
tree evaluation is independent. The per-block trilerp loop then
indexes slices[cx] and slices[cx + 1] sequentially.
interp_count: usizeNumber of active interpolation channels.
corners_y: usizeNumber of Y corners per Z column (cell_count_y + 1).
block_ys: Vec<i32>Per-corner block-Y values, precomputed once at construction.
Same for every slice fill (depends only on cell_min_y,
cell_height, and corners_y).
first_cell_x: i32First cell X/Z in world coordinates (cell index, not block).
first_cell_z: i32§cell_min_y: i32Minimum cell Y index.
cell_count_y: usizeNumber of cells in Y direction.
cell_count_xz: usizeNumber of cells per chunk in XZ.
_phantom: PhantomData<N>Implementations§
Source§impl<N: DimensionNoises> NoiseChunk<N>
impl<N: DimensionNoises> NoiseChunk<N>
Sourcepub fn new(chunk_min_block_x: i32, chunk_min_block_z: i32) -> Self
pub fn new(chunk_min_block_x: i32, chunk_min_block_z: i32) -> Self
Create a new NoiseChunk for the given chunk position.
chunk_min_block_x and chunk_min_block_z are the world-space block
coordinates of the chunk’s northwest corner.
Sourcefn fill_slice_into(
slice: &mut [f64; 4096],
cell_x: i32,
block_ys: &[i32],
blended_column: &mut [f64],
interp_count: usize,
corners_y: usize,
cell_count_xz: usize,
first_cell_z: i32,
noises: &N,
cache: &mut N::ColumnCache,
)
fn fill_slice_into( slice: &mut [f64; 4096], cell_x: i32, block_ys: &[i32], blended_column: &mut [f64], interp_count: usize, corners_y: usize, cell_count_xz: usize, first_cell_z: i32, noises: &N, cache: &mut N::ColumnCache, )
Fill the slice buffer for the given cell X. Free-standing function so
each parallel slice-fill can run on its own thread with its own
ColumnCache clone.
Sourcepub fn fill<F>(
&mut self,
noises: &N,
cache: &mut N::ColumnCache,
beardifier: Option<&Beardifier>,
place_block: F,
)
pub fn fill<F>( &mut self, noises: &N, cache: &mut N::ColumnCache, beardifier: Option<&Beardifier>, place_block: F, )
Fill the chunk with terrain blocks using multi-channel trilinear interpolation.
For each block position:
- Trilinearly interpolate each channel independently from cell corners
- Apply outer operations (squeeze, min, etc.) via
combine_interpolated - Call
place_blockwith the final density
Auto Trait Implementations§
impl<N> Freeze for NoiseChunk<N>
impl<N> RefUnwindSafe for NoiseChunk<N>where
N: RefUnwindSafe,
impl<N> Send for NoiseChunk<N>
impl<N> Sync for NoiseChunk<N>
impl<N> Unpin for NoiseChunk<N>where
N: Unpin,
impl<N> UnsafeUnpin for NoiseChunk<N>
impl<N> UnwindSafe for NoiseChunk<N>where
N: UnwindSafe,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 moreArc<SyncMutex<>>