use crate::color::Color; use crate::vector::Vec3; #[derive(Debug, Clone)] pub struct LightSettings { pub ambient_light_strength: f32, pub specular_light_strength: f32, pub specular_shininess: u32, } impl Default for LightSettings { fn default() -> Self { Self { ambient_light_strength: 1.0, specular_light_strength: 0.0, specular_shininess: 32, } } } #[derive(Debug, Clone)] pub struct LightSource { position: Vec3, color: Color, } impl LightSource { #[must_use] pub fn position(&self) -> &Vec3 { &self.position } #[must_use] pub fn color(&self) -> &Color { &self.color } pub fn translate(&mut self, translation: Vec3) { self.position += translation; } } #[derive(Debug, Clone, Default)] pub struct LightSourceBuilder { position: Vec3, color: Color, } impl LightSourceBuilder { #[must_use] pub fn new() -> Self { Self { position: Vec3::default(), color: Color::WHITE_F32, } } #[must_use] pub fn position(mut self, position: Vec3) -> Self { self.position = position; self } #[must_use] pub fn color(mut self, color: Color) -> Self { self.color = color; self } #[must_use] pub fn build(&self) -> LightSource { LightSource { position: self.position.clone(), color: self.color.clone(), } } }