makePerspectiveMatrix function

Matrix4 makePerspectiveMatrix (double fovYRadians, double aspectRatio, double zNear, double zFar)

Constructs a new OpenGL perspective projection matrix.

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). zFar specifies the distance from the viewer to the far plane (always positive).

Implementation

Matrix4 makePerspectiveMatrix(
    double fovYRadians, double aspectRatio, double zNear, double zFar) {
  final Matrix4 r = new Matrix4.zero();
  setPerspectiveMatrix(r, fovYRadians, aspectRatio, zNear, zFar);
  return r;
}