diff options
author | HampusM <hampus@hampusmat.com> | 2023-11-20 22:00:34 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-11-20 22:00:34 +0100 |
commit | b0315b7ebc16fcbae6c3098db6c824f9057d2a71 (patch) | |
tree | c7473fbdbcc59aff933790892ee015a6f05d8565 /engine/src/lib.rs | |
parent | a65c8abcae46b382b2e1bb7cc5d13768325083b4 (diff) |
feat(engine): add materials
Diffstat (limited to 'engine/src/lib.rs')
-rw-r--r-- | engine/src/lib.rs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/engine/src/lib.rs b/engine/src/lib.rs index e6568a1..30346ed 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -7,7 +7,7 @@ use glfw::window::KeyState; use glfw::{Window, WindowBuilder}; use crate::camera::Camera; -use crate::lighting::{LightSettings, LightSource}; +use crate::lighting::LightSource; use crate::object::{Id as ObjectId, Object}; use crate::renderer::Renderer; use crate::vector::Vec2; @@ -22,6 +22,7 @@ mod transform; pub mod camera; pub mod color; pub mod lighting; +pub mod material; pub mod math; pub mod object; pub mod texture; @@ -37,7 +38,6 @@ pub struct Engine /// Objects have to be dropped before window. Otherwise, UB. objects: BTreeMap<ObjectId, Object>, light_source: Option<LightSource>, - light_settings: Option<LightSettings>, window: Window, renderer: Renderer, delta_time: Duration, @@ -76,7 +76,6 @@ impl Engine renderer, objects: BTreeMap::new(), light_source: None, - light_settings: None, delta_time: Duration::ZERO, }) } @@ -129,8 +128,6 @@ impl Engine { let mut prev_frame_start: Option<Instant> = None; - let default_light_settings = LightSettings::default(); - while !self.window.should_close() { self.update_delta_time(&mut prev_frame_start); @@ -141,9 +138,6 @@ impl Engine self.renderer.render( self.objects.values(), self.light_source.as_ref(), - self.light_settings - .as_ref() - .unwrap_or(&default_light_settings), &window_size, ); @@ -204,17 +198,6 @@ impl Engine Ok(Vec2 { x: pos.x, y: pos.y }) } - pub fn set_light_settings(&mut self, light_settings: LightSettings) - { - self.light_settings = Some(light_settings); - } - - #[must_use] - pub fn light_settings(&self) -> Option<&LightSettings> - { - self.light_settings.as_ref() - } - fn update_delta_time(&mut self, prev_frame_start: &mut Option<Instant>) { let frame_start_time = Instant::now(); |