From b0315b7ebc16fcbae6c3098db6c824f9057d2a71 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 20 Nov 2023 22:00:34 +0100 Subject: feat(engine): add materials --- engine/src/lib.rs | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'engine/src/lib.rs') 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, light_source: Option, - light_settings: Option, 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 = 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) { let frame_start_time = Instant::now(); -- cgit v1.2.3-18-g5258