pub struct ClimateSystem {Show 15 fields
pub config: ClimateConfig,
pub primary_biome: BiomeType,
pub seasonal_cycle: SeasonalCycle,
pub day_night_curve: DayNightCurve,
pub interpolator: Option<ClimateInterpolator>,
pub weather_patterns: Vec<WeatherPattern>,
pub storm_fronts: Vec<StormFront>,
pub heat_waves: Vec<HeatWave>,
pub cold_snaps: Vec<ColdSnap>,
pub active_transitions: Vec<WeatherTransition>,
pub pending_events: Vec<ClimateEvent>,
pub wind_pattern: WindPattern,
pub cells: Vec<ClimateCell>,
pub grid_w: usize,
pub grid_d: usize,
/* private fields */
}Expand description
The main climate simulation state.
Fields§
§config: ClimateConfig§primary_biome: BiomeType§seasonal_cycle: SeasonalCycle§day_night_curve: DayNightCurve§interpolator: Option<ClimateInterpolator>§weather_patterns: Vec<WeatherPattern>§storm_fronts: Vec<StormFront>§heat_waves: Vec<HeatWave>§cold_snaps: Vec<ColdSnap>§active_transitions: Vec<WeatherTransition>§pending_events: Vec<ClimateEvent>§wind_pattern: WindPattern§cells: Vec<ClimateCell>Grid of climate cells for spatial variation.
grid_w: usize§grid_d: usizeImplementations§
Source§impl ClimateSystem
impl ClimateSystem
pub fn new(latitude: f32) -> Self
pub fn with_config(config: ClimateConfig) -> Self
pub fn tick(&mut self, dt: f32, day_of_year: f32, time_of_day: f32)
Sourcepub fn surface_temperature(&self, time_of_day: f32, day_of_year: f32) -> f32
pub fn surface_temperature(&self, time_of_day: f32, day_of_year: f32) -> f32
Current surface temperature at the simulation origin.
Sourcepub fn surface_temperature_k(&self, time_of_day: f32, day_of_year: f32) -> f32
pub fn surface_temperature_k(&self, time_of_day: f32, day_of_year: f32) -> f32
Return Kelvin surface temperature (convenience wrapper).
pub fn current_season(&self, day_of_year: f32) -> Season
Sourcepub fn current_humidity(&self) -> f32
pub fn current_humidity(&self) -> f32
Current humidity at origin, incorporating weather patterns.
Sourcepub fn current_temperature_c(&self) -> f32
pub fn current_temperature_c(&self) -> f32
Current temperature at origin.
Sourcepub fn drain_events(&mut self) -> Vec<ClimateEvent>
pub fn drain_events(&mut self) -> Vec<ClimateEvent>
Drain pending events (calling code should consume these each frame).
Sourcepub fn trigger_heat_wave(&mut self, peak_c: f32, duration_s: f32)
pub fn trigger_heat_wave(&mut self, peak_c: f32, duration_s: f32)
Manually trigger a heat wave.
Sourcepub fn trigger_cold_snap(&mut self, peak_c: f32, duration_s: f32)
pub fn trigger_cold_snap(&mut self, peak_c: f32, duration_s: f32)
Manually trigger a cold snap.
Sourcepub fn add_pattern(&mut self, pat: WeatherPattern)
pub fn add_pattern(&mut self, pat: WeatherPattern)
Manually add a weather pattern.
Sourcepub fn add_storm_front(&mut self, front: StormFront)
pub fn add_storm_front(&mut self, front: StormFront)
Add a storm front.
Sourcepub fn summary(&self) -> ClimateSummary
pub fn summary(&self) -> ClimateSummary
Return a climate summary for UI or logging.
Trait Implementations§
Source§impl Clone for ClimateSystem
impl Clone for ClimateSystem
Source§fn clone(&self) -> ClimateSystem
fn clone(&self) -> ClimateSystem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClimateSystem
impl Debug for ClimateSystem
Auto Trait Implementations§
impl Freeze for ClimateSystem
impl RefUnwindSafe for ClimateSystem
impl Send for ClimateSystem
impl Sync for ClimateSystem
impl Unpin for ClimateSystem
impl UnsafeUnpin for ClimateSystem
impl UnwindSafe for ClimateSystem
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.