O'Reilly logo

Beginning 3D Game Programming by Tom Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required