Skip to main content

NoiseChunk

Struct NoiseChunk 

Source
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 SoAslice[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: usize

Number of active interpolation channels.

§corners_y: usize

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

First cell X/Z in world coordinates (cell index, not block).

§first_cell_z: i32§cell_min_y: i32

Minimum cell Y index.

§cell_count_y: usize

Number of cells in Y direction.

§cell_count_xz: usize

Number of cells per chunk in XZ.

§_phantom: PhantomData<N>

Implementations§

Source§

impl<N: DimensionNoises> NoiseChunk<N>

Source

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.

Source

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.

Source

pub fn fill<F>( &mut self, noises: &N, cache: &mut N::ColumnCache, beardifier: Option<&Beardifier>, place_block: F, )
where F: FnMut(usize, i32, usize, f64, &[f64], &mut N::ColumnCache),

Fill the chunk with terrain blocks using multi-channel trilinear interpolation.

For each block position:

  1. Trilinearly interpolate each channel independently from cell corners
  2. Apply outer operations (squeeze, min, etc.) via combine_interpolated
  3. Call place_block with 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> 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> IntoShared for T

§

fn into_shared(self) -> Arc<Mutex<RawMutex, Self>>

Wraps this value in an Arc<SyncMutex<>>
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more