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
|
gSPLightSyntax#include <ultra64.h> /* gbi.h */ gSPLight(Gfx *gdl, Light *l, s32 n) gsSPLight(Light *l, s32 n)Arguments
Explanation
The Light structure color is obtained by mixing the material color and the light color. This optimization improves the performance of the RSP geometry engine. To change only the color of the light after the light has been set with gSPLight and used by gSPVertex, reset gSPLight, and re-execute gSPVertex. This method of changing the light color boosts performance efficiency. (The same method can be used to change the material color.) However, to change the light direction, you must not only set the light using gSPLight, but also use gSPNumLights to reset the number of lights (even if the number has not changed). For details, see Section 11.7.3 "Lighting With Ambient Light and Diffuse Light" in the N64 Programming
Note
Comment
The Light 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: Size of "dir" must not exceed 127 */ } Light_t; typedef union { Light_t l; long long int force_structure_alignment[2]; } Light;
Example
See Also
Revision History
|