use cgmath::*;
pub enum LightType {
Point {
position: Point3<f32>,
intensity: f32,
},
Directional {
direction: Vector3<f32>,
intensity: f32,
},
}
pub struct Light {
pub light_type: LightType,
color: Vector3<f32>,
}
impl Light {
pub fn new(light_type: LightType, color: Vector3<f32>) -> Self {
Self { light_type, color }
}
pub fn get_light_data(&self) -> (Vector3<f32>, f32, Vector3<f32>) {
match &self.light_type {
LightType::Point {
position,
intensity,
} => (position.to_vec(), *intensity, self.color),
LightType::Directional {
direction,
intensity,
} => (*direction, *intensity, self.color),
}
}
}