From ea708c5b2fad7e5a9f1787fa1422bcf7fab69dc4 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 14 Mar 2022 09:07:49 +0200 Subject: [PATCH] Use is_ortographic in Camera instead of checking fov directly --- source/render/camera.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/render/camera.cpp b/source/render/camera.cpp index 7ffe0c15..6c85a732 100644 --- a/source/render/camera.cpp +++ b/source/render/camera.cpp @@ -148,16 +148,16 @@ bool Camera::is_in_frustum(const Renderable &renderable) const void Camera::update_projection_matrix() { - float frustum_h = (fov!=Geometry::Angle::zero() ? tan(fov/2.0f)*clip_near : height/2); + float frustum_h = (is_orthographic() ? height/2 : tan(fov/2.0f)*clip_near); float frustum_w = frustum_h*aspect; float left = frustum_w*(frustum_x-1.0f); float right = frustum_w*(frustum_x+1.0f); float bottom = frustum_h*(frustum_y-1.0f); float top = frustum_h*(frustum_y+1.0f); - if(fov>Geometry::Angle::zero()) - proj_matrix = Matrix::frustum(left, right, bottom, top, clip_near, clip_far); - else + if(is_orthographic()) proj_matrix = Matrix::ortho(left, right, bottom, top, clip_near, clip_far); + else + proj_matrix = Matrix::frustum(left, right, bottom, top, clip_near, clip_far); proj_matrix = Matrix::rotation(rotate, Vector3(0, 0, 1))*proj_matrix; shdata.uniform("clip_eye_matrix", proj_matrix); -- 2.43.0