setOrthographicMatrix function

void setOrthographicMatrix(
  1. Matrix4 orthographicMatrix,
  2. double left,
  3. double right,
  4. double bottom,
  5. double top,
  6. double near,
  7. double far,
)

Constructs an OpenGL orthographic projection matrix in orthographicMatrix.

left, right specify the coordinates for the left and right vertical clipping planes. bottom, top specify the coordinates for the bottom and top horizontal clipping planes. near, far specify the coordinates to the near and far depth clipping planes.

Implementation

void setOrthographicMatrix(Matrix4 orthographicMatrix, double left,
    double right, double bottom, double top, double near, double far) {
  final rml = right - left;
  final rpl = right + left;
  final tmb = top - bottom;
  final tpb = top + bottom;
  final fmn = far - near;
  final fpn = far + near;
  orthographicMatrix
    ..setZero()
    ..setEntry(0, 0, 2.0 / rml)
    ..setEntry(1, 1, 2.0 / tmb)
    ..setEntry(2, 2, -2.0 / fmn)
    ..setEntry(0, 3, -rpl / rml)
    ..setEntry(1, 3, -tpb / tmb)
    ..setEntry(2, 3, -fpn / fmn)
    ..setEntry(3, 3, 1.0);
}