use crate::render3d::color::Rgb;
use crate::render3d::math::Vec3;
#[derive(Debug, Clone, Copy)]
pub enum Light {
Ambient { color: Rgb, intensity: f32 },
Directional {
direction: Vec3,
color: Rgb,
intensity: f32,
},
Point {
position: Vec3,
color: Rgb,
intensity: f32,
},
}
impl Light {
pub fn ambient(color: Rgb, intensity: f32) -> Self {
Self::Ambient { color, intensity }
}
pub fn directional(direction: Vec3, color: Rgb) -> Self {
Self::Directional {
direction: direction.normalize(),
color,
intensity: 1.0,
}
}
pub fn point(position: Vec3, color: Rgb) -> Self {
Self::Point {
position,
color,
intensity: 1.0,
}
}
}