pub struct WorldMap {
pub height_overview: HeightMap,
pub biome_overview: Vec<u8>,
pub resolution: usize,
pub world_size_chunks: usize,
}Expand description
Low-resolution overview map of the entire world, used for minimap and LOD hints.
Fields§
§height_overview: HeightMapLow-resolution height overview.
biome_overview: Vec<u8>Biome overview (compressed to u8 per cell).
resolution: usizeOverview resolution.
world_size_chunks: usizeWorld size in chunks.
Implementations§
Source§impl WorldMap
impl WorldMap
Sourcepub fn generate(
world_size_chunks: usize,
resolution: usize,
config: &TerrainConfig,
) -> Self
pub fn generate( world_size_chunks: usize, resolution: usize, config: &TerrainConfig, ) -> Self
Generate a world map by sampling the global noise function.
Sourcepub fn sample_height(&self, nx: f32, ny: f32) -> f32
pub fn sample_height(&self, nx: f32, ny: f32) -> f32
Sample height at normalized world position (0..1).
Sourcepub fn sample_biome(&self, nx: f32, ny: f32) -> BiomeType
pub fn sample_biome(&self, nx: f32, ny: f32) -> BiomeType
Get biome at normalized world position.
Sourcepub fn chunk_to_normalized(&self, coord: ChunkCoord) -> (f32, f32)
pub fn chunk_to_normalized(&self, coord: ChunkCoord) -> (f32, f32)
Convert chunk coord to normalized world position.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WorldMap
impl RefUnwindSafe for WorldMap
impl Send for WorldMap
impl Sync for WorldMap
impl Unpin for WorldMap
impl UnsafeUnpin for WorldMap
impl UnwindSafe for WorldMap
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.