summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-04-24 19:30:30 +0200
committerHampusM <hampus@hampusmat.com>2024-04-24 19:30:30 +0200
commitd06be3fdaf66eb38e6c54fe2b7407d25692f8edc (patch)
tree8b486934d7d3ee88480a788f7c27d729cf1f4737 /src/main.rs
parent711a34d0543575d69d298ade7cc980c5cf2d2e57 (diff)
feat: add light source cube
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs20
1 files changed, 19 insertions, 1 deletions
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<dyn Error>>
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() },));