From d06be3fdaf66eb38e6c54fe2b7407d25692f8edc Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 24 Apr 2024 19:30:30 +0200 Subject: feat: add light source cube --- src/main.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index b0ad6b2..2b2afac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -57,7 +57,25 @@ fn main() -> Result<(), Box> ShaderProgram::new()?, )); - engine.spawn((LightSource { ..Default::default() }, Transform::default())); + let light_source_texture = Texture::open(Path::new("yellow.jpg"))?; + + let light_source_texture_id = light_source_texture.id(); + + engine.spawn(( + LightSource { ..Default::default() }, + Transform { + position: Vec3 { x: -2.0, y: 3.0, z: 3.0 }, + ..Default::default() + }, + create_cube_mesh(cube_vertex_builder_cb), + TextureList::from_iter([light_source_texture]), + MaterialBuilder::new() + .ambient_map(light_source_texture_id) + .diffuse_map(light_source_texture_id) + .specular_map(light_source_texture_id) + .build(), + ShaderProgram::new()?, + )); engine.spawn((Camera { current: true, ..Default::default() },)); -- cgit v1.2.3-18-g5258