summaryrefslogtreecommitdiff
path: root/engine/src/renderer
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-04-24 20:43:18 +0200
committerHampusM <hampus@hampusmat.com>2024-04-24 20:43:18 +0200
commit33f7772ddddf2a1c2bfefc50ef39f123df8af3e4 (patch)
treec142293d3ebdcbbaf36220fb073873c95575de9d /engine/src/renderer
parentd06be3fdaf66eb38e6c54fe2b7407d25692f8edc (diff)
feat(engine): add colors to materials
Diffstat (limited to 'engine/src/renderer')
-rw-r--r--engine/src/renderer/mod.rs34
1 files changed, 31 insertions, 3 deletions
diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs
index 5125da8..af91257 100644
--- a/engine/src/renderer/mod.rs
+++ b/engine/src/renderer/mod.rs
@@ -383,21 +383,49 @@ fn apply_light(
.into(),
);
+ gl_shader_program.set_uniform_vec_3fv(
+ cstr!("material.ambient"),
+ &material
+ .ambient()
+ .cloned()
+ .unwrap_or(Color { red: 1.0, green: 1.0, blue: 1.0 })
+ .into(),
+ );
+
+ gl_shader_program.set_uniform_vec_3fv(
+ cstr!("material.diffuse"),
+ &material
+ .diffuse()
+ .cloned()
+ .unwrap_or(Color { red: 1.0, green: 1.0, blue: 1.0 })
+ .into(),
+ );
+
+ #[allow(clippy::cast_possible_wrap)]
+ gl_shader_program.set_uniform_vec_3fv(
+ cstr!("material.specular"),
+ &material
+ .specular()
+ .cloned()
+ .unwrap_or(Color { red: 1.0, green: 1.0, blue: 1.0 })
+ .into(),
+ );
+
#[allow(clippy::cast_possible_wrap)]
gl_shader_program.set_uniform_1i(
- cstr!("material.ambient"),
+ cstr!("material.ambient_map"),
material.ambient_map().into_inner() as i32,
);
#[allow(clippy::cast_possible_wrap)]
gl_shader_program.set_uniform_1i(
- cstr!("material.diffuse"),
+ cstr!("material.diffuse_map"),
material.diffuse_map().into_inner() as i32,
);
#[allow(clippy::cast_possible_wrap)]
gl_shader_program.set_uniform_1i(
- cstr!("material.specular"),
+ cstr!("material.specular_map"),
material.specular_map().into_inner() as i32,
);