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

## guPosLightHilite
guPosLight

Syntax

    #include <gu.h>

    void guPosLight(PositionalLight *pl,
       Light *l,
       float xOb, float yOb, float zOb);

    void guPosLightHilite(PositionalLight *pl1,
       PositionalLight *pl2,
       Light *l1, Light *l2,
       LookAt *l, Hilite *h,
       float xEye, float yEye, float zEye,
       float xOb,  float yOb,  float zOb,
       float xUp,  float yUp,  float zUp,
       int twidth, int theight);

    typedef struct {
       float   col[3];
       float   pos[3];
       float   a1, a2;
    } PositionalLight

Arguments

- pl,pl1,pl1 describes the positional light to use (input to the function)

- l,l1,l2 describes the light structure to create (output of the function)

- xOB, yOB, zOB are the coordinates of the center of the object to be lit (in world coordinates)

- l is the pointer to the LookAt data structure (output of the function) - see the guLookAtHilite function

- h is the pointer to the Hilite data structure (output of the function) - see the guLookAtHilite function

- xEye, yEye, zEye specify the position of the eye (same as used in the guLookAt function)

- xUp, yUp, zUp specify the up vector (same as used in the guLookAt function)

- twidth, theight specify the width and height of the texture map that will be used for drawing the specular highlight

- col is the color (and intensity) of the positional light

- pos is the position of the positional light (in world coordinates)

- a1, a2 specify the attenuation. The light intensity on the object will be col/(a1*dist + a2)

Explanation
guPosLight and guPosLightHilite take a PositionalLight structure (which you define) and creates a light structure. The light direction and intensity depend on the distance and direction from the light to the object being lit. These functions are useful for creating the effect of a positional light with attenuation. It works well for lighting small objects in a scene (especially moving objects), but it does not work very well for lighting large objects such as terrains, walls, or ground planes. To use these functions with multiple moving objects, call the functions several times - once for each object. Then use the various different light structures to light each object.
The guPosLightHilite function calculates a light structure for two positional lights and their hilite and lookat value for rendering specular highlights.
The guPosLight function calculates a light structure for a single positional light without calculating specular hilite related values.
See Also
guLookAtHilite
gSPSetLights
gdSPDefLights
gSPNumLights
gSPLightColor

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