1use crate::core::Color;
4
5#[derive(Debug, Clone, Copy)]
7pub struct PointLight {
8 pub position: [f32; 3],
9 pub color: Color,
10 pub intensity: f32,
11 pub range: f32,
12}
13
14impl PointLight {
15 pub fn new(position: [f32; 3]) -> Self {
16 Self {
17 position,
18 color: Color::WHITE,
19 intensity: 1.0,
20 range: 50.0,
21 }
22 }
23
24 pub fn color(mut self, color: Color) -> Self {
25 self.color = color;
26 self
27 }
28
29 pub fn intensity(mut self, intensity: f32) -> Self {
30 self.intensity = intensity;
31 self
32 }
33
34 pub fn range(mut self, range: f32) -> Self {
35 self.range = range;
36 self
37 }
38}
39
40#[derive(Debug, Clone, Copy)]
42pub struct DirectionalLight {
43 pub direction: [f32; 3],
44 pub color: Color,
45 pub intensity: f32,
46}
47
48impl DirectionalLight {
49 pub fn new(direction: [f32; 3]) -> Self {
50 Self {
51 direction,
52 color: Color::WHITE,
53 intensity: 1.0,
54 }
55 }
56
57 pub fn color(mut self, color: Color) -> Self {
58 self.color = color;
59 self
60 }
61
62 pub fn intensity(mut self, intensity: f32) -> Self {
63 self.intensity = intensity;
64 self
65 }
66}
67
68#[derive(Debug, Clone, Copy)]
70pub enum Light {
71 Point(PointLight),
72 Directional(DirectionalLight),
73}