pub struct ChunkHeightmaps {
world_surface_wg: Option<Heightmap>,
ocean_floor_wg: Option<Heightmap>,
world_surface: Option<Heightmap>,
motion_blocking: Option<Heightmap>,
motion_blocking_no_leaves: Option<Heightmap>,
ocean_floor: Option<Heightmap>,
}Expand description
Heightmap storage retained across every phase of a chunk.
Stores heightmaps as Option fields since they are lazily initialized
based on the chunk’s generation status. Worldgen types (WorldSurfaceWg,
OceanFloorWg) are used before CARVERS; final types are used after.
Fields§
§world_surface_wg: Option<Heightmap>§ocean_floor_wg: Option<Heightmap>§world_surface: Option<Heightmap>§motion_blocking: Option<Heightmap>§motion_blocking_no_leaves: Option<Heightmap>§ocean_floor: Option<Heightmap>Implementations§
Source§impl ChunkHeightmaps
impl ChunkHeightmaps
Sourcepub fn new(min_y: i32, height: i32) -> Self
pub fn new(min_y: i32, height: i32) -> Self
Creates heightmap storage with every final chunk map initialized.
Sourcepub fn with_types(types: &[HeightmapType], min_y: i32, height: i32) -> Self
pub fn with_types(types: &[HeightmapType], min_y: i32, height: i32) -> Self
Creates storage with the requested heightmap types initialized at min_y.
Sourcepub const fn get(&self, heightmap_type: HeightmapType) -> Option<&Heightmap>
pub const fn get(&self, heightmap_type: HeightmapType) -> Option<&Heightmap>
Returns a reference to a heightmap by type, if it exists.
Sourcepub const fn get_mut(
&mut self,
heightmap_type: HeightmapType,
) -> Option<&mut Heightmap>
pub const fn get_mut( &mut self, heightmap_type: HeightmapType, ) -> Option<&mut Heightmap>
Returns a mutable reference to a heightmap by type, if it exists.
Sourcepub fn replace(&mut self, heightmap: Heightmap)
pub fn replace(&mut self, heightmap: Heightmap)
Replaces one stored heightmap with a fully built instance.
Sourcefn get_or_insert(
&mut self,
heightmap_type: HeightmapType,
min_y: i32,
height: i32,
) -> &mut Heightmap
fn get_or_insert( &mut self, heightmap_type: HeightmapType, min_y: i32, height: i32, ) -> &mut Heightmap
Returns a mutable reference to a heightmap, creating it if it doesn’t exist.
Sourcepub fn get_final(&self, heightmap_type: HeightmapType) -> &Heightmap
pub fn get_final(&self, heightmap_type: HeightmapType) -> &Heightmap
Returns a final heightmap required by a full chunk.
§Panics
Panics if a worldgen type is requested or the final map is missing.
Sourcepub fn get_final_mut(&mut self, heightmap_type: HeightmapType) -> &mut Heightmap
pub fn get_final_mut(&mut self, heightmap_type: HeightmapType) -> &mut Heightmap
Returns a mutable final heightmap required by a full chunk.
§Panics
Panics if a worldgen type is requested or the final map is missing.
Sourcepub fn update_final<F>(
&mut self,
local_x: usize,
y: i32,
local_z: usize,
state: BlockStateId,
get_block: F,
)
pub fn update_final<F>( &mut self, local_x: usize, y: i32, local_z: usize, state: BlockStateId, get_block: F, )
Updates every final heightmap after a full-chunk block change.
§Panics
Panics if any required final heightmap is missing.
fn set_primed_height( &mut self, heightmap_type: HeightmapType, local_x: usize, local_z: usize, height: i32, )
Sourcepub fn prime_from_sections(
&mut self,
types: &[HeightmapType],
min_y: i32,
height: i32,
sections: &[SectionHolder],
)
pub fn prime_from_sections( &mut self, types: &[HeightmapType], min_y: i32, height: i32, sections: &[SectionHolder], )
Primes missing heightmaps by scanning each section under one read lock.
Trait Implementations§
Source§impl Clone for ChunkHeightmaps
impl Clone for ChunkHeightmaps
Source§fn clone(&self) -> ChunkHeightmaps
fn clone(&self) -> ChunkHeightmaps
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChunkHeightmaps
impl Debug for ChunkHeightmaps
Auto Trait Implementations§
impl Freeze for ChunkHeightmaps
impl RefUnwindSafe for ChunkHeightmaps
impl Send for ChunkHeightmaps
impl Sync for ChunkHeightmaps
impl Unpin for ChunkHeightmaps
impl UnsafeUnpin for ChunkHeightmaps
impl UnwindSafe for ChunkHeightmaps
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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<>>