aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2013-10-21 12:17:31 +0200
committerWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2013-10-21 12:17:31 +0200
commitd3641c368cf960c898f1b1f9c6fc5ee26c71d1b6 (patch)
treebf11fbe23575354b23a7dbce8d20c306231bf368
parent093bf0793ddfb377223d817c8290896880a9e91d (diff)
downloadlinmath-d3641c368cf960c898f1b1f9c6fc5ee26c71d1b6.tar.gz
linmath-d3641c368cf960c898f1b1f9c6fc5ee26c71d1b6.tar.xz
linmath-d3641c368cf960c898f1b1f9c6fc5ee26c71d1b6.zip
linmath.h uses radians for everything -- adjusted contributed perspective function
-rw-r--r--linmath.h8
1 files 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;