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:
parent
f830b149b0
commit
ea75b102d0
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user