diff options
author | HampusM <hampus@hampusmat.com> | 2024-05-23 22:47:30 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-05-23 22:47:30 +0200 |
commit | 36886e343781bf0ddf7458d5c6db5b5724c918e4 (patch) | |
tree | ac99b294c57f9646ad100b00da719fa870b4efd9 /engine/src/lighting.rs | |
parent | f47ce90430f36e74d713e22781a34f89149f7ea5 (diff) |
feat(engine): add directional light
Diffstat (limited to 'engine/src/lighting.rs')
-rw-r--r-- | engine/src/lighting.rs | 21 |
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)] |