From f82ceb5587954802352e00ffacd229559a2ca4df Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 12 May 2024 19:02:35 +0200 Subject: feat(engine): add global material ambient color offsetting --- engine/src/lighting.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'engine/src/lighting.rs') diff --git a/engine/src/lighting.rs b/engine/src/lighting.rs index e0608ef..6944ee5 100644 --- a/engine/src/lighting.rs +++ b/engine/src/lighting.rs @@ -1,6 +1,7 @@ -use ecs::Component; +use ecs::{Component, Sole}; use crate::color::Color; +use crate::util::builder; #[derive(Debug, Clone, Component)] pub struct LightSource @@ -21,3 +22,22 @@ impl Default for LightSource } } } + +builder! { +/// Global light properties. +#[builder(name = GlobalLightBuilder, derives = (Debug, Clone, Default))] +#[derive(Debug, Clone, Default, Sole)] +#[non_exhaustive] +pub struct GlobalLight +{ + pub ambient_offset: Color, +} +} + +impl GlobalLight +{ + pub fn builder() -> GlobalLightBuilder + { + GlobalLightBuilder::default() + } +} -- cgit v1.2.3-18-g5258