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

## 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 gSPSetLights Mx, 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
gSPSetLights M

Revision History
2/1/1999 Completely rewritten

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-1999
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1999