It is impossible to imagine a 3D game without a camera. WebGL does not provide a camera class. We have learned that WebGL is a low-level API, but it gives us a rendering API to help us write one of our own implementations. This chapter is focused on evolving our own camera class for our game scene. We will also empower our users to view the game scene from different angles and positions by adding mouse and keyboard interactivity. We will also implement different types of cameras used in gaming. The topics we will cover are as follows:
ModelView transformations
Perspective transformations
The basic camera
The free camera
Controlling the camera with the keyboard and mouse
The orbit camera