MatrixOrtho function

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

Implementation

Matrix4 MatrixOrtho(
  double left,
  double right,
  double bottom,
  double top,
  double near,
  double far,
) {
  final mat = Matrix4.zero();
  mat[0] = 2 / (right - left);
  mat[5] = 2 / (top - bottom);
  mat[10] = -2 / (far - near);
  mat[12] = -(right + left) / (right - left);
  mat[13] = -(top + bottom) / (top - bottom);
  mat[14] = -(far + near) / (far - near);
  mat[15] = 1;
  return mat;
}