pub struct CaveChunkGenerator<G> { /* private fields */ }Expand description
Wrap a Generator (typically
roxlap_cavegen::BlueCaveGenerator or
roxlap_cavegen::MagCaveGenerator) as a
ChunkGenerator. Each (chx, chy) gets a chunk-derived
seed; chz != 0 is implicit air.
The inner generator is consumed at construction; the wrapper owns it for the lifetime of the adapter. Generators are expected to be cheap to clone (the cavegen presets are unit structs, so this is free).
Implementations§
Source§impl<G> CaveChunkGenerator<G>
impl<G> CaveChunkGenerator<G>
Sourcepub fn new(inner: G, base_params: CaveParams) -> Self
pub fn new(inner: G, base_params: CaveParams) -> Self
New adapter wrapping inner with base_params as the
template for per-chunk parameter derivation.
The base_params.seed is XOR’d with the chunk index via
FNV-1a to produce the per-chunk seed; other fields
(seed_count, air_ratio, anisotropy, etc.) are passed
through unchanged.
Trait Implementations§
Source§impl<G> ChunkGenerator for CaveChunkGenerator<G>
impl<G> ChunkGenerator for CaveChunkGenerator<G>
Source§fn generate(&self, chunk_idx: IVec3) -> Vxl
fn generate(&self, chunk_idx: IVec3) -> Vxl
Produce the chunk at
chunk_idx. Implementations should not
allocate or touch any state outside their own configuration
— running this from a background thread must be safe.Source§fn should_generate(&self, _chunk_idx: IVec3) -> bool
fn should_generate(&self, _chunk_idx: IVec3) -> bool
Per-chunk filter consulted by
crate::Scene::pump_streaming
(+ the synchronous crate::Grid::ensure_chunk_generated
helper) before dispatching generate. Returning false
skips the chunk entirely — it never enters the grid’s chunk
map and origin_chunk_z (etc.) reflect only the indices the
generator actually materialises. Read moreAuto Trait Implementations§
impl<G> Freeze for CaveChunkGenerator<G>where
G: Freeze,
impl<G> RefUnwindSafe for CaveChunkGenerator<G>where
G: RefUnwindSafe,
impl<G> Send for CaveChunkGenerator<G>where
G: Send,
impl<G> Sync for CaveChunkGenerator<G>where
G: Sync,
impl<G> Unpin for CaveChunkGenerator<G>where
G: Unpin,
impl<G> UnsafeUnpin for CaveChunkGenerator<G>where
G: UnsafeUnpin,
impl<G> UnwindSafe for CaveChunkGenerator<G>where
G: 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
Mutably borrows from an owned value. Read more
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>
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 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>
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