XMMatrixPerspectiveFovRH

Builds a right-handed perspective projection matrix based on a field of view.

Syntax

XMMATRIX XMMatrixPerspectiveFovRH(
         float FovAngleY,
         float AspectHByW,
         float NearZ,
         float FarZ
)  

Parameters

FovAngleY
Type: float 

Top-down field-of-view angle in radians.

AspectHByW
Type: float 

Aspect ratio of view-space X:Y.

NearZ
Type: float 

Distance to the near clipping plane. Must be greater than zero.

FarZ
Type: float 

Distance to the far clipping plane. Must be greater than zero.

Return value

Type: XMMATRIX 

Returns the perspective projection matrix.

Remarks

For typical usage, NearZ < FarZ. However, if you flip these values so FarZ < NearZ, the result is an inverted z buffer which can provide increased floating-point precision. NearZ and FarZ cannot be the same value.

Requirements

Header: Declared in directxmath.h.