GXProject

Syntax

#include <revolution/gx.h>

void GXProject(
    f32          mx,
    f32          my,
    f32          mz,
    const f32    mtx[3][4],
    const f32*   p,
    const f32*   vp, 
    f32*         sx,
    f32*         sy,
    f32*         sz );

Arguments

mx, my, mz Model coordinate to be converted.
mtx Model view matrix.
p Pointer to projection matrix and its type.
vp Pointer to the viewport parameter.
sx, sy, sz Screen coordinates calculated by this function.

Return Values

None.

Description

This function projects the model coordinates ( mx, my, mz ) to screen coordinates ( sx, sy, sz ). The matrix mtx is the modelview matrix. The array p is the projection matrix parameters as returned by the GXGetProjectionv function. The array vp is the current viewport parameters as returned by the GXGetViewportv function.

The output coordinates of this function are only valid if the input coordinates are within the proper range. Specifically, mz must be between the near and far planes as defined by the projection matrix.

This function simulates the transform pipeline of the Graphics Processor.

Note: When computing sz, this function simulates only the transformation part and not any of the triangle setup or rasterization aspects of the GP. Thus if you were to render a primitive and read back the Z value for a given screen location (using the GXPeekZ function), you could not expect it to match exactly the sz value from the GXProject function for the same screen location. The Z values will only be close to matching when sx and sy match the exact raster sampling location for the pixels. We say "close" since even when sx and sy match the raster location exactly, the fixed-point computations used during rasterization may not match the floating point computation used on the CPU.

In non-antialiased mode, the sample location for the pixel (0, 0) is at (0.5, 0.5). Refer to the GXSetCopyFilter function for more details on sample locations.

See Also

MTXFrustum, MTXPerspective

Revision History

2006/03/01 Initial version.


CONFIDENTIAL