diff options
Diffstat (limited to 'engine/src/lighting.rs')
| -rw-r--r-- | engine/src/lighting.rs | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/engine/src/lighting.rs b/engine/src/lighting.rs index abe3d56..eee6afc 100644 --- a/engine/src/lighting.rs +++ b/engine/src/lighting.rs @@ -1,7 +1,7 @@ use crate::builder; use crate::color::{Color, Rgb}; use crate::data_types::vector::Vec3; -use crate::ecs::{Component, Sole}; +use crate::ecs::Component; use crate::reflection::Reflection; builder! { @@ -91,21 +91,37 @@ impl DirectionalLight } builder! { -/// Global light properties. -#[builder(name = GlobalLightBuilder, derives = (Debug, Clone, Default))] -#[derive(Debug, Clone, Default, Sole)] +#[builder(name = EnvironmentalBuilder, derives = (Debug, Clone))] +#[derive(Debug, Clone, Component, Reflection)] #[non_exhaustive] -pub struct GlobalLight +pub struct Environmental { - pub ambient: Color<f32>, + pub ambient_color: Color<f32>, } } -impl GlobalLight +impl Environmental { - #[must_use] - pub fn builder() -> GlobalLightBuilder + pub fn builder() -> EnvironmentalBuilder + { + EnvironmentalBuilder::default() + } +} + +impl Default for Environmental +{ + fn default() -> Self { - GlobalLightBuilder::default() + Self::builder().build() + } +} + +impl Default for EnvironmentalBuilder +{ + fn default() -> Self + { + Self { + ambient_color: Color::Rgb(Rgb { r: 0.2, g: 0.2, b: 0.2 }) + } } } |
