From 36886e343781bf0ddf7458d5c6db5b5724c918e4 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 23 May 2024 22:47:30 +0200 Subject: feat(engine): add directional light --- engine/src/lighting.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'engine/src/lighting.rs') 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! { @@ -64,6 +65,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, + pub specular: Color, + pub direction: Vec3, +} +} + +impl DirectionalLight +{ + pub fn builder() -> DirectionalLightBuilder + { + DirectionalLightBuilder::default() + } +} + builder! { /// Global light properties. #[builder(name = GlobalLightBuilder, derives = (Debug, Clone, Default))] -- cgit v1.2.3-18-g5258