Skip to main content

OverworldColumnCache

Struct OverworldColumnCache 

Source
pub struct OverworldColumnCache {
Show 42 fields pub x: i32, pub z: i32, qx: i32, qz: i32, valid: bool, grid_first_quart_x: i32, grid_first_quart_z: i32, has_grid: bool, pub df_shift_x: f64, pub df_shift_z: f64, pub df_overworld__continents: f64, pub df_overworld__erosion: f64, pub df_overworld__ridges: f64, pub df_overworld__ridges_folded: f64, pub df_overworld__offset: f64, pub df_overworld__factor: f64, pub df_overworld__jaggedness: f64, pub router_continentalness: f64, pub router_erosion: f64, pub router_preliminary_surface_level: f64, pub router_ridges: f64, pub router_temperature: f64, pub router_vegetation: f64, pub inline_noise_0: f64, pub inline_noise_1: f64, grid_df_shift_x: [f64; 25], grid_df_shift_z: [f64; 25], grid_df_overworld__continents: [f64; 25], grid_df_overworld__erosion: [f64; 25], grid_df_overworld__ridges: [f64; 25], grid_df_overworld__ridges_folded: [f64; 25], grid_df_overworld__offset: [f64; 25], grid_df_overworld__factor: [f64; 25], grid_df_overworld__jaggedness: [f64; 25], grid_router_continentalness: [f64; 25], grid_router_erosion: [f64; 25], grid_router_preliminary_surface_level: [f64; 25], grid_router_ridges: [f64; 25], grid_router_temperature: [f64; 25], grid_router_vegetation: [f64; 25], grid_inline_noise_0: [f64; 25], grid_inline_noise_1: [f64; 25],
}
Expand description

Column-level cache for flat-cached (xz-only) density function results.

Supports two modes matching vanilla’s NoiseChunk.FlatCache:

  • Grid mode (init_grid() called): Pre-computes a 2D grid of all in-chunk quart positions. ensure() does O(1) grid lookups for in-bounds positions, falls back to on-the-fly for out-of-bounds.
  • No-grid mode (default): Single-entry lazy cache that recomputes when quart-quantized coordinates change. Used by climate samplers.

Fields§

§x: i32

Raw x block coordinate (for non-flat router functions).

§z: i32

Raw z block coordinate (for non-flat router functions).

§qx: i32

Effective x used to evaluate flat-cached values.

§qz: i32

Effective z used to evaluate flat-cached values.

§valid: bool§grid_first_quart_x: i32§grid_first_quart_z: i32§has_grid: bool§df_shift_x: f64§df_shift_z: f64§df_overworld__continents: f64§df_overworld__erosion: f64§df_overworld__ridges: f64§df_overworld__ridges_folded: f64§df_overworld__offset: f64§df_overworld__factor: f64§df_overworld__jaggedness: f64§router_continentalness: f64§router_erosion: f64§router_preliminary_surface_level: f64§router_ridges: f64§router_temperature: f64§router_vegetation: f64§inline_noise_0: f64§inline_noise_1: f64§grid_df_shift_x: [f64; 25]§grid_df_shift_z: [f64; 25]§grid_df_overworld__continents: [f64; 25]§grid_df_overworld__erosion: [f64; 25]§grid_df_overworld__ridges: [f64; 25]§grid_df_overworld__ridges_folded: [f64; 25]§grid_df_overworld__offset: [f64; 25]§grid_df_overworld__factor: [f64; 25]§grid_df_overworld__jaggedness: [f64; 25]§grid_router_continentalness: [f64; 25]§grid_router_erosion: [f64; 25]§grid_router_preliminary_surface_level: [f64; 25]§grid_router_ridges: [f64; 25]§grid_router_temperature: [f64; 25]§grid_router_vegetation: [f64; 25]§grid_inline_noise_0: [f64; 25]§grid_inline_noise_1: [f64; 25]

Implementations§

Source§

impl OverworldColumnCache

Source

const GRID_SIDE: i32 = 5

Grid side length (quart positions per axis).

Source

pub fn new() -> Self

Create a new column cache without a pre-computed grid.

Source

pub fn init_grid( &mut self, chunk_block_x: i32, chunk_block_z: i32, noises: &OverworldNoises, )

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

After this call, ensure() for in-bounds positions copies from the grid (O(1)). Out-of-bounds positions fall back to on-the-fly evaluation at raw (non-quantized) coordinates.

Source

pub fn ensure(&mut self, x: i32, z: i32, noises: &OverworldNoises)

Ensure the cache is populated for the given (x, z) block coordinates.

With a grid: in-bounds positions load from the pre-computed grid, out-of-bounds positions compute at raw (non-quantized) coordinates. Without a grid: always quantizes and lazy-computes (single-entry cache).

Trait Implementations§

Source§

impl Clone for OverworldColumnCache

Source§

fn clone(&self) -> OverworldColumnCache

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 ColumnCache for OverworldColumnCache

Source§

type Noises = OverworldNoises

The associated noises type for this cache.
Source§

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

Ensure the cache is populated for the given block coordinates. Read more
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. Read more
Source§

impl Default for OverworldColumnCache

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.

§

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> 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.
§

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