XMMatrixPerspectiveOffCenterRH

Builds a custom version of a right-handed perspective projection matrix.

Syntax

XMMATRIX XMMatrixPerspectiveOffCenterRH(
         float ViewLeft,
         float ViewRight,
         float ViewBottom,
         float ViewTop,
         float NearZ,
         float FarZ
)  

Parameters

ViewLeft
Type: float 

The x-coordinate of the left side of the clipping frustum at the near clipping plane.

ViewRight
Type: float 

The x-coordinate of the right side of the clipping frustum at the near clipping plane.

ViewBottom
Type: float 

The y-coordinate of the bottom side of the clipping frustum at the near clipping plane.

ViewTop
Type: float 

The y-coordinate of the top side of the clipping frustum at the near clipping plane.

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 custom 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.