From 68f9e80863a0ac73fcbd14693ad559728ca655dc Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 18 May 2024 12:02:59 +0200 Subject: fix: add GlobalLight sole --- src/main.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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> 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> 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> 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()); -- cgit v1.2.3-18-g5258