N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

   

gSPCullDisplayList

Format
#include "gbi.h"

gSPCullDisplayList(Gfx *gdl,
   unsigned int v0,
   unsigned int vn);
gsSPCullDisplayList(unsigned int v0,
   unsigned int vn);
Arguments
  • gdl is the pointer to the graphics display list
  • v0 is the index of first vertex to check
  • vn is the index of last vertex to check (must be greater than v0)
What This Macro Does
It determines whether a bounding volume intersects the viewing volume. If the bounding volume is entirely outside of the viewing volume then the remainder of the current display list is not executed.

The bounding volume is specified with up to 16 vertices. The vertices should describe a shape that completely bounds the object to be culled. Generally eight vertices should be used and should be the vertices of the object's bounding cube, although any number of vertices up to 16 may be used. These bounding vertices should be specified in a gSPVertex macro that precedes the gSPCullDisplayList macro. They may be placed anywhere in the 16-vertex buffer (see the gSPVertex macro). Use the v0 and vn parameters to indicate the indices of the first and last vertices (respectively) in the bounding volume. The vertices in the bounding volume may or may not be used in the model itself. The entire bounded model (and nothing else) should be contained in the remainder of the display list.

Note that it is important to maintain the following:

0 < = vO < vn = 15

Example
To volume cull a model where the model's bounding box is a cube that has vertices contained in the bound_vtx array (an array of 8 Vtx), use this code:

gSPVertex(glist++, bound_vtx, 8, 0);
/* load 8 vtx of index 0 */

gSPCullDisplayList(glist++, 0, 7);
/* cull by using vtx 0-7 */

/* the remainder of the display 
   list should be devoted to 
   displaying the culled model. */
Because the vertex cache has been increased, the range of v0 and vn have been changed as well. It is same range as v0 in gSPVertex. However, v0 must be less than vn.

In F3DEX(.NoN), F3DLX(.NoN), and L3DEX, processing is the same as it is in Fast3D. However, processing in F3DLP.Rej is different from Fast3D.

Note
If the bounding volume vertices are loaded only for the purpose of this test, be sure to set the RSP rendering state to turn off lighting because lighting calculations are done at vertex load time.

Except for the extra transformations of the volume vertices, implementation of this macro is essentially for free. The RSP geometry engine retains the clip codes for each vertex in the vertex buffer, this cull test is a trivial rejection of those clip codes.

This macro is NOT affected by gSPClipRatio, the clipping volume used for trivial rejection is the viewing frustum defined by the projection matrix and the viewport.

Proper use of this macro requires some planning for the database. Some data, a horizon ground plane for example, would not benefit from this test because it would nearly always be visible (it could be subdivided, however). This test is most useful for complex characters or features that are likely to move into and out of the viewing frame.

See Also
gSPVertex



Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.


Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated January 1998