Share via


XMVectorSetByIndexPtr

Use a pointer to a floating-point instance to set the value of one of the four components of an XMVECTOR Data Type containing floating-point data referenced by an index.

Syntax

XMVECTOR XMVectorSetByIndexPtr(
         XMVECTOR V,
         CONST FLOAT *f,
         UINT i
)

Parameters

  • V
    A XMVECTOR Data Type containing floating-point data.
  • f
    [in] A pointer to an floating-point instance used to set the i component of the returned XMVECTOR Data Type.
  • i
    The index of the component to be set.

Return Value

An instance of XMVECTOR Data Type whose i component has been set to the floating-point value provided by the argument f. All other components of the returned XMVECTOR Data Type instance have the same value as those of the input vector V.

Remarks

The value of i must be positive and less than or equal to three ( 0i3 ). 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

XMVectorSetByIndexPtr is preferred when targeting the Xbox 360 for storing arbitrary vector elements to memory, since XMVectorSetByIndex may force a Load/Hit/Store event in this situation which degrades performance.

Requirements

Header: Declared in xnamath.h.

See Also

XMVectorGetByIndexPtr
XMVectorSetByIndex