From de74c71eb6d6a67e8c7ac006a1e906175ca32a72 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 25 Mar 2026 20:09:13 +0100 Subject: refactor(engine): store textures as assets instead of images --- engine/src/material.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'engine/src/material.rs') diff --git a/engine/src/material.rs b/engine/src/material.rs index 94ab24e..ed1c139 100644 --- a/engine/src/material.rs +++ b/engine/src/material.rs @@ -1,5 +1,6 @@ use ecs::Component; +use crate::asset::Handle as AssetHandle; use crate::builder; use crate::color::Color; use crate::texture::Texture; @@ -13,9 +14,9 @@ pub struct Material pub ambient: Color, pub diffuse: Color, pub specular: Color, - pub ambient_map: Option, - pub diffuse_map: Option, - pub specular_map: Option, + pub ambient_map: Option>, + pub diffuse_map: Option>, + pub specular_map: Option>, pub shininess: f32, } @@ -42,9 +43,9 @@ pub struct Builder ambient: Color, diffuse: Color, specular: Color, - ambient_map: Option, - diffuse_map: Option, - specular_map: Option, + ambient_map: Option>, + diffuse_map: Option>, + specular_map: Option>, shininess: f32, } @@ -89,7 +90,7 @@ impl Builder } #[must_use] - pub fn ambient_map(mut self, ambient_map: Texture) -> Self + pub fn ambient_map(mut self, ambient_map: AssetHandle) -> Self { self.ambient_map = Some(ambient_map); @@ -97,7 +98,7 @@ impl Builder } #[must_use] - pub fn diffuse_map(mut self, diffuse_map: Texture) -> Self + pub fn diffuse_map(mut self, diffuse_map: AssetHandle) -> Self { self.diffuse_map = Some(diffuse_map); @@ -105,7 +106,7 @@ impl Builder } #[must_use] - pub fn specular_map(mut self, specular_map: Texture) -> Self + pub fn specular_map(mut self, specular_map: AssetHandle) -> Self { self.specular_map = Some(specular_map); -- cgit v1.2.3-18-g5258