From 386aad9dac7c22cabb0f1bbba33d248c40bb0310 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 23 Oct 2023 22:23:25 +0200 Subject: feat(engine): add perspective --- engine/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'engine/src/lib.rs') diff --git a/engine/src/lib.rs b/engine/src/lib.rs index dbbd407..ee93695 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -9,6 +9,7 @@ use crate::vector::Vec2; mod matrix; mod opengl; +mod projection; mod renderer; mod transform; @@ -93,7 +94,9 @@ impl Engine while !self.window.should_close() { func(self); - crate::renderer::render(self.objects.values()); + let window_size = self.window.size().map_err(Error::GetWindowSizeFailed)?; + + crate::renderer::render(self.objects.values(), &window_size); self.window .swap_buffers() @@ -123,4 +126,7 @@ pub enum Error #[error("Failed to update window")] UpdateWindowFailed(#[source] glfw::Error), + + #[error("Failed to get window size")] + GetWindowSizeFailed(#[source] glfw::Error), } -- cgit v1.2.3-18-g5258