matrix: fix missed negation on one component of ortho

This commit is contained in:
Danny Robson 2018-03-06 13:53:39 +11:00
parent b23c274742
commit c2a880c290

View File

@ -133,19 +133,19 @@ matrix<Rows,Cols,T>::is_affine (void) const
//-----------------------------------------------------------------------------
template <typename T>
util::matrix4<T>
util::ortho (T left, T right,
T bottom, T top,
T near, T far)
util::ortho (T l, T r, // left, right
T b, T t, // bottom, top
T n, T f) // near, far
{
CHECK_GT (far, near);
CHECK_GT (f, n);
T tx = - (right + left) / (right - left);
T ty = - (top + bottom) / (top - bottom);
T tz = - (far + near) / (far - near);
T tx = - (r + l) / (r - l);
T ty = - (t + b) / (t - b);
T tz = - (f + n) / (f - n);
T rl = 2 / (right - left);
T tb = 2 / (top - bottom);
T fn = 2 / (far - near);
T rl = 2 / (r - l);
T tb = 2 / (t - b);
T fn = -2 / (f - n);
return {{
{ rl, 0, 0, tx },