Skip to content

Commit

Permalink
Merge pull request #614 from chrisprice/fix-fov
Browse files Browse the repository at this point in the history
Fix x/y field of view conversion
  • Loading branch information
hannobraun authored May 23, 2022
2 parents 670acf9 + b55c592 commit aee0d5b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/fj-viewer/src/graphics/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit aee0d5b

Please sign in to comment.