Skip to content

Commit

Permalink
Fix x/y field of view conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisprice authored and hannobraun committed May 23, 2022
1 parent 670acf9 commit b55c592
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 b55c592

Please sign in to comment.