pub enum ChunkBiomeSampler<'a> {
Overworld(Box<OverworldChunkBiomeSampler<'a>>),
Nether(Box<NetherChunkBiomeSampler<'a>>),
End(Box<EndChunkBiomeSampler<'a>>),
}Expand description
Per-chunk biome sampler with internal caches.
Created by BiomeSourceKind::chunk_sampler for each chunk. Holds per-chunk
caches: column-level density function values and an R-tree warm-start index
that resets each chunk for deterministic biome selection.
Uses enum dispatch instead of dyn to avoid vtable overhead on the hot
per-quart sampling path (1536 calls per overworld chunk).
Variants§
Overworld(Box<OverworldChunkBiomeSampler<'a>>)
Overworld sampler (climate → R-tree lookup).
Nether(Box<NetherChunkBiomeSampler<'a>>)
Nether sampler (climate → R-tree lookup).
End(Box<EndChunkBiomeSampler<'a>>)
End sampler (spatial distance thresholds).
Implementations§
Source§impl ChunkBiomeSampler<'_>
impl ChunkBiomeSampler<'_>
Sourcepub fn sample(&mut self, quart_x: i32, quart_y: i32, quart_z: i32) -> BiomeRef
pub fn sample(&mut self, quart_x: i32, quart_y: i32, quart_z: i32) -> BiomeRef
Get the biome at the given quart position.
Sourcepub fn init_grid(&mut self, chunk_block_x: i32, chunk_block_z: i32)
pub fn init_grid(&mut self, chunk_block_x: i32, chunk_block_z: i32)
Pre-populate the per-chunk flat-noise grid so a full-chunk biome fill
reuses vanilla’s NoiseChunk.FlatCache (O(1) column lookups) instead of
recomputing flat (xz-only) climate noise for every quart cell.
Call once per chunk, before sampling, passing the chunk’s minimum block
coordinates. No-op for the End, which selects biomes spatially and has no
column cache. Samplers used for sparse, scattered lookups (e.g.
find_biome_horizontal) intentionally skip this and keep lazy caching.
Auto Trait Implementations§
impl<'a> Freeze for ChunkBiomeSampler<'a>
impl<'a> RefUnwindSafe for ChunkBiomeSampler<'a>
impl<'a> Send for ChunkBiomeSampler<'a>
impl<'a> Sync for ChunkBiomeSampler<'a>
impl<'a> Unpin for ChunkBiomeSampler<'a>
impl<'a> UnsafeUnpin for ChunkBiomeSampler<'a>
impl<'a> UnwindSafe for ChunkBiomeSampler<'a>
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<>>