makePerspectiveMatrix function

Matrix4 makePerspectiveMatrix(
  1. double fovYRadians,
  2. double aspectRatio,
  3. double zNear,
  4. 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 r = Matrix4.zero();
  setPerspectiveMatrix(r, fovYRadians, aspectRatio, zNear, zFar);
  return r;
}