D3DMXMatrixPerspectiveFovLH

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Builds a left-handed perspective projection matrix in floating point format based on a field of view.

Syntax

D3DMXMATRIX* WINAPI D3DMXMatrixPerspectiveFovLH(
  D3DMXMATRIX* pOut,
  FLOAT        fovy,
  FLOAT        Aspect,
  FLOAT        zn,
  FLOAT        zf
);

Parameters

  • pOut
    [in, out] Pointer to the D3DMXMATRIX structure that is the result of the operation.
  • fovY
    [in] Field of view, in the y direction, in radians.
  • Aspect
    [in] Aspect ratio, defined as view space width divided by height.
  • zn
    [in] Z-value of the near view-plane.
  • zf
    [in] Z-value of the far view-plane.

Return Value

Pointer to a D3DMXMATRIX structure that is a left-handed perspective projection matrix.

Remarks

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

This function computes the returned matrix as shown.

xScale  0       0               0
0       yScale  0               0
0       0       zf/(zf-zn)      1
0       0       -zn*zf/(zf-zn)  0

These variables are calculated from the following formulas.

yScale = cot(fovY/2)
xScale = yScale / Aspect.

Requirements

Header d3dmx.h
Library D3dmx.lib
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also

Reference

D3DMX Functions
D3DMXMATRIX
D3DMXMatrixPerspectiveFovLHFxd