Skip to main content

ColumnCache

Trait ColumnCache 

Source
pub trait ColumnCache:
    Clone
    + Default
    + Send
    + Sync {
    type Noises: DimensionNoises<ColumnCache = Self>;

    // Required methods
    fn ensure(&mut self, x: i32, z: i32, noises: &Self::Noises);
    fn init_grid(
        &mut self,
        chunk_block_x: i32,
        chunk_block_z: i32,
        noises: &Self::Noises,
    );
}
Expand description

Column cache for a dimension’s flat-cached density function results.

Stores Y-independent values that only need to be computed once per (x, z) column.

Required Associated Types§

Source

type Noises: DimensionNoises<ColumnCache = Self>

The associated noises type for this cache.

Required Methods§

Source

fn ensure(&mut self, x: i32, z: i32, noises: &Self::Noises)

Ensure the cache is populated for the given block coordinates.

If the cache already holds values for this column, this is a no-op.

Source

fn init_grid( &mut self, chunk_block_x: i32, chunk_block_z: i32, noises: &Self::Noises, )

Pre-compute flat-cached values for all quart positions in a chunk.

Matches vanilla’s NoiseChunk.FlatCache: eagerly fills a 2D grid of (quart_size+1)² entries (size baked in per dimension at compile time). After this call, ensure() for in-bounds positions is an O(1) grid lookup. Out-of-bounds positions fall back to on-the-fly evaluation at raw (non-quantized) coordinates.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§