pub struct WeatherSystem {
pub current: WeatherSnapshot,
pub history: VecDeque<WeatherSnapshot>,
pub max_history: usize,
pub rng: LcgRng,
pub base_temp: f32,
pub season: f32,
pub latitude: f32,
}Fields§
§current: WeatherSnapshot§history: VecDeque<WeatherSnapshot>§max_history: usize§rng: LcgRng§base_temp: f32§season: f32§latitude: f32Implementations§
Source§impl WeatherSystem
impl WeatherSystem
pub fn new(seed: u64, base_temp: f32, latitude: f32) -> Self
Sourcepub fn step(&mut self, hours_elapsed: f32)
pub fn step(&mut self, hours_elapsed: f32)
Advance weather by one time step using Markov chain transitions
Sourcepub fn interpolate_snapshots(
a: &WeatherSnapshot,
b: &WeatherSnapshot,
t: f32,
) -> WeatherSnapshot
pub fn interpolate_snapshots( a: &WeatherSnapshot, b: &WeatherSnapshot, t: f32, ) -> WeatherSnapshot
Linearly interpolate two weather snapshots (for smooth transitions)
Sourcepub fn wind_vector(&self) -> Vec2
pub fn wind_vector(&self) -> Vec2
Compute wind vector from speed and direction
Sourcepub fn is_snowing(&self) -> bool
pub fn is_snowing(&self) -> bool
Check if it’s snowing (temperature below 0 with precipitation)
Sourcepub fn advance_season(&mut self, delta_fraction: f32)
pub fn advance_season(&mut self, delta_fraction: f32)
Advance season (0 = winter, 1 = winter again after full year)
Auto Trait Implementations§
impl Freeze for WeatherSystem
impl RefUnwindSafe for WeatherSystem
impl Send for WeatherSystem
impl Sync for WeatherSystem
impl Unpin for WeatherSystem
impl UnsafeUnpin for WeatherSystem
impl UnwindSafe for WeatherSystem
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.