summaryrefslogtreecommitdiff
path: root/engine/src/renderer/mod.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-04-15 23:09:11 +0200
committerHampusM <hampus@hampusmat.com>2024-04-15 23:09:11 +0200
commit9778d9668f8b5d651aaed1f64414f7ed195d153d (patch)
treee7c67bec8e03816e75aad7b1dd89730912908c8d /engine/src/renderer/mod.rs
parentb748977205eea249dc61e6f755bd6ff86c8f535b (diff)
feat(engine): add projection options to camera component
Diffstat (limited to 'engine/src/renderer/mod.rs')
-rw-r--r--engine/src/renderer/mod.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs
index 617c60f..3052969 100644
--- a/engine/src/renderer/mod.rs
+++ b/engine/src/renderer/mod.rs
@@ -35,7 +35,7 @@ use crate::opengl::vertex_array::{
VertexArray,
};
use crate::opengl::{clear_buffers, enable, BufferClearMask, Capability};
-use crate::projection::new_perspective;
+use crate::projection::{new_perspective_matrix, Projection};
use crate::shader::Program as ShaderProgram;
use crate::texture::{Id as TextureId, List as TextureMap, Texture};
use crate::transform::Transform;
@@ -321,12 +321,12 @@ fn apply_transformation_matrices(
gl_shader_program.set_uniform_matrix_4fv(cstr!("view"), &view);
#[allow(clippy::cast_precision_loss)]
- let projection = new_perspective(
- 80.0f32.to_radians(),
- window_size.width as f32 / window_size.height as f32,
- 100.0,
- 0.1,
- );
+ let projection = match &camera.projection {
+ Projection::Perspective(perspective) => new_perspective_matrix(
+ perspective,
+ window_size.width as f32 / window_size.height as f32,
+ ),
+ };
gl_shader_program.set_uniform_matrix_4fv(cstr!("projection"), &projection);
}