XMStoreShort4 関数 (directxpackedvector.h)

XMVECTORXMSHORT4に格納します。

構文

void XM_CALLCONV XMStoreShort4(
  [out] XMSHORT4  *pDestination,
  [in]  FXMVECTOR V
) noexcept;

パラメーター

[out] pDestination

データを格納するアドレス。

[in] V

格納するデータを含むベクター。

戻り値

[なし] :

解説

この関数はベクトルを受け取り、それを -32767.0f から 32767.0f の範囲にクランプし、コンポーネントを符号付きの正規化された整数形式に変換し、結果を指定されたアドレスで 4 つの短い整数値に書き込みます。 最上位コンポーネントはアドレスの最初の 2 バイトに書き込まれ、次の最上位コンポーネントはアドレスの次の 2 バイトに書き込まれます。

次の擬似コードは、 関数の操作を示しています。

static const XMVECTOR  Min = {-32767.0f, -32767.0f, -32767.0f, -32767.0f};
static const XMVECTOR  Max = {32767.0f, 32767.0f, 32767.0f, 32767.0f};
XMVECTOR               N;
N = XMVectorClamp(V, Min, Max);
N = XMVectorRound(N);

pDestination->x = (int16_t)N.x; // 2 bytes to address pDestination
pDestination->y = (int16_t)N.y; // 2 bytes to address (uint8_t*)pDestination + 2
pDestination->z = (int16_t)N.z; // 2 bytes to address (uint8_t*)pDestination + 4
pDestination->w = (int16_t)N.w; // 2 bytes to address (uint8_t*)pDestination + 6

プラットフォームの要件

Windows 8用のWindows SDKを含む Microsoft Visual Studio 2010 または Microsoft Visual Studio 2012。 Win32 デスクトップ アプリ、Windows ストア アプリ、Windows Phone 8 アプリでサポートされます。

要件

要件
対象プラットフォーム Windows
ヘッダー directxpackedvector.h (DirectXPackedVector.h を含む)

こちらもご覧ください

DirectXMath ライブラリ ベクター ストア関数