Let's now write our class for the basic camera. What have we learned so far? There are two transformation matrices: the view matrix and the projection matrix. To calculate the view matrix, we need four parameters: up, direction, left, and position. These parameters define the camera's orientation and position in space.

To compute the projection matrix, we need four parameters as well: field of view (radians), aspect ratio of the 2D screen, and the near and far clip planes.

Hence, in our basic camera class, we will need getters/setters for our four parameters and a function to calculate the view and projection matrices. Although the camera class in games would need more functions such as pitch and yaw, we will first create ...

Start Free Trial

No credit card required