Permutes the components of two vectors to create a new vector.
XMVECTOR XMVectorPermute(
XMVECTOR V1,
XMVECTOR V2,
uint32_t PermuteX,
uint32_t PermuteY,
uint32_t PermuteZ,
uint32_t PermuteW
)
V1
Type: XMVECTOR
First vector.
V2
Type: XMVECTOR
Second vector.
PermuteX
Type: uint32_t
Index form 0-7 indicating where the X component of the new vector should be copied from.
PermuteY
Type: uint32_t
Index form 0-7 indicating where the Y component of the new vector should be copied from.
PermuteZ
Type: uint32_t
Index form 0-7 indicating where the Z component of the new vector should be copied from.
PermuteW
Type: uint32_t
Index form 0-7 indicating where the W component of the new vector should be copied from.
Type: XMVECTOR
Returns the permuted vector that resulted from combining the source vectors.
If all 4 indices reference only a single vector (i.e. they are all in the range 0-3 or all in the range 4-7), use XMVectorSwizzle instead for better performance.
The XM_PERMUTE_ constants are provided to use as input values for PermuteX,PermuteY,PermuteZ, and PermuteW.
For constant PermuteX/Y/Z/W parameters, it is much more efficient to use the template form of XMVectorPermute:
template<uint32_t PermuteX, uint32_t PermuteY, uint32_t PermuteZ, uint32_t PermuteW>
XMVECTOR XMVectorPermute(FXMVECTOR V1, FXMVECTOR V2)
Example: XMVectorPermute<XM_PERMUTE_0Z, XM_PERMUTE_1X, XM_PERMUTE_0W, XM_PERMUTE_1Y>( V1, V2 );
Note
This version of
XMVectorPermuteis new for DirectXMath. The XNAMath v2.x library made use ofXMVectorPermuteControl, a controlXMVECTORinstead of 4 indicies forXMVectorPermute, and used different values for the XM_PERMUTE_x constants.
Header: Declared in directxmath.h.