Function frustumMat4

  • Returns a 4x4 perspective projection matrix based on the given frustum bounds.

    This function creates a perspective projection matrix from the left, right, bottom, top, near, and far frustum planes. It is commonly used for 3D rendering where the perspective effect is required.

    Parameters

    • left: number

      The left boundary of the frustum.

    • right: number

      The right boundary of the frustum.

    • bottom: number

      The bottom boundary of the frustum.

    • top: number

      The top boundary of the frustum.

    • near: number

      The distance to the near clipping plane.

    • far: number

      The distance to the far clipping plane.

    • Optionaldest: FloatArrayParam

      An optional destination matrix to store the result. If not provided, a new matrix is created.

    Returns FloatArrayParam

    The resulting 4x4 frustum projection matrix. If dest is provided, it will be modified; otherwise, a new matrix is returned.

    const matrix = frustumMat4(-1, 1, -1, 1, 0.1, 100);
    console.log(matrix);