diff options
author | HampusM <hampus@hampusmat.com> | 2024-05-18 12:02:59 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-05-18 12:02:59 +0200 |
commit | 68f9e80863a0ac73fcbd14693ad559728ca655dc (patch) | |
tree | bef289b52bfafc59be1f494f43d229a19ff87718 /src | |
parent | f82ceb5587954802352e00ffacd229559a2ca4df (diff) |
fix: add GlobalLight sole
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 12 |
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()); |