Specifies the number of Light structures to load into the RSP
#include <ultra64.h> /* gbi.h */ gSPNumLights(Gfx *gdl, s32 n) gsSPNumLights( s32 n)
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), 1); /* Load directional lights */ gSPLight(glistp++, &(light.l), 2); gSPLight(glistp++, &(light.a), 3); /* Load ambient light */ gSPNumLights(glistp++, NUMLIGHTS_2); /* Specify the number of lights being loaded */
gdSPDefLights, gSPLight, and gSPSetLightsM
02/01/99 Completely rewritten.