use super::ShadowSettings;
use crate::math::Color;
#[derive(Debug, Clone, Copy)]
pub struct PointLight {
pub color: Color,
pub intensity: f32,
pub distance: f32,
pub decay: f32,
pub cast_shadow: bool,
pub shadow: ShadowSettings,
}
impl Default for PointLight {
fn default() -> Self {
Self::new(Color::WHITE, 1.0)
}
}
impl PointLight {
pub fn new(color: Color, intensity: f32) -> Self {
Self {
color,
intensity,
distance: 0.0,
decay: 2.0,
cast_shadow: false,
shadow: ShadowSettings::default(),
}
}
pub fn with_distance(mut self, distance: f32) -> Self {
self.distance = distance;
self
}
pub fn with_decay(mut self, decay: f32) -> Self {
self.decay = decay;
self
}
}