XMMatrixPerspectiveFovLH 函式 (directxmath.h)

根據視野範圍建置左手透視投影矩陣。

語法

XMMATRIX XM_CALLCONV XMMatrixPerspectiveFovLH(
  [in] float FovAngleY,
  [in] float AspectRatio,
  [in] float NearZ,
  [in] float FarZ
) noexcept;

參數

[in] FovAngleY

以弧度為單位的由上而下檢視角度。

[in] AspectRatio

檢視空間 X:Y 的外觀比例。

[in] NearZ

接近裁剪平面的距離。 必須大於零。

[in] FarZ

距離到遠裁剪平面。 必須大於零。

傳回值

傳回透視投影矩陣。

備註

針對一般使用方式, NearZ 小於 FarZ。 不過,如果您將這些值翻轉到 FarZ 小於 NearZ,則結果是反轉的 z 緩衝區 (也稱為「反向 z 緩衝區」) ,以提供增加的浮點精確度。

NearZFarZ 不能是相同的值,而且必須大於 0。

默認的 AspectRatio 軸是水平軸,但使用 AspectRatio 重新計算 FovAngleY 會控制檢視縮放方向:2.0 * atan (tan (FovAngleY * 0.5) / AspectRatio) 。

平臺需求

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

規格需求

需求
目標平台 Windows
標頭 directxmath.h

另請參閱

DirectXMath 連結庫矩陣函式

XMMatrixPerspectiveFovRH