XMVectorGetByIndex
Retrieve the value of one of the four components of an XMVECTOR Data Type containing floating-point data by index.
Syntax
FLOAT XMVectorGetByIndex(
XMVECTOR V,
UINT i
)
Parameters
- V
A XMVECTOR Data Type containing integer data. - i
The index of the component to be retrieved.
Return Value
The floating-point value of the selected component.
Remarks
The value of i must be positive and less than or equal to three ( 0 ≤ i ≤ 3 ). If not an XMASSERT will be triggered.
The indexes have the following correspondence with XMVECTOR Data Type vector components:
Index | Component |
---|---|
0 |
x |
1 |
y |
2 |
z |
3 |
w |
Note
XMVectorGetByIndexPtr is preferred when targeting the Xbox 360 for storing arbitrary vector elements to memory, since XMVectorGetByIndex may force a Load/Hit/Store event in this situation which degrades performance.
Requirements
Header: Declared in xnamath.h.