guPerspectiveF

guPerspectiveF [Function]

Function

guPerspective

Creates a perspective projection matrix (floating point)

Syntax

#include <ultra64.h>        /* gu.h */
void guPerspectiveF(
        float mf[4][4],
        u16 *perspNorm,
        float fovy,
        float aspect,
        float near,
        float far,
        float scale);

Arguments

mf
The resulting 4x4 projection matrix
perspNorm
Pointer to the resulting numerical value
fovy
The angle of view in the vertical (y) direction (0.0 ~ 180.0 degrees)
aspect
The aspect ratio (width/height) setting the view in the horizontal (x) direction
near
Distance from viewpoint to near clipping plane
far
Distance from viewpoint to far clipping plane
scale
Scale for matrix elements
* Can be used to set the significant number of digits for RSP fixed-point computations.

Returned value

None.

Description

Returns a perspective projection matrix to mf, and returns a numerical value to perspNorm for use by gSPPerspNormalize. When this function is called, the result is the creation of the following kind of projection matrix:

Both near and far must be positive values. This function specifies the viewable region of the perspective transformation (the viewing volume), which is shaped like a square-based pyramid with its top cut off. With this function, the pyramid has bilateral symmetry, whereas with guFrustumF you can define a pyramid that does not have bilateral symmetry. Fixed point is handled with the guPerspective function.

See also

gSPPerspNormalize, guFrustum, guFrustumF, guOrtho, guOrthoF, and guPerspective

Revision history

03/01/99 Completely rewritten.