XMVectorGetByIndex 函数 (directxmath.h)

按索引检索包含浮点数据的 XMVECTOR 数据类型 的四个组件之一的值。

语法

float XM_CALLCONV XMVectorGetByIndex(
  FXMVECTOR V,
  size_t    i
) noexcept;

参数

V

包含整数数据的 XMVECTOR 数据类型

i

要检索的组件的索引。

返回值

所选组件的浮点值。

注解

i 的值必须是正且小于或等于 3 ( 0 <= i <= 3 ) 。

索引与 XMVECTOR 数据类型 向量组件具有以下对应关系:

索引 组件
0 x
1 y
2 z
3 w
 

平台要求

Microsoft Visual Studio 2010 或 Microsoft Visual Studio 2012 以及 Windows SDK for Windows 8。 支持 Win32 桌面应用、Windows 应用商店应用和 Windows Phone 8 应用。

要求

要求
目标平台 Windows
标头 directxmath.h (包括 DirectXMath.h)

另请参阅

DirectXMath 库矢量访问器函数

XMVectorGetByIndexPtr

XMVectorSetByIndex