use super::identity::DecalImageId;
use glam::Vec3;
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum LightShape {
Point { radius: f32 },
Spot {
direction: Vec3,
inner_angle: f32,
outer_angle: f32,
radius: f32,
},
Rect {
direction: Vec3,
width_axis: Vec3,
width: f32,
height: f32,
},
}
impl LightShape {
pub const DEFAULT_RADIUS: f32 = 0.025;
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct LightCookie {
pub image: DecalImageId,
pub up: Vec3,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Light {
pub position: Vec3,
pub shape: LightShape,
pub color: [f32; 3],
pub intensity: f32,
pub range: f32,
pub baked: bool,
pub specular: f32,
pub fog_energy: f32,
pub casts_shadow: bool,
pub shadow_opacity: f32,
pub cookie: Option<LightCookie>,
}
impl Default for Light {
fn default() -> Self {
Self {
position: Vec3::ZERO,
shape: LightShape::Point {
radius: LightShape::DEFAULT_RADIUS,
},
color: [1.; 3],
intensity: std::f32::consts::PI,
range: 5.,
baked: false,
specular: 1.,
fog_energy: 1.,
casts_shadow: false,
shadow_opacity: 1.,
cookie: None,
}
}
}