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

   

gSPZXfmLights

Format
gSPZXfmLights(gfx *gp, u32 mid,
   u32 lnum, u32 umem)
Arguments
  • gp is the pointer to the graphics display list
  • mid is the matrix with the 3x3 element at the upper-left of the ModelView matrix transposed
  • lnum is the number of lights to be processed
  • umem is the beginning address in user area that holds the light data
What This Macro Does
This Z-Sort microcode GBI macro performs lighting pre-processing. This macro must be called after the light data and/or ModelView matrix has been changed and by the time gSPLight is called. This macro does the necessary pre-processing so that light data can be used in light calculations by the gSPZLight and gSPZLightMaterial macros. Because light data rarely changes in one scene, this macro can be called when the ModelView matrix changes.

To execute this GBI macro, the reverse rotation matrix of the ModelView matrix is necessary. For this, the matrix with the 3x3 element at upper left of ModelView matrix transposed can usually be used. (The shading is sometimes off when scaling only certain axes, but this is not a notable problem.) Use gSPZMtxTrnsp3x3 to make the transposition.

The number in the lnum argument is basically the number of defuse lights. This does not include the ambient lights. Also, lnum cannot be set to 0 in Z-Sort microcode. To process only ambient lighting, specify one black (RGB=0, 0, 0) defuse light using a dummy.

When processing the environment map, use two so-called defuse lights. When expressing highlighting and reflection, load the environment map parameter to the light parameter area and set it (2 for the number of defuse lights) to lnum. When using only the environment map without using lights (no defuse lights), the dummy defuse light is unnecessary; specify 2 to lnum and call the macro.

For an example of this macro and for detailed information on Z-Sort microcode's GBI macros and data structures, please see the "Z-Sort Microcode" area of the N64 Programming Manual.

See Also
Z-Sort Microcode
gSPZRdpCmd
gSPZSetUMem
gSPZGetUMem
gSPZSetMtx
gSPZGetMtx
gSPZMtxCat
gSPZMtxTrnsp3x3
gSPZViewPort
gSPZMultMPMtx
gSPZSetAmbient
gSPZSetDefuse
gSPZSetLookAt
gSPZXfmLights
gSPZLight
gSPZLightMaterial
gSPZMixS16
gSPZMixS8
gSPZMixU8
gSPZSegment
gSPZSetSubDL
gSPZLinkSubDL
gSPZSendMessage
gSPZWaitSignal
gSPZSegment
gSPZPerspNormalize



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 January 1998