summaryrefslogtreecommitdiff
path: root/engine/src/lighting.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-05-23 22:47:30 +0200
committerHampusM <hampus@hampusmat.com>2024-05-23 22:47:30 +0200
commit36886e343781bf0ddf7458d5c6db5b5724c918e4 (patch)
treeac99b294c57f9646ad100b00da719fa870b4efd9 /engine/src/lighting.rs
parentf47ce90430f36e74d713e22781a34f89149f7ea5 (diff)
feat(engine): add directional light
Diffstat (limited to 'engine/src/lighting.rs')
-rw-r--r--engine/src/lighting.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/engine/src/lighting.rs b/engine/src/lighting.rs
index ffa2645..398161f 100644
--- a/engine/src/lighting.rs
+++ b/engine/src/lighting.rs
@@ -1,6 +1,7 @@
use ecs::{Component, Sole};
use crate::color::Color;
+use crate::data_types::vector::Vec3;
use crate::util::builder;
builder! {
@@ -65,6 +66,26 @@ impl Default for AttenuationParams
}
builder! {
+#[builder(name = DirectionalLightBuilder, derives = (Debug, Default, Clone))]
+#[derive(Debug, Default, Clone, Component)]
+#[non_exhaustive]
+pub struct DirectionalLight
+{
+ pub diffuse: Color<f32>,
+ pub specular: Color<f32>,
+ pub direction: Vec3<f32>,
+}
+}
+
+impl DirectionalLight
+{
+ pub fn builder() -> DirectionalLightBuilder
+ {
+ DirectionalLightBuilder::default()
+ }
+}
+
+builder! {
/// Global light properties.
#[builder(name = GlobalLightBuilder, derives = (Debug, Clone, Default))]
#[derive(Debug, Clone, Default, Sole)]