XMMATRIX Structure

Describes a 4*4 matrix aligned on a 16-byte boundary that maps to four hardware vector registers.

For a list of additional functionality such as constructors and operators that are available using XMMATRIX when you are programming in C++, see XMMATRIX Extensions.

Note

See DirectXMath Library Type Equivalences for information about equivalent D3DDECLTYPE, D3DFORMAT, and DXGI_FORMAT objects.

Syntax

struct XMMATRIX  

Remarks

In the DirectXMath.h header file, the system uses an alias to the XMMATRIX object, specifically CXMMATRIX. The header uses the alias to comply with the optimal in-line calling conventions of different compilers. For most projects using DirectXMath it is sufficient to simply treat this as an exact alias to XMMATRIX.

Effectively:

typedef const XMMATRIX CXMMATRIX;  

For projects that need detailed information about how different platform’s calling conventions are handled, see Library Internals.

XMMATRIX is row-major and all DirectXMath functions that accept an XMMATRIX as a parameter expect data to be organized as row-major.

Data in an XMMATRIX has the following layout.

_11 _12 _13 _14
_21 _22 _23 _24
_31 _32 _33 _34
_41 _42 _43 _44  

DirectXMath defines XMMATRIX as a fully opaque type. To access individual elements of XMMATRIX, use equivalent types such as XMFLOAT4 for a given row or XMFLOAT4X4 for the whole matrix.

Note

XNAMath 2.x defines XMMATRIX as a union with _11 to _44 members and an m array member. When you use these members of the union, poor performance results. DirectXMath.h still defines these XMMATRIX union members for when you build an app with XM_NO_INTRINSICS. XNAMath version 2.05 provides an opt-in XM_STRICT_XMMATRIX to enforce the DirectXMath behavior.

Namespace: Use DirectX

Requirements

Header: Declared in directxmath.h.