Struct planetkit::globe::Globe
[−]
[src]
pub struct Globe { pub gen: Gen, // some fields omitted }
Fields
gen: Gen
Methods
impl Globe
[src]
fn new(spec: Spec) -> Globe
[src]
fn new_example() -> Globe
[src]
fn new_earth_scale_example() -> Globe
[src]
fn spec(&self) -> Spec
[src]
[src]
Copy shared cells owned by a chunk for any loaded downstream chunks that have an outdated copy.
Panics if the given chunk is not loaded.
[src]
Copy shared cells not owned by a chunk from any loaded upstream chunks that have a more current copy.
Panics if the given chunk is not loaded.
fn origin_of_chunk_owning(&self, pos: PosInOwningRoot) -> ChunkOrigin
[src]
fn origin_of_chunk_in_same_root_containing(
&self,
pos: GridPoint3
) -> ChunkOrigin
[src]
&self,
pos: GridPoint3
) -> ChunkOrigin
fn mark_chunk_views_affected_by_cell_as_dirty(&mut self, pos: GridPoint3)
[src]
Most Chunks
s will have an associated ChunkView
. Indicate that the
chunk (or something else affecting its visibility) has been modified
since the view was last updated.
fn increment_chunk_owned_edge_version_for_cell(&mut self, pos: PosInOwningRoot)
[src]
fn add_chunk(&mut self, chunk: Chunk)
[src]
Add the given chunk to the globe.
This may have been freshly generated, or loaded from disk.
Panics
Panics if there was already a chunk loaded for the same chunk origin.
fn remove_chunk(&mut self, chunk_origin: ChunkOrigin) -> Chunk
[src]
Remove the chunk at the given chunk origin. Returns the removed chunk.
Panics
Panics if there was no chunk loaded at the given chunk origin.
fn load_or_build_chunk(&mut self, origin: ChunkOrigin)
[src]
fn ensure_chunk_present(&mut self, chunk_origin: ChunkOrigin)
[src]
Ensures the specified chunk is present.
If the chunk is already present, then do nothing. Otherwise, the chunk may be either loaded from disk, or generated fresh if it has never been saved.
This pays no regard to preferred limits on the number of chunks that should be loaded, and chunks added through this mechanism may well be unloaded immediately the next time this system is invoked, making this only suitable for immediate actions.
impl<'a> Globe
[src]
impl Globe
[src]
fn find_surface_dry_land(
&mut self,
column: GridPoint2,
min_air_cells_above: GridCoord,
max_distance_from_starting_point: GridCoord
) -> Option<GridPoint3>
[src]
&mut self,
column: GridPoint2,
min_air_cells_above: GridCoord,
max_distance_from_starting_point: GridCoord
) -> Option<GridPoint3>
Attempt to find dry land at surface level. See find_dry_land
.
fn find_dry_land(
&mut self,
start_pos: GridPoint3,
min_air_cells_above: GridCoord,
max_distance_from_starting_point: GridCoord
) -> Option<GridPoint3>
[src]
&mut self,
start_pos: GridPoint3,
min_air_cells_above: GridCoord,
max_distance_from_starting_point: GridCoord
) -> Option<GridPoint3>
Attempt to find dry land near (above or below) the given pos
.
A land cell position will only be returned if it has at least as many
contiguous cells of air directly above it as specified by min_air_cells_above
.
Returns None
if no such cell can be found within the maximum distance given, e.g.,
if the highest land was below water, or our guess about where there should be land
exposed to air turned out to be wrong.
Note that this returns the position of the cell found containing land, not the first cell above it containing air. If you are trying to find a suitable location to, e.g., spawn new entities, then you probably want to use the position one above the position returned by this function.
fn air_above_random_surface_dry_land<R: Rng>(
&mut self,
rng: &mut R,
min_air_cells_above: GridCoord,
max_distance_from_starting_point: GridCoord,
max_attempts: usize
) -> Option<GridPoint3>
[src]
&mut self,
rng: &mut R,
min_air_cells_above: GridCoord,
max_distance_from_starting_point: GridCoord,
max_attempts: usize
) -> Option<GridPoint3>
Find a random cell immediately above dry land. See find_dry_land
.
This is useful for finding a suitable point on the surface of the planet to place new entities, e.g., the player character when choosing a random spawn point on the planet.
Returns None
if no suitable cell could be found within the maximum number of attempts.
Each attempt begins from a new random column.
fn find_lowest_cell_containing(
&mut self,
column: GridPoint3,
material: Material
) -> GridPoint3
[src]
&mut self,
column: GridPoint3,
material: Material
) -> GridPoint3
Trait Implementations
impl Component for Globe
[src]
type Storage = HashMapStorage<Globe>
Associated storage type for this component.