Skip to main content

WorldEditor

Struct WorldEditor 

Source
pub struct WorldEditor {
Show 35 fields pub heightmap: Heightmap, pub cell_size: f32, pub height_scale: f32, pub sea_level: f32, pub world_name: String, pub metadata: HashMap<String, String>, pub temperature_map: Vec<f32>, pub humidity_map: Vec<f32>, pub biome_system: BiomeSystem, pub weather: WeatherSystem, pub road_network: RoadNetwork, pub atmosphere: AtmosphereParams, pub rivers: Vec<RiverPath>, pub lakes: Vec<LakeBody>, pub shore: Option<OceanShore>, pub foliage: Vec<FoliageInstance>, pub foliage_params: Vec<FoliagePlacementParams>, pub selection: SelectionState, pub undo_redo: UndoRedoStack, pub active_tool: EditorTool, pub brush: BrushSettings, pub utc_hour: f64, pub day_of_year: f64, pub latitude: f64, pub longitude: f64, pub solar: SolarState, pub stats: WorldStats, pub terrain_fbm_params: FbmParams, pub warp_strength: f32, pub erosion_params: ErosionParams, pub master_seed: u64, pub heightmap_dirty: bool, pub climate_dirty: bool, pub foliage_dirty: bool, pub water_dirty: bool,
}

Fields§

§heightmap: Heightmap§cell_size: f32§height_scale: f32§sea_level: f32§world_name: String§metadata: HashMap<String, String>§temperature_map: Vec<f32>§humidity_map: Vec<f32>§biome_system: BiomeSystem§weather: WeatherSystem§road_network: RoadNetwork§atmosphere: AtmosphereParams§rivers: Vec<RiverPath>§lakes: Vec<LakeBody>§shore: Option<OceanShore>§foliage: Vec<FoliageInstance>§foliage_params: Vec<FoliagePlacementParams>§selection: SelectionState§undo_redo: UndoRedoStack§active_tool: EditorTool§brush: BrushSettings§utc_hour: f64§day_of_year: f64§latitude: f64§longitude: f64§solar: SolarState§stats: WorldStats§terrain_fbm_params: FbmParams§warp_strength: f32§erosion_params: ErosionParams§master_seed: u64§heightmap_dirty: bool§climate_dirty: bool§foliage_dirty: bool§water_dirty: bool

Implementations§

Source§

impl WorldEditor

Source

pub fn new(width: usize, height: usize, cell_size: f32) -> Self

Source

pub fn generate_terrain(&mut self)

Source

pub fn apply_erosion(&mut self)

Source

pub fn apply_thermal_erosion(&mut self, iterations: usize, talus_deg: f32)

Source

pub fn generate_climate(&mut self)

Source

pub fn get_biome_at(&self, x: usize, y: usize) -> BiomeBlendSample

Source

pub fn generate_rivers(&mut self, num_rivers: usize)

Source

pub fn generate_lakes(&mut self, num_lakes: usize, max_water_level: f32)

Source

pub fn generate_shore(&mut self)

Source

pub fn place_foliage_layer(&mut self, params: FoliagePlacementParams, seed: u64)

Source

pub fn clear_foliage(&mut self)

Source

pub fn cull_foliage(&mut self, frustum: &Frustum) -> Vec<usize>

Source

pub fn build_road( &mut self, start: Vec2, end: Vec2, road_type: RoadType, ) -> Option<u32>

Source

pub fn update_solar(&mut self)

Source

pub fn advance_time(&mut self, delta_hours: f64)

Source

pub fn raise_terrain(&mut self, cx: f32, cy: f32, delta: f32)

Source

pub fn lower_terrain(&mut self, cx: f32, cy: f32, delta: f32)

Source

pub fn smooth_terrain(&mut self, cx: f32, cy: f32, iters: usize)

Source

pub fn flatten_terrain(&mut self, cx: f32, cy: f32, target: f32)

Source

pub fn undo(&mut self)

Source

pub fn redo(&mut self)

Source

pub fn ray_cast(&self, ray_origin: Vec3, ray_dir: Vec3) -> Option<RayHit>

Source

pub fn compute_stats(&mut self)

Source

pub fn serialize(&self) -> Vec<u8> ⓘ

Source

pub fn generate_full_world( &mut self, num_rivers: usize, num_lakes: usize, foliage_density: f32, )

Source

pub fn world_to_heightmap(&self, world: Vec3) -> (usize, usize)

Source

pub fn heightmap_to_world(&self, x: usize, z: usize) -> Vec3

Source

pub fn world_bounds(&self) -> (Vec3, Vec3)

Source

pub fn get_selection_pivot(&self) -> Vec3

Source

pub fn measure_distance(&self, a_world: Vec3, b_world: Vec3) -> f32

Source

pub fn measure_area_of_selection(&self) -> f32

Source

pub fn compute_lod_factor( &self, pos: Vec3, camera_pos: Vec3, lod_distances: &[f32], ) -> u8

Source

pub fn update_foliage_lod(&mut self, camera_pos: Vec3)

Source

pub fn sample_sky_at_direction(&self, dir: Vec3) -> Vec3

Source§

impl WorldEditor

Source

pub fn sky_at(&self, view_dir: Vec3) -> Vec3

Source§

impl WorldEditor

Source§

impl WorldEditor

Source

pub fn generate_from_seed(&mut self, seed: u64)

Generate a complete terrain from a user-provided seed value

Source

pub fn height_at_world(&self, x: f32, z: f32) -> f32

Get height at a world position (x, z in world units)

Source

pub fn normal_at_world(&self, x: f32, z: f32) -> Vec3

Get surface normal at a world position

Source

pub fn is_underwater(&self, x: f32, z: f32) -> bool

Check if a world position is underwater

Source

pub fn biome_at_world(&self, x: f32, z: f32) -> BiomeId

Get biome at a world position

Source

pub fn resize_world(&mut self, new_width: usize, new_height: usize)

Resize the world (resample heightmap to new dimensions)

Source

pub fn import_heightmap(&mut self, data: &[f32], width: usize, height: usize)

Apply a heightmap from external data

Source

pub fn export_heightmap_u16(&self) -> Vec<u8> ⓘ

Export heightmap as 16-bit grayscale image bytes (big-endian per pixel)

Source

pub fn export_heightmap_u8(&self) -> Vec<u8> ⓘ

Export heightmap as 8-bit grayscale image bytes

Source

pub fn horizon_angle_at( &self, x: usize, y: usize, direction: f32, max_dist: f32, ) -> f32

Compute horizon angle at a point (used for ambient lighting)

Source§

impl WorldEditor

Source

pub fn apply_island_mask(&mut self, falloff_exp: f32)

Source

pub fn compute_snow_map(&self, snow_line: f32, temp_thresh: f32) -> Vec<f32>

Source

pub fn build_chunk_mesh( &self, chunk_x: usize, chunk_z: usize, chunk_size: usize, lod_step: usize, ) -> TerrainMesh

Source

pub fn compute_ao(&self, num_rays: usize, max_dist: f32) -> Vec<f32>

Source

pub fn compute_shadow_map(&self) -> Vec<f32>

Source

pub fn render_minimap(&self, out_w: usize, out_h: usize) -> Vec<u8> ⓘ

Source

pub fn find_peaks( &self, min_height: f32, search_radius: usize, ) -> Vec<(usize, usize, f32)>

Source

pub fn generate_wind_field(&self, turbulence: f32) -> WindField

Source

pub fn stamp_hill( &mut self, world_x: f32, world_z: f32, radius: f32, height: f32, sharpness: f32, )

Source

pub fn world_report(&self) -> String

Source

pub fn validate(&self) -> Vec<String>

Source

pub fn is_navigable(&self, x: usize, y: usize, max_slope_deg: f32) -> bool

Source

pub fn export_nav_passability(&self, max_slope_deg: f32) -> Vec<bool>

Source

pub fn day_length_hours(&self) -> f64

Source

pub fn rebuild_all(&mut self)

Source

pub fn sample_sky_color(&self, view_dir: Vec3) -> Vec3

Source

pub fn compute_viewshed( &self, obs_x: usize, obs_z: usize, obs_height: f32, max_dist: f32, ) -> Vec<bool>

Source§

impl WorldEditor

Source

pub fn apply_profile(&mut self, profile: &WorldGenProfile, seed: u64)

Apply a complete WorldGenProfile — full procedural pipeline

Source§

impl WorldEditor

Source

pub fn place_volcano( &mut self, world_x: f32, world_z: f32, radius: f32, rim_height: f32, caldera_depth: f32, )

Place a volcano at a world position

Source

pub fn place_mesa( &mut self, world_x: f32, world_z: f32, radius: f32, height: f32, steepness: f32, )

Place a mesa (flat-topped plateau) at a world position

Source

pub fn place_crater( &mut self, world_x: f32, world_z: f32, radius: f32, rim_height: f32, depth: f32, )

Place an impact crater at a world position

Source

pub fn fill_terrain_sinks(&mut self)

Fill terrain sinks (hydrological preprocessing)

Source

pub fn stats_for_region( &self, x0: usize, y0: usize, x1: usize, y1: usize, ) -> WorldStats

Compute statistics for a specific region

Source

pub fn gaussian_smooth(&mut self, sigma: f32)

Smooth the entire heightmap with a Gaussian filter

Source

pub fn build_nav_grid(&self, max_slope_deg: f32) -> NavGrid

Generate full navigation data for the world

Source

pub fn biome_percentages(&self) -> [(BiomeId, f32); 25]

Get biome statistics (percentage of each biome type)

Source§

impl WorldEditor

Source

pub fn place_vegetation_by_rules(&mut self, seed: u64)

Place vegetation according to rules database

Source

pub fn build_voronoi_biome_map(&self, num_sites: usize) -> VoronoiMap

Build a Voronoi biome map

Source

pub fn terrain_material_at(&self, x: usize, y: usize) -> TerrainMaterial

Get a material for a terrain cell based on slope/altitude/biome

Source

pub fn set_metadata(&mut self, key: &str, value: &str)

Add metadata to the world

Source

pub fn get_metadata(&self, key: &str) -> Option<&String>

Source

pub fn simulate_rain_event(&mut self, intensity: f32, duration_hours: f32)

Simulate a single rain event (increases humidity, may trigger erosion)

Source

pub fn reseat_foliage_to_terrain(&mut self)

Move all foliage onto the current terrain surface (after terrain edit)

Source

pub fn cull_underwater_foliage(&mut self)

Remove all foliage below sea level (e.g. after sea level change)

Source

pub fn terrain_triangle_count(&self) -> usize

Compute the total number of triangles in the terrain mesh at full LOD

Source

pub fn terrain_memory_bytes(&self) -> usize

Estimate terrain memory usage in bytes

Source

pub fn recalculate_rivers(&mut self, num_rivers: usize)

Recalculate all rivers from scratch using current heightmap

Source

pub fn full_save(&self) -> Vec<u8> ⓘ

Serialise all editor state to bytes

Trait Implementations§

Source§

impl Default for WorldEditor

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more