Function
gSPBranchLessZ
Conditionally branches the display list
Syntax
#include <ultra64.h> /* gbi.h */
gSPBranchLessZ(
Gfx *gdl,
Gfx *branchdl,
u32 vtx,
f32 zval,
f32 near,
f32 far,
s32 flag)
gsSPBranchLessZ(
Gfx *branchdl,
u32 vtx,
f32 zval,
f32 near,
f32 far,
s32 flag)
Arguments
Description
Conditionally branches the display list. When the depth value of the vertex specified by vtx is less than or equal to zval, the display list is branched to the display list indicated by branchdl. When it is more than zval, nothing is done. This provides an easy way to perform LOD processing on a model.
Note
This macro assumes that the values of the two viewport Z-direction arguments vp.vscale[2] and vp.vtrans[2] (see g*SPViewport) are both G_MAXZ/2. When this is the case, the depth value is greater than 0 and less than G_MAXZ. Normally the depth value does not need to be changed in an application. However, if you are going to change this value, please use the g*SPBranchLessZrg macro.
Example
The following is an example of a model with 3-level LOD:
Gfx model_near[ ] = { // Model's distance less than or equal to 200.
..........
gsSPEndDisplayList( ),
};
Gfx model_mid[ ] = { // Model's distance between 201 and 800.
..........
gsSPEndDisplayList( ),
};
Gfx model_far[ ] = { // Model's distance between 801 and 1600.
..........
gsSPEndDisplayList( ),
};
Gfx model[ ] = {
gsSPVertex(testvtx, 1, 0),
gsSPBranchLessZ(model_near, 0, 200, 32, 2000, G_BZ_PERSP), // Model's distance less than or equal to 200.
gsSPBranchLessZ(model_mid, 0, 800, 32, 2000, G_BZ_PERSP), // Model's distance between 201 and 800.
gsSPBranchLessZ(model_far, 0, 1600, 32, 2000, G_BZ_PERSP), // Model's distance between 801 and 1600.
gsSPEndDisplayList( ), // Model's distance greater than 1600.
};
See Also
Revision History
02/01/99 Entirely revised.