Skip to main content

ursus_ecs/components/
light.rs

1use glam::Vec3;
2
3pub const DEFAULT_LIGHT_DIRECTION: Vec3 = Vec3::new(-0.3, -1.0, -0.2);
4pub const DEFAULT_LIGHT_COLOR: [f32; 4] = [1.0, 0.95, 0.85, 2.0];
5
6#[derive(Debug, Clone, Copy)]
7pub struct DirectionalLightComponent {
8    pub direction: Vec3,
9    pub color: [f32; 4], // rgb + intensity в alpha
10}
11
12impl Default for DirectionalLightComponent {
13    fn default() -> Self {
14        Self { direction: DEFAULT_LIGHT_DIRECTION, color: DEFAULT_LIGHT_COLOR }
15    }
16}
17
18#[derive(Debug, Clone, Copy)]
19pub struct PointLightComponent {
20    pub position: Vec3,
21    pub radius: f32,
22    pub color: [f32; 4], // rgb + intensity
23}
24
25impl Default for PointLightComponent {
26    fn default() -> Self {
27        PointLightComponent { position: Vec3::ZERO, radius: 1.0, color: [1.0; 4] }
28    }
29}