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
|
gSPSetLightsSyntax#include <ultra64.h> /* gbi.h */ gSPSetLightsM(Gfx *gdl, LightsM lites) gsSPSetLightsM(LightsM lites) Note: For M, enter the number of diffuse lights (an integer from 0 to 7).
Explanation This macro loads the LightsM structure for ambient light and diffuse lights into the light buffer. The M (an integer 0~7) at the end of the macro name indicates the number of diffuse lights to be set. Load these using one of the eight macros SPSetLights0, gSPSetLights1, gSPSetLights2, ..., gSPSetLights7. For example, to use three diffuse lights, the macro becomes gSPSetLights3 and the corresponding structure becomes Lights3. Once the lights have been set, that setting is retained until the next time this macro is used. When a new LightsM structure is loaded using this macro, the old LightsM structure is overwritten. In the LightsM structure, "a" is the ambient light structure and "l[M]" is an array of M diffuse light structures. The LightsM structure is set by defining the light parameters with gdSPDefLights. Material color and light color are mixed for each LightsM structure. For details, please see Section 11.7.3, "Lighting with Ambient Light and Diffuse Light" in the N64 Online Programming Manual. Note To change the color of several (or all) of the lights after the lights have been used one or more times, it is more efficient to use gSPLight than to use this macro. Comment The LightsM structure is shown below: typedef struct { unsigned char col[3]; /* Diffuse light value (RGBA) */ char pad1; unsigned char colc[3];/* Copy of diffuse light value (RGBA) */ char pad2; signed char dir[3]; /* Direction toward light source (normalized) */ char pad3; /* Important: the size of "dir" must not exceed 127 */ } Light_t; typedef struct { unsigned char col[3]; /* Ambient light value (RGBA) */ char pad1; unsigned char colc[3];/* Copy of ambient light value (RGBA) */ char pad2; } Ambient_t; typedef union { Light_t l; long long int force_structure_alignment[2]; } Light; typedef union { Ambient_t l; long long int force_structure_alignment[1]; } Ambient; typedef struct { Ambient a; /* Ambient light */ Light l[M]; /* Diffuse lights */ } LightsM; * For M, enter the number of diffuse lights (integer from 0 to 7).
See also
gdSPDefLights
Revision History
02/01/1999 Completely Rewritten.
|