gSPNumLights [Macro]



Specifies the number of Light structures to load into the RSP


#include <ultra64.h>        /* gbi.h */
gSPNumLights(Gfx *gdl, s32 n)
gsSPNumLights(         s32 n)


the pointer to the display list.
the number of diffuse lights to use for lighting at one time:
NUMLIGHTS_0 (0 diffuse lights)
NUMLIGHTS_1 (1 diffuse light)
NUMLIGHTS_2 (2 diffuse lights)
NUMLIGHTS_7 (7 diffuse lights)


Specifies the number of lights used in lighting calculations. This macro is used in association with gSPLight, which loads the light that will be actually used. When this macro specifies N number of lights, the 1st to Nth lights are used as directional lights (color and direction), and Nth+1 light is used as the ambient light (color only). To use only ambient light, set the "n" argument to NUMLIGHTS_0 so the first light is set to the ambient light color.


When the lighting state has been altered with gSPLight, you must use the gSPNumLights macro to tell the RSP that Light has been modified (even if the number of lights has not been changed).

For static light, it is more efficient to use gdSPDefLights together with gSPSetLightsM, rather than using gSPLight and gSPNumLights.


gSPNumLights indicates the number of structures loaded with gSPLight.

gSPLight(glistp++, &(light.l[0]), 1);  /* Load directional lights */
gSPLight(glistp++, &(light.l[1]), 2);
gSPLight(glistp++, &(light.a), 3);     /* Load ambient light */
gSPNumLights(glistp++, NUMLIGHTS_2); /* Specify the number of lights being loaded */

See Also

gdSPDefLights, gSPLight, and gSPSetLightsM

Revision History

02/01/99 Completely rewritten.