guPerspective

guPerspective [Function]

Function

guPerspective

Creates a perspective projection matrix (fixed point)

Syntax

#include <ultra64.h>        /* gu.h */
void guPerspective(
        Mtx *m,
        u16 *perspNorm,
        float fovy,
        float aspect,
        float near,
        float far,
        float scale);

Arguments

m
Pointer to the resulting 4x4 projection matrix
perspNorm
Pointer to the resulting numerical value
fovy
The angle of view in the vertical (y) direction (0 ~ 180 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 the structure indicated by m, 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 guFrustum you can define a pyramid that does not have bilateral symmetry. For details about the fixed-point format, see gSPMatrix. Floating point is handled with the guPerspectiveF function.

Note

The Mtx structure looks like this:

typedef long  Mtx_t[4][4];
typedef union {
     Mtx_t          m;
     long long int  force_structure_alignment;
} Mtx;

See Also

gSPMatrix, gSPPerspNormalize, guFrustum, guFrustumF, guOrtho, guOrthoF, and guPerspectiveF

Revision History

03/01/99 Completely rewritten.