makeOrthographic method

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

Implementation

Matrix4 makeOrthographic(double left, double right, double top, double bottom, double near, double far) {
  final te = storage;
  final w = 1.0 / (right - left);
  final h = 1.0 / (top - bottom);
  final p = 1.0 / (far - near);

  final x = (right + left) * w;
  final y = (top + bottom) * h;
  final z = (far + near) * p;

  te[0] = 2 * w;
  te[4] = 0;
  te[8] = 0;
  te[12] = -x;
  te[1] = 0;
  te[5] = 2 * h;
  te[9] = 0;
  te[13] = -y;
  te[2] = 0;
  te[6] = 0;
  te[10] = -2 * p;
  te[14] = -z;
  te[3] = 0;
  te[7] = 0;
  te[11] = 0;
  te[15] = 1;

  return this;
}