共用方式為


XMStoreU555 函式 (directxpackedvector.h)

XMVECTOR 儲存在 XMU555中。

語法

void XM_CALLCONV XMStoreU555(
  [out] XMU555    *pDestination,
  [in]  FXMVECTOR V
) noexcept;

參數

[out] pDestination

要儲存資料的位址。

[in] V

包含要儲存之資料的向量。

傳回值

無。

備註

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


  XMVECTOR N;
  static const XMVECTOR  Max = {31.f, 31.f, 31.f, 1.0f };

  N = XMVectorClamp(V, XMVectorZero, Max);
  N = XMVectorRound(N);

  pDestination->x = (int8_t)N.v[0];
  pDestination->y = (int8_t)N.v[1];
  pDestination->z = (int8_t)N.v[2];
  pDestination->w = (int8_t)N.v[3];

請注意,這些不是正規化值。 若要轉換成 RGBA 5/5/5/1 格式,您必須依 (31.f, 31.f, 31.f, 1.f) 縮放輸入向量。 此外,您可能需要將標準 .x = RED、.y = GREEN、.z = BLUE、.w = ALPHA 色彩向量的 .x 和 .z 值撥動,因為 GPU 格式為 BGR (不是 RGB) 。

平臺需求

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

需求

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

另請參閱

DirectXMath 程式庫向量存放區函式