Creating the Camera Class

Before you finish this chapter, you implement the camera class. During the Blockers game, you handled all the camera movements (mainly the view transform) on your own. Although it is a completely viable option, it can be a little annoying. Having an abstracted camera class is more natural. Create a new code file (call it camera.cs) in your project, and use the code from Listing 13.11 for the initial implementation.

Listing 13.11. Initial Camera Class
 using System; using Microsoft.DirectX; using Microsoft.DirectX.Direct3D; namespace Tankers { public class Camera { // Attributes for view matrix private Vector3 eyeVector; private Vector3 lookAtVector; private Vector3 upVector; // Matrix for the view transform private Matrix ...

Get Beginning 3D Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.