diff options
author | HampusM <hampus@hampusmat.com> | 2024-05-19 18:21:53 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-05-19 21:39:59 +0200 |
commit | 5ce6133e120bd5e3d7490db1872bc8b667a0fb4f (patch) | |
tree | deb418997d515a9762170c0d5f8c8896ecce1210 /engine/src/material.rs | |
parent | 2ab8ca293f9548238b22d96d4fd88ec93d6b2431 (diff) |
fix(engine): use ambient light from GlobalLight
Diffstat (limited to 'engine/src/material.rs')
-rw-r--r-- | engine/src/material.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/engine/src/material.rs b/engine/src/material.rs index 5e360cd..5c59a9a 100644 --- a/engine/src/material.rs +++ b/engine/src/material.rs @@ -3,6 +3,7 @@ use ecs::Component; use crate::color::Color; use crate::data_types::dimens::Dimens; use crate::texture::{Id as TextureId, Texture}; +use crate::util::builder; #[derive(Debug, Clone, Component)] #[non_exhaustive] @@ -176,6 +177,27 @@ impl Default for Builder } } +builder! { +/// Material flags. +#[builder(name = FlagsBuilder, derives = (Debug, Default, Clone))] +#[derive(Debug, Default, Clone, Component)] +#[non_exhaustive] +pub struct Flags +{ + /// Whether to use material's ambient color instead of the global ambient color. + /// Default is `false` + pub use_ambient_color: bool, +} +} + +impl Flags +{ + pub fn builder() -> FlagsBuilder + { + FlagsBuilder::default() + } +} + fn create_1x1_white_texture() -> Texture { Texture::new_from_color(&Dimens { width: 1, height: 1 }, &Color::WHITE_U8) |