XMStoreU555 函数 (directxpackedvector.h)
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) 。
目标平台 | Windows |
标头 | directxpackedvector.h (包括 DirectXPackedVector.h) |