summaryrefslogtreecommitdiff
path: root/engine/src/material.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/material.rs')
-rw-r--r--engine/src/material.rs22
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)