XMLoadDecN4 函数 (directxpackedvector.h)

XMDECN4 加载到 XMVECTOR 中。

语法

XMVECTOR XM_DEPRECATED XM_CALLCONV XMLoadDecN4(
  [in] const XMDECN4 *pSource
) noexcept;

参数

[in] pSource

要加载的 XMDECN4 结构的地址。

返回值

返回使用 pSource 参数中的数据加载的 XMVECTOR

备注

以下伪代码演示函数的操作。

XMVECTOR vectorOut;

uint32_t Element;
static const uint32_t SignExtend[] = {0x00000000, 0xFFFFFC00};
static const uint32_t SignExtendW[] = {0x00000000, 0xFFFFFFFC};

Element = pSource->v & 0x3FF;
vectorOut.x = (float)(int16_t)(Element | SignExtend[Element >> 9]) / 511.0f;
Element = (pSource->v >> 10) & 0x3FF;
vectorOut.y = (float)(int16_t)(Element | SignExtend[Element >> 9]) / 511.0f;
Element = (pSource->v >> 20) & 0x3FF;
vectorOut.z = (float)(int16_t)(Element | SignExtend[Element >> 9]) / 511.0f;
Element = pSource->v >> 30;
vectorOut.w = (float)(int16_t)(Element | SignExtendW[Element >> 1]);

return vectorOut;

平台要求

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

要求

   
目标平台 Windows
标头 directxpackedvector.h (包括 DirectXMath.h)

请参阅

DirectXMath 库矢量加载函数