Microsoft DirectX 8.1 (C++)

D3DXMatrixPerspectiveFovRH

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

D3DXMATRIX* D3DXMatrixPerspectiveFovRH(
  D3DXMATRIX* pOut,
  FLOAT fovy,
  FLOAT Aspect,
  FLOAT zn,
  FLOAT zf
); 

Parameters

pOut
[in, out] Pointer to the D3DXMATRIX structure that is the result of the operation.
fovy
[in] Field of view, in radians.
Aspect
[in] Aspect ratio.
zn
[in] Z-value of the near view-plane.
zf
[in] Z-value of the far view-plane.

Return Values

Pointer to a D3DXMATRIX structure that is a right-handed perspective projection matrix.

Remarks

The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXMatrixPerspectiveFovRH function can be used as a parameter for another function.

This function uses the following formula to compute the returned matrix.

h = cos(fov/2) / sin(fov/2);
w = h / aspect;

2*zn/w  0       0,             0
0       2*zn/h  0,             0
0       0       zf/(zn-zf)    -1
0       0       zn*zf/(zn-zf)  0

Requirements

  Header: Declared in D3dx8math.h.
  Import Library: Use D3dx8.lib.

See Also

D3DXMatrixPerspectiveRH, D3DXMatrixPerspectiveLH, D3DXMatrixPerspectiveFovLH, D3DXMatrixPerspectiveOffCenterRH, D3DXMatrixPerspectiveOffCenterLH