XMVectorSaturate 函数 (directxmath.h)

将矢量的每个组件饱和到 0.0f 到 1.0f。

语法

XMVECTOR XM_CALLCONV XMVectorSaturate(
  [in] FXMVECTOR V
) noexcept;

参数

[in] V

向量到饱和。

返回值

返回一个向量,其每个组件都是饱和的。

备注

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

XMVECTOR Result;

Result.x = min(max(V1.x, 0.0f), 1.0f);
Result.y = min(max(V1.y, 0.0f), 1.0f);
Result.z = min(max(V1.z, 0.0f), 1.0f);
Result.w = min(max(V1.w, 0.0f), 1.0f);

return Result;

平台要求

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

要求

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

请参阅

向量算术函数