共用方式為


XMLoadShortN2 函式 (directxpackedvector.h)

XMSHORTN2 載入 XMVECTOR

語法

XMVECTOR XM_CALLCONV XMLoadShortN2(
  [in] const XMSHORTN2 *pSource
) noexcept;

參數

[in] pSource

要載入之 XMSHORTN2 結構的位址。 此參數必須指向快取的記憶體。

傳回值

傳回從pSource參數載入的XMVECTOR

備註

下列虛擬程式碼會顯示函式的作業。

XMVECTOR vectorOut;

vectorOut.x = (float)pSource->x / 32767.0f;
vectorOut.y = (float)pSource->y / 32767.0f;
vectorOut.z = 0;
vectorOut.w = 0;

return vectorOut;

請注意,-32767 和 -32768 都會對應至 -1.f。

平臺需求

Microsoft Visual Studio 2010 或 Microsoft Visual Studio 2012 搭配 Windows SDK for Windows 8。 支援 Win32 傳統型應用程式、Windows 市集應用程式和 Windows Phone 8 個應用程式。

需求

   
目標平台 Windows
標頭 directxpackedvector.h (包含 DirectXPackedVector.h)

另請參閱

DirectXMath 程式庫向量載入函式