pub struct DayNightCycle {
pub time_of_day: f32,
pub day_duration: f32,
pub day_count: u32,
pub speed: f32,
pub paused: bool,
}Expand description
Full day/night cycle state.
Fields§
§time_of_day: f32Time of day in range [0, 1) — 0=midnight, 0.25=6am, 0.5=noon, 0.75=6pm.
day_duration: f32Duration of a full day in real seconds.
day_count: u32Current day number.
speed: f32Speed multiplier (1.0 = real-time).
paused: boolImplementations§
Source§impl DayNightCycle
impl DayNightCycle
pub fn new(day_duration: f32) -> Self
pub fn tick(&mut self, dt: f32)
pub fn is_daytime(&self) -> bool
pub fn is_dawn(&self) -> bool
pub fn is_dusk(&self) -> bool
pub fn is_night(&self) -> bool
Sourcepub fn sun_direction(&self) -> Vec3
pub fn sun_direction(&self) -> Vec3
Sun direction (Vec3, normalized).
Sourcepub fn moon_direction(&self) -> Vec3
pub fn moon_direction(&self) -> Vec3
Moon direction (opposite of sun, slightly offset).
Sourcepub fn ambient_intensity(&self) -> f32
pub fn ambient_intensity(&self) -> f32
Ambient light intensity (0–1).
Sourcepub fn sun_intensity(&self) -> f32
pub fn sun_intensity(&self) -> f32
Sun light intensity.
pub fn set_hour(&mut self, h: f32)
Trait Implementations§
Source§impl Clone for DayNightCycle
impl Clone for DayNightCycle
Source§fn clone(&self) -> DayNightCycle
fn clone(&self) -> DayNightCycle
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 DayNightCycle
impl Debug for DayNightCycle
Auto Trait Implementations§
impl Freeze for DayNightCycle
impl RefUnwindSafe for DayNightCycle
impl Send for DayNightCycle
impl Sync for DayNightCycle
impl Unpin for DayNightCycle
impl UnsafeUnpin for DayNightCycle
impl UnwindSafe for DayNightCycle
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.