summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 8f01cd2..358b15b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,7 +8,7 @@ use engine::data_types::dimens::Dimens;
use engine::ecs::sole::Single;
use engine::event::Start as StartEvent;
use engine::input::Extension as InputExtension;
-use engine::lighting::LightSource;
+use engine::lighting::{GlobalLight, LightSource};
use engine::material::Builder as MaterialBuilder;
use engine::renderer::Extension as RendererExtension;
use engine::shader::Program as ShaderProgram;
@@ -66,7 +66,7 @@ fn main() -> Result<(), Box<dyn Error>>
let light_source_texture_id = light_source_texture.id();
engine.spawn((
- LightSource { ..Default::default() },
+ LightSource::default(),
Transform {
position: Vec3 { x: -2.0, y: 3.0, z: 3.0 },
..Default::default()
@@ -75,7 +75,7 @@ fn main() -> Result<(), Box<dyn Error>>
MaterialBuilder::new()
.textures([light_source_texture])
.diffuse(Color::WHITE_F32)
- .ambient(Color::WHITE_F32)
+ .ambient(Color::WHITE_F32 * 3.0)
.specular(Color::WHITE_F32)
.ambient_map(light_source_texture_id)
.diffuse_map(light_source_texture_id)
@@ -86,6 +86,12 @@ fn main() -> Result<(), Box<dyn Error>>
engine.spawn((Camera { current: true, ..Default::default() },));
+ engine.add_sole(
+ GlobalLight::builder()
+ .ambient_offset(-Color::WHITE_F32)
+ .build(),
+ )?;
+
engine.register_system(StartEvent, prepare_window);
engine.add_extension(RendererExtension::default());