From d3641c368cf960c898f1b1f9c6fc5ee26c71d1b6 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Mon, 21 Oct 2013 12:17:31 +0200 Subject: linmath.h uses radians for everything -- adjusted contributed perspective function --- linmath.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linmath.h b/linmath.h index 8807e1f..97f4e17 100644 --- a/linmath.h +++ b/linmath.h @@ -332,11 +332,11 @@ static inline void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, fl M[3][2] = -(f+n)/(f-n); M[3][3] = 1.; } -static inline void mat4x4_perspective(mat4x4 m, float y_fov_in_degrees, float aspect, float n, float f) +static inline void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float n, float f) { - /* Adapted from Android's OpenGL Matrix.java. */ - float const angle_in_radians = y_fov_in_degrees * M_PI / 180.f; - float const a = 1.f / tan(angle_in_radians / 2.f); + /* NOTE: Degrees are an unhandy unit to work with. + * linmath.h uses radians for everything! */ + float const a = 1.f / tan(y_fov / 2.f); m[0][0] = a / aspect; m[0][1] = 0.f; -- cgit v1.2.3-54-g00ecf