From 88ce3ed506277c881d9ef2a898ec9862f2a7b243 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 12 May 2024 13:01:33 +0200 Subject: fix(engine): make default material colors black --- engine/src/material.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'engine/src/material.rs') diff --git a/engine/src/material.rs b/engine/src/material.rs index c896084..880f689 100644 --- a/engine/src/material.rs +++ b/engine/src/material.rs @@ -7,9 +7,9 @@ use crate::texture::{Id as TextureId, Texture}; #[derive(Debug, Clone, Component)] pub struct Material { - ambient: Option>, - diffuse: Option>, - specular: Option>, + ambient: Color, + diffuse: Color, + specular: Color, ambient_map: TextureId, diffuse_map: TextureId, specular_map: TextureId, @@ -20,21 +20,21 @@ pub struct Material impl Material { #[must_use] - pub fn ambient(&self) -> Option<&Color> + pub fn ambient(&self) -> &Color { - self.ambient.as_ref() + &self.ambient } #[must_use] - pub fn diffuse(&self) -> Option<&Color> + pub fn diffuse(&self) -> &Color { - self.diffuse.as_ref() + &self.diffuse } #[must_use] - pub fn specular(&self) -> Option<&Color> + pub fn specular(&self) -> &Color { - self.specular.as_ref() + &self.specular } #[must_use] @@ -206,9 +206,9 @@ impl Builder }); Material { - ambient: self.ambient.clone(), - diffuse: self.diffuse.clone(), - specular: self.specular.clone(), + ambient: self.ambient.unwrap_or_default(), + diffuse: self.diffuse.unwrap_or_default(), + specular: self.specular.unwrap_or_default(), ambient_map, diffuse_map, specular_map, -- cgit v1.2.3-18-g5258