orthoNO function

List<double> orthoNO(
  1. List<double> out,
  2. double left,
  3. double right,
  4. double bottom,
  5. double top,
  6. double near,
  7. double far,
)

Generates a orthogonal projection matrix with the given bounds. The near/far clip planes correspond to a normalized device coordinate Z range of -1, 1, which matches WebGL/OpenGL's clip volume.

@param {mat4} out mat4 frustum matrix will be written into @param {number} left Left bound of the frustum @param {number} right Right bound of the frustum @param {number} bottom Bottom bound of the frustum @param {number} top Top bound of the frustum @param {number} near Near bound of the frustum @param {number} far Far bound of the frustum @returns {mat4} out

Implementation

List<double> orthoNO(List<double> out, double left, double right, double bottom, double top, double near, double far) {
  final lr = 1 / (left - right);
  final bt = 1 / (bottom - top);
  final nf = 1 / (near - far);
  out[0] = -2 * lr;
  out[1] = 0;
  out[2] = 0;
  out[3] = 0;
  out[4] = 0;
  out[5] = -2 * bt;
  out[6] = 0;
  out[7] = 0;
  out[8] = 0;
  out[9] = 0;
  out[10] = 2 * nf;
  out[11] = 0;
  out[12] = (left + right) * lr;
  out[13] = (top + bottom) * bt;
  out[14] = (far + near) * nf;
  out[15] = 1;
  return out;
}