XMVectorSelectControl function (directxmath.h)
Defines a control vector for use in XMVectorSelect.
Syntax
XMVECTOR XM_CALLCONV XMVectorSelectControl(
[in] uint32_t VectorIndex0,
[in] uint32_t VectorIndex1,
[in] uint32_t VectorIndex2,
[in] uint32_t VectorIndex3
) noexcept;
Parameters
[in] VectorIndex0
Index that determines which vector in XMVectorSelect will be selected. If zero, the first vector's first component will be selected. Otherwise, the second vector's component will be selected.
[in] VectorIndex1
Index that determines which vector in XMVectorSelect will be selected. If zero, the first vector's second component will be selected. Otherwise, the second vector's component will be selected.
[in] VectorIndex2
Index that determines which vector in XMVectorSelect will be selected. If zero, the first vector's third component will be selected. Otherwise, the second vector's component will be selected.
[in] VectorIndex3
Index that determines which vector in XMVectorSelect will be selected. If zero, the first vector's fourth component will be selected. Otherwise, the second vector's component will be selected.
Return value
Returns the control vector.
Remarks
The following pseudocode demonstrates the operation of the function:
XMVECTOR ControlVector;
const uint32_t ControlElement[] =
{
XM_SELECT_0,
XM_SELECT_1
};
assert(VectorIndex0 < 2);
assert(VectorIndex1 < 2);
assert(VectorIndex2 < 2);
assert(VectorIndex3 < 2);
ControlVector.u[0] = ControlElement[VectorIndex0];
ControlVector.u[1] = ControlElement[VectorIndex1];
ControlVector.u[2] = ControlElement[VectorIndex2];
ControlVector.u[3] = ControlElement[VectorIndex3];
return ControlVector;
Platform Requirements
Microsoft Visual Studio 2010 or Microsoft Visual Studio 2012 with the Windows SDK for Windows 8. Supported for Win32 desktop apps, Windows Store apps, and Windows Phone 8 apps.Examples
Using XMVectorSelectControl
In this example, XMVectorSelectControl is used to generate a control mask that will select the x and w components from the first vector and the y and z components from the second.
The vector result will be ( 3.0f, 5.0f, 5.0f, 3.0f ).
XMVECTOR three = XMVectorReplicate( 3.0f );
XMVECTOR five = XMVectorReplicate( 5.0f );
XMVECTOR control = XMVectorSelectControl( 0, 1, 1, 0 );
XMVECTOR result = XMVectorSelect( three, five, control );
Requirements
Requirement | Value |
---|---|
Target Platform | Windows |
Header | directxmath.h (include DirectXMath.h) |