makePerspective method

Matrix4 makePerspective(
  1. num left,
  2. num right,
  3. num top,
  4. num bottom,
  5. num near,
  6. num far,
)

Implementation

Matrix4 makePerspective(num left, num right, num top, num bottom, num near, num far) {
  var te = elements;
  var x = 2 * near / (right - left);
  var y = 2 * near / (top - bottom);

  var a = (right + left) / (right - left);
  var b = (top + bottom) / (top - bottom);
  var c = -(far + near) / (far - near);
  var d = -2 * far * near / (far - near);

  te[0] = x;
  te[4] = 0;
  te[8] = a;
  te[12] = 0;
  te[1] = 0;
  te[5] = y;
  te[9] = b;
  te[13] = 0;
  te[2] = 0;
  te[6] = 0;
  te[10] = c;
  te[14] = d;
  te[3] = 0;
  te[7] = 0;
  te[11] = -1;
  te[15] = 0;

  return this;
}