gSPNumLights [macro]
Specifies the number of Light structures to load into the RSP.
Syntax
#include <ultra64.h> /* gbi.h */
gSPNumLights(Gfx *gdl, s32 n)
gsSPNumLights(s32 n)
Arguments
- gdl is the pointer to the graphics display list.
- n is 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)
Explanation
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.
Notes
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).
Cautions
For static light, it is more efficient to use to use gdSPDefLights together with gSPSetLightsMx, rather than using gSPLight and gSPNumLights.
Example
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
gSPSetLightsM