setInfiniteMatrix function
Constructs an OpenGL infinite projection matrix in infiniteMatrix
.
fovYRadians
specifies the field of view angle, in radians, in the y
direction.
aspectRatio
specifies the aspect ratio that determines the field of view
in the x direction. The aspect ratio of x (width) to y (height).
zNear
specifies the distance from the viewer to the near plane
(always positive).
Implementation
void setInfiniteMatrix(Matrix4 infiniteMatrix, double fovYRadians,
double aspectRatio, double zNear) {
final double height = math.tan(fovYRadians * 0.5);
final double width = height * aspectRatio;
infiniteMatrix
..setZero()
..setEntry(0, 0, 1.0 / width)
..setEntry(1, 1, 1.0 / height)
..setEntry(2, 2, -1.0)
..setEntry(3, 2, -1.0)
..setEntry(2, 3, -2.0 * zNear);
}