makePerspective method

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

Implementation

Matrix4 makePerspective(double left, double right, double top, double bottom, double near, double far) {

  final te = storage;
  final x = 2 * near / (right - left);
  final y = 2 * near / (top - bottom);

  final a = (right + left) / (right - left);
  final b = (top + bottom) / (top - bottom);
  final c = -(far + near) / (far - near);
  final 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;
}