summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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() },));