From b55c592d2c07714251a4849c337bc103637e7b60 Mon Sep 17 00:00:00 2001 From: Chris Price Date: Sun, 22 May 2022 19:00:52 +0100 Subject: [PATCH] Fix x/y field of view conversion --- crates/fj-viewer/src/graphics/transform.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/fj-viewer/src/graphics/transform.rs b/crates/fj-viewer/src/graphics/transform.rs index f4d40d02e..5e7a01a8b 100644 --- a/crates/fj-viewer/src/graphics/transform.rs +++ b/crates/fj-viewer/src/graphics/transform.rs @@ -15,7 +15,8 @@ impl Transform { /// /// The returned transform is used for transforming vertices on the GPU. pub fn for_vertices(camera: &Camera, aspect_ratio: f64) -> Self { - let field_of_view_in_y = camera.field_of_view_in_x() / aspect_ratio; + let field_of_view_in_y = 2. + * ((camera.field_of_view_in_x() / 2.).tan() / aspect_ratio).atan(); let transform = camera.camera_to_model().project_to_array( aspect_ratio,