matrix: assert that fov is within 0-360

this will catch more cases where degrees are used where radians area
expected.
This commit is contained in:
Danny Robson 2018-04-11 18:23:17 +10:00
parent f830b149b0
commit ea75b102d0

View File

@ -174,10 +174,11 @@ template <typename T>
util::matrix4<T>
util::perspective (T fov, T aspect, range<T> Z)
{
CHECK_LIMIT (fov, 0, 2 * util::pi<T>);
CHECK_GE (Z.lo, 0);
CHECK_GE (Z.hi, 0);
T f = 1 / std::tan (fov / 2);
T f = cos (T{0.5} * fov) / sin (T{0.5} * fov);
T x = f / aspect;
T y = f;