diff options
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/camera_matrix.cpp | 7 | ||||
-rw-r--r-- | core/math/camera_matrix.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 52d77b6ebc..a60dea7379 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -67,9 +67,10 @@ Plane CameraMatrix::xform4(const Plane& p_vec4) { void CameraMatrix::set_perspective(float p_fovy_degrees, float p_aspect, float p_z_near, float p_z_far,bool p_flip_fov) { - if (p_flip_fov) - p_fovy_degrees=get_fovy(p_fovy_degrees,p_aspect); + if (p_flip_fov) { + p_fovy_degrees=get_fovy(p_fovy_degrees,1.0/p_aspect); + } float sine, cotangent, deltaZ; float radians = p_fovy_degrees / 2.0 * Math_PI / 180.0; @@ -110,7 +111,7 @@ void CameraMatrix::set_orthogonal(float p_left, float p_right, float p_bottom, f void CameraMatrix::set_orthogonal(float p_size, float p_aspect, float p_znear, float p_zfar,bool p_flip_fov) { - if (p_flip_fov) { + if (!p_flip_fov) { p_size*=p_aspect; } diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index 6ffcb0ed0b..767236ea04 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -60,7 +60,7 @@ struct CameraMatrix { static float get_fovy(float p_fovx,float p_aspect) { - return Math::atan(p_aspect * Math::tan(p_fovx * 0.5))*2.0; + return Math::rad2deg(Math::atan(p_aspect * Math::tan(Math::deg2rad(p_fovx) * 0.5))*2.0); } float get_z_far() const; |