Creating camera matrices
Matrices are also used for camera transformations, including perspective transforms. A perspective transform maps a frustum to NDC space. NDC space typically has a range of -1 to +1 on all axes. Unlike world/eye coordinates, NDC space is left-handed.
In this section, you will learn how to create camera transformation matrices. The first camera matrix is a frustum, which looks like a pyramid with the tip cut off. A frustum represents everything that is visible to the camera. You will also learn how to create different projections and how to implement a "look at" function that lets you easily create a view matrix.
Frustum
Visually, a frustum looks like a pyramid with the tip cut off. A frustum has six sides; it represents the space that a camera can see. Create the frustum
function in mat4.cpp
. This function takes left, right, bottom, top, near, and far values:
mat4 frustum(float l, float r, float b, Â Â Â Â Â Â ...