Skip to content

Commit

Permalink
Merge pull request #1004 from hemostx/h_fovx-fix
Browse files Browse the repository at this point in the history
FOV: fix rare CalcFov+viewsize glitches
  • Loading branch information
tcsabina authored Jan 21, 2025
2 parents 96b8d61 + 4b966c2 commit 4093db5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/cl_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,18 @@ static void CalcFov(float fov, float *fov_x, float *fov_y, float width, float he

if (width / 4 < height / 3) {
fovx = fov;
t = width / tan(fovx / 360 * M_PI);
fovy = atan (height / t) * 360 / M_PI;

if (reduce_vertfov) {
// Crop vertically when viewsize decreased
// hmx: Fixes "legacy" fov style causing some visual glitches since 3.0.1 in rare aspect ratios/viewsizes combos
// *almost* matches 3.0 results *and* not visually broken
t = view_width / tan(fovx / 360 * M_PI);
fovy = atan(view_height / t) * 360 / M_PI;
}
else {
t = width / tan(fovx / 360 * M_PI);
fovy = atan(height / t) * 360 / M_PI;
}
}
else {
fovx = fov;
Expand Down

0 comments on commit 4093db5

Please sign in to comment.