Vectors

You've seen vectors already within this book, and it's possible you think that they are simply a representation of a point in space, such as a vertex. Although it's true that the vector can store this information, it does so in the DirectX API mainly for a convenience. The mathematical definition of a vector is an object that denotes both direction and velocity (or magnitude). For example, if you fire a bullet out of a tank (for which you will write code in the next game), that bullet has both a direction and a velocity. They are stored in one vector, which incidentally has the same members as a vertex, namely x, y, and z components. You're probably thinking, wait, how can you specify these two things with a single set of three coordinates? ...

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.