aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-27 18:39:21 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-03-27 18:39:21 +0300
commita374b1a6a34eafdaef28a2a9de96b66be66008cf (patch)
treec22a0f83dff7b19cc0fcd656a9ec8e9c9f9d31e0 /src
parent0ff94978f5f0494df9057adf1ea21c34d9a15fd7 (diff)
downloadminetest-a374b1a6a34eafdaef28a2a9de96b66be66008cf.tar.gz
minetest-a374b1a6a34eafdaef28a2a9de96b66be66008cf.tar.bz2
minetest-a374b1a6a34eafdaef28a2a9de96b66be66008cf.zip
Increase vertical FOV on lower aspect ratios (<16:10)
Diffstat (limited to 'src')
-rw-r--r--src/camera.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/camera.cpp b/src/camera.cpp
index 0148298cb..ba05329e5 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -290,6 +290,9 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
// FOV and aspect ratio
m_aspect = (f32)screensize.X / (f32) screensize.Y;
m_fov_y = fov_degrees * PI / 180.0;
+ // Increase vertical FOV on lower aspect ratios (<16:10)
+ m_fov_y *= MYMAX(1.0, MYMIN(1.4, sqrt(16./10. / m_aspect)));
+ // WTF is this? It can't be right
m_fov_x = 2 * atan(0.5 * m_aspect * tan(m_fov_y));
m_cameranode->setAspectRatio(m_aspect);
m_cameranode->setFOV(m_fov_y);