From f285f82072b491b1f3cc92db8e08485f26779d5a Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 20 Mar 2026 14:22:19 +0100 Subject: feat(engine): use slang for shaders --- engine/src/material.rs | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'engine/src/material.rs') diff --git a/engine/src/material.rs b/engine/src/material.rs index 2b9a8ca..94ab24e 100644 --- a/engine/src/material.rs +++ b/engine/src/material.rs @@ -21,9 +21,9 @@ pub struct Material impl Material { - pub fn builder() -> Builder + pub const fn builder() -> Builder { - Builder::default() + Builder::new() } } @@ -51,7 +51,7 @@ pub struct Builder impl Builder { #[must_use] - pub fn new() -> Self + pub const fn new() -> Self { Self { ambient: Color::WHITE_F32, @@ -125,7 +125,7 @@ impl Builder /// # Panics /// Will panic if no ambient map, diffuse map or specular map is set. #[must_use] - pub fn build(self) -> Material + pub const fn build(self) -> Material { Material { ambient: self.ambient, @@ -149,8 +149,8 @@ impl Default for Builder builder! { /// Material flags. -#[builder(name = FlagsBuilder, derives = (Debug, Default, Clone))] -#[derive(Debug, Default, Clone, Component)] +#[builder(name = FlagsBuilder, derives = (Debug, Clone))] +#[derive(Debug, Clone, Component)] #[non_exhaustive] pub struct Flags { @@ -163,8 +163,32 @@ pub struct Flags impl Flags { #[must_use] - pub fn builder() -> FlagsBuilder + pub const fn builder() -> FlagsBuilder { - FlagsBuilder::default() + FlagsBuilder::new() + } +} + +impl Default for Flags +{ + fn default() -> Self + { + Self::builder().build() + } +} + +impl FlagsBuilder +{ + pub const fn new() -> Self + { + Self { use_ambient_color: false } + } +} + +impl Default for FlagsBuilder +{ + fn default() -> Self + { + Self::new() } } -- cgit v1.2.3-18-g5258