makeViewMatrix function Null safety

Matrix4 makeViewMatrix (
  1. Vector3 cameraPosition,
  2. Vector3 cameraFocusPosition,
  3. Vector3 upDirection

Constructs a new OpenGL view matrix.

cameraPosition specifies the position of the camera. cameraFocusPosition specifies the position the camera is focused on. upDirection specifies the direction of the up vector (usually, +Y).


Matrix4 makeViewMatrix(
    Vector3 cameraPosition, Vector3 cameraFocusPosition, Vector3 upDirection) {
  final r =;
  setViewMatrix(r, cameraPosition, cameraFocusPosition, upDirection);
  return r;