DirectX SDK

Matrices

You a basic knowledge of matrices to work with Direct3D. For more information, see 3-D Transformations.

Matrices in Direct3D are represented by a 4×4 homogenous matrix, defined by the D3DMATRIX structure in C++, and by the D3DMATRIX type in Visual Basic.

[C++]

The D3D_OVERLOADS implementation of the D3DMATRIX structure (D3DMATRIX (D3D_OVERLOADS)) implements a parentheses ("()") operator. This operator offers convenient access to values in the matrix for C++ programmers. Instead of having to refer to the structure members by name, C++ programmers can refer to them by row and column number and index these numbers as needed. These indices are zero-based, so, for example, the element in the third row, second column would be M(2, 1). To use the D3D_OVERLOADS operators, define D3D_OVERLOADS before including the D3dtypes.h header file.

The D3dutil.cpp source file also provides helper functions for creating and concatenating matrices. You can use these functions as they are or as a basis to write your own matrix manipulation functions.

[C++,Visual Basic]