Skip to main content

CaveChunkGenerator

Struct CaveChunkGenerator 

Source
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>

Source

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>
where G: Generator<Params = CaveParams> + Debug + Send + Sync + 'static,

Source§

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

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 more
Source§

impl<G> Debug for CaveChunkGenerator<G>
where G: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.