1 /*---------------------------------------------------------------------------*
2   Project:  Dolphin/Revolution gx demo
3   File:     lit-alpha.c
4 
5   Copyright 1998-2006 Nintendo.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 /*---------------------------------------------------------------------------*
14    lit-alpha
15      One RGB light and one alpha light test
16  *---------------------------------------------------------------------------*/
17 
18 
19 /*---------------------------------------------------------------------------*
20    Header files
21  *---------------------------------------------------------------------------*/
22 #include <demo.h>
23 #include <math.h>
24 
25 /*---------------------------------------------------------------------------*
26    Macro definitions
27  *---------------------------------------------------------------------------*/
28 #define PI             3.14159265358979323846F
29 #define NUM_LIGHTS     4
30 #define NUM_COLORMODES 3
31 
32 #define Clamp(val,min,max) \
33     ((val) = (((val) < (min)) ? (min) : ((val) > (max)) ? (max) : (val)))
34 
35 /*---------------------------------------------------------------------------*
36   Structure Definitions
37  *---------------------------------------------------------------------------*/
38 // for camera
39 typedef struct
40 {
41     Vec    location;
42     Vec    up;
43     Vec    target;
44     f32    left;
45     f32    top;
46     f32    znear;
47     f32    zfar;
48 } CameraConfig;
49 
50 typedef struct
51 {
52     CameraConfig  cfg;
53     Mtx           view;
54     Mtx44         proj;
55 } MyCameraObj;
56 
57 // for lighting
58 typedef struct
59 {
60     GXLightObj  lobj;
61     s32         theta;
62     s32         phi;
63     u32         color;
64 } MyLightObj;
65 
66 // for entire scene control
67 typedef struct
68 {
69     MyCameraObj cam;
70     MyLightObj  lightCtrl[NUM_LIGHTS];
71     u32         modelType;
72     Mtx         modelCtrl;
73     u32         current;
74     u32         colorMode;
75     s32         axesFlag;
76 } MySceneCtrlObj;
77 
78 /*---------------------------------------------------------------------------*
79    Forward references
80  *---------------------------------------------------------------------------*/
81 void        main            ( void );
82 static void DrawInit        ( MySceneCtrlObj* sc );
83 static void DrawTick        ( MySceneCtrlObj* sc );
84 static void AnimTick        ( MySceneCtrlObj* sc );
85 static void DrawModel       ( u32 model );
86 static void DrawAxes        ( void );
87 static void DrawLightMark   ( u8 col );
88 static void SetCamera       ( MyCameraObj* cam );
89 static void SetLight        ( MyLightObj* lightCtrl, Mtx v );
90 static void DisableLight    ( void );
91 static void SetColorMode    ( u32 mode );
92 static void PrintIntro      ( void );
93 
94 /*---------------------------------------------------------------------------*
95   Model & Lighting Data
96  *---------------------------------------------------------------------------*/
97 #define REG_AMBIENT0   MyColors[4]
98 #define REG_MATERIAL0  MyColors[5]
99 #define REG_AMBIENT1   MyColors[6]
100 #define REG_MATERIAL1  MyColors[7]
101 
102 static GXColor MyColors[] ATTRIBUTE_ALIGN(32) =
103 {
104     {0xff, 0xff, 0xff, 0x00},  // color light 0
105     {0x00, 0x00, 0x00, 0xff},  // alpha light 0
106     {0xff, 0x80, 0x80, 0x00},  // color light 1
107     {0x00, 0x00, 0x00, 0xff},  // alpha light 1
108     {0x20, 0x20, 0x20, 0x00},  // ambient for channel 0
109     {0x60, 0xc0, 0xc0, 0xc0},  // material for channel 0
110     {0x00, 0x00, 0xe0, 0x20},  // ambient for channel 1
111     {0xff, 0xff, 0xff, 0xff}   // material for channel 1
112 };
113 
114 #define SPHERE      0
115 #define CYLINDER    1
116 #define ICOSA       2
117 #define DODECA      3
118 #define OCTA        4
119 #define CUBE        5
120 
121 #define MODELS      6
122 
123 /*---------------------------------------------------------------------------*
124    Strings for messages
125  *---------------------------------------------------------------------------*/
126 static char* LightNameMsg[NUM_LIGHTS+1] =
127 {
128     "Color Light on channel 0",
129     "Alpha Light on channel 0",
130     "Color Light on channel 1",
131     "Alpha Light on channel 1",
132     "Model"
133 };
134 
135 static char* ColorModeMsg[NUM_COLORMODES] =
136 {
137     "GX_COLOR0A0 only",
138     "GX_COLOR1A1 only",
139     "GX_COLOR0A0 and GX_COLOR1A1"
140 };
141 
142 /*---------------------------------------------------------------------------*
143    Camera configuration
144  *---------------------------------------------------------------------------*/
145 static CameraConfig DefaultCamera =
146 {
147     { 0.0F, 0.0F, 900.0F }, // location
148     { 0.0F, 1.0F,   0.0F }, // up
149     { 0.0F, 0.0F,   0.0F }, // target
150     -320.0F, // left
151     240.0F,  // top
152     400.0F,  // near
153     2000.0F  // far
154 };
155 
156 /*---------------------------------------------------------------------------*
157    Global variables
158  *---------------------------------------------------------------------------*/
159 static MySceneCtrlObj   SceneCtrl;    // scene control parameters
160 
161 /*---------------------------------------------------------------------------*
162    Application main loop
163  *---------------------------------------------------------------------------*/
main(void)164 void main ( void )
165 {
166     DEMOInit(NULL);
167 
168     DrawInit(&SceneCtrl);       // Initialize vertex formats, scene and etc.
169 
170     PrintIntro();  // Print demo directions
171 
172     while(!(DEMOPadGetButton(0) & PAD_BUTTON_MENU))
173     {
174         DEMOBeforeRender();
175         DrawTick(&SceneCtrl);   // Draw the model.
176         DEMODoneRender();
177         DEMOPadRead();          // Update controller status
178         AnimTick(&SceneCtrl);   // Update animation.
179     }
180 
181     OSHalt("End of demo");
182 }
183 
184 /*---------------------------------------------------------------------------*
185    Functions
186  *---------------------------------------------------------------------------*/
187 /*---------------------------------------------------------------------------*
188     Name:           DrawInit
189 
190     Description:    Initializes the vertex attribute format, and sets
191                     the array pointers and strides for the indexed data.
192                     This function also sets up default scene parameters.
193 
194     Arguments:      sc : pointer to the structure of scene control parameters
195 
196     Returns:        none
197  *---------------------------------------------------------------------------*/
DrawInit(MySceneCtrlObj * sc)198 static void DrawInit( MySceneCtrlObj* sc )
199 {
200     u32 i;
201 
202     // set up a vertex attribute
203     GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
204     GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_F32, 0);
205     GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
206 
207     // set tev to use vertex color
208     GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
209 
210 
211     // Default scene parameter settings
212 
213     // camera
214     sc->cam.cfg = DefaultCamera;
215     SetCamera(&sc->cam);   // never changes in this test
216 
217     // light parameters
218     for ( i = 0 ; i < NUM_LIGHTS ; ++i )
219     {
220         sc->lightCtrl[i].theta  = 0;
221         sc->lightCtrl[i].phi    = 0;
222         sc->lightCtrl[i].color  = i;
223     }
224 
225     // color channel to be displayed
226     sc->colorMode = 0;
227 
228     // model type and current control number
229     sc->modelType = 0;
230     sc->current   = 0;
231     sc->axesFlag  = 0;
232 
233     // model control matrix
234     MTXScale(sc->modelCtrl, 160.0F, 160.0F, 160.0F);
235 }
236 
237 /*---------------------------------------------------------------------------*
238     Name:           DrawTick
239 
240     Description:    Draws the model by using given scene parameters
241 
242     Arguments:      sc : pointer to the structure of scene control parameters
243 
244     Returns:        none
245  *---------------------------------------------------------------------------*/
DrawTick(MySceneCtrlObj * sc)246 static void DrawTick( MySceneCtrlObj* sc )
247 {
248     Mtx  mr;  // Rotate matrix.
249     Mtx  mv;  // Modelview matrix.
250     Mtx  mvi; // Modelview matrix.
251 
252     // disable lights and blend mode
253     DisableLight();
254     GXSetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ZERO, GX_LO_COPY);
255 
256     // set tev to use color channel 0
257     GXSetNumTexGens(0);
258     GXSetNumTevStages(1);
259     GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
260     GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
261 
262     // Draw light direction
263     if ( sc->current < NUM_LIGHTS )
264     {
265         u8  col;
266 
267         MTXRotDeg(mr, 'y', sc->lightCtrl[sc->current].theta);
268         MTXConcat(sc->cam.view, mr, mv);
269         MTXRotDeg(mr, 'x', - sc->lightCtrl[sc->current].phi);
270         MTXConcat(mv, mr, mv);
271         GXLoadPosMtxImm(mv, GX_PNMTX0);
272 
273         col = (u8)(( sc->current % 2 == 0 ) ? 255 : 128);
274         DrawLightMark(col);
275     }
276 
277     // model view matrix
278     MTXConcat(sc->cam.view, sc->modelCtrl, mv);
279     GXLoadPosMtxImm(mv, GX_PNMTX0);
280     MTXInverse(mv, mvi);
281     MTXTranspose(mvi, mv);
282     GXLoadNrmMtxImm(mv, GX_PNMTX0);
283 
284     // Axes are drawn if the flag is set.
285     if ( sc->axesFlag )
286     {
287         DrawAxes();
288     }
289 
290     // set lights and choose a color channel to be displayed
291     SetLight(sc->lightCtrl, sc->cam.view);
292     SetColorMode(sc->colorMode);
293 
294     // draw a model ( opaque one )
295     DrawModel(sc->modelType);
296 
297     // enable alpha blend mode
298     GXSetBlendMode(GX_BM_BLEND, GX_BL_INVSRCALPHA, GX_BL_SRCALPHA, GX_LO_NOOP);
299 
300     // model view matrix for another scale
301     MTXConcat(sc->cam.view, sc->modelCtrl, mv);
302     MTXScale(mr, 1.5F, 1.5F, 1.5F);
303     MTXConcat(mv, mr, mv);
304     GXLoadPosMtxImm(mv, GX_PNMTX0);
305 
306     // draw a model ( transparent one )
307     DrawModel(sc->modelType);
308 
309 }
310 
311 /*---------------------------------------------------------------------------*
312     Name:           AnimTick
313 
314     Description:    Changes scene parameters according to the pad status.
315 
316     Arguments:      sc : pointer to the structure of scene control parameters
317 
318     Returns:        none
319  *---------------------------------------------------------------------------*/
AnimTick(MySceneCtrlObj * sc)320 static void AnimTick( MySceneCtrlObj* sc )
321 {
322     Mtx  mrx, mry;
323     s32  sx, sy;
324     u32  cur = sc->current;
325     u16  down = DEMOPadGetButtonDown(0);
326 
327     // Model Rotation Calculation
328     sx =   DEMOPadGetSubStickX(0) / 24;
329     sy = - DEMOPadGetSubStickY(0) / 24;
330     MTXRotDeg(mry, 'x', sy);
331     MTXRotDeg(mrx, 'y', sx);
332     MTXConcat(mry, sc->modelCtrl, sc->modelCtrl);
333     MTXConcat(mrx, sc->modelCtrl, sc->modelCtrl);
334 
335     // Axes display mode on/off
336     sc->axesFlag = ( sx == 0 && sy == 0 ) ? 0 : 1;
337 
338 
339     // Light Position Calculation
340     sc->lightCtrl[cur].theta += ( DEMOPadGetStickX(0) / 24 );
341     sc->lightCtrl[cur].theta = sc->lightCtrl[cur].theta % 360;
342 
343     sc->lightCtrl[cur].phi += ( DEMOPadGetStickY(0) / 24 );
344     Clamp(sc->lightCtrl[cur].phi, -90, 90);
345 
346 
347     // Model Change
348     if ( down & PAD_BUTTON_A )
349     {
350         sc->modelType = ( sc->modelType + 1 ) % MODELS;
351     }
352 
353     // Select Color Channel to be displayed
354     if ( down & PAD_BUTTON_B )
355     {
356         sc->colorMode = ( sc->colorMode + 1 ) % NUM_COLORMODES;
357         OSReport("Displayed: %s\n", ColorModeMsg[sc->colorMode]);
358     }
359 
360     // Light Select
361     if ( down & PAD_TRIGGER_R )
362     {
363         sc->current = ( sc->current + 1 ) % NUM_LIGHTS;
364         OSReport("%s\n", LightNameMsg[sc->current]);
365     }
366     if ( down & PAD_TRIGGER_L )
367     {
368         sc->current = ( sc->current + NUM_LIGHTS - 1 ) % NUM_LIGHTS;
369         OSReport("%s\n", LightNameMsg[sc->current]);
370     }
371 }
372 
373 /*---------------------------------------------------------------------------*
374     Name:           DrawModel
375 
376     Description:    Draws the specified model
377 
378     Arguments:      model : specifies which model is to be displayed
379 
380     Returns:        none
381  *---------------------------------------------------------------------------*/
DrawModel(u32 model)382 static void DrawModel( u32 model )
383 {
384     // sets up vertex descriptors
385     GXClearVtxDesc();
386     GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
387     GXSetVtxDesc(GX_VA_NRM, GX_DIRECT);
388 
389     switch(model)
390     {
391         case CYLINDER :
392             GXDrawCylinder(32);
393             break;
394         case SPHERE :
395             GXDrawSphere(12, 24);
396             break;
397         case CUBE :
398             GXDrawCube();
399             break;
400         case OCTA :
401             GXDrawOctahedron();
402             break;
403         case ICOSA :
404             GXDrawIcosahedron();
405             break;
406         case DODECA :
407             GXDrawDodeca();
408             break;
409     }
410 }
411 
412 /*---------------------------------------------------------------------------*
413     Name:           DrawAxes
414 
415     Description:    Draws xyz-axes which shows model's direction
416 
417     Arguments:      none
418 
419     Returns:        none
420  *---------------------------------------------------------------------------*/
DrawAxes(void)421 static void DrawAxes( void )
422 {
423     // sets up vertex descriptors
424     GXClearVtxDesc();
425     GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
426     GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
427 
428     GXBegin(GX_LINES, GX_VTXFMT0, 6);
429         GXPosition3f32(0.0F, 0.0F, -1000.0F);
430         GXColor4u8(96, 96, 96, 255);
431         GXPosition3f32(0.0F, 0.0F, 1000.0F);
432         GXColor4u8(96, 96, 96, 255);
433 
434         GXPosition3f32(0.0F, -1000.0F, 0.0F);
435         GXColor4u8(96, 96, 96, 255);
436         GXPosition3f32(0.0F, 1000.0F, 0.0F);
437         GXColor4u8(96, 96, 96, 255);
438 
439         GXPosition3f32(-1000.0F, 0.0F, 0.0F);
440         GXColor4u8(96, 96, 96, 255);
441         GXPosition3f32(1000.0F, 0.0F, 0.0F);
442         GXColor4u8(96, 96, 96, 255);
443     GXEnd();
444 }
445 
446 /*---------------------------------------------------------------------------*
447     Name:           DrawLightMark
448 
449     Description:    Draws a mark which shows position of the light.
450 
451     Arguments:      col : intensity parameter of the mark
452 
453     Returns:        none
454  *---------------------------------------------------------------------------*/
DrawLightMark(u8 col)455 static void DrawLightMark( u8 col )
456 {
457     // sets up vertex descriptors
458     GXClearVtxDesc();
459     GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
460     GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
461 
462     GXBegin(GX_LINES, GX_VTXFMT0, 8);
463         GXPosition3f32(500.0F, 500.0F, -500.0F);
464         GXColor4u8(col, col, 255, 255);
465         GXPosition3f32(0.0F, 0.0F, 500.0F);
466         GXColor4u8(col, col, 255, 255);
467 
468         GXPosition3f32(500.0F, -500.0F, -500.0F);
469         GXColor4u8(col, col, 255, 255);
470         GXPosition3f32(0.0F, 0.0F, 500.0F);
471         GXColor4u8(col, col, 255, 255);
472 
473         GXPosition3f32(-500.0F, 500.0F, -500.0F);
474         GXColor4u8(col, col, 255, 255);
475         GXPosition3f32(0.0F, 0.0F, 500.0F);
476         GXColor4u8(col, col, 255, 255);
477 
478         GXPosition3f32(-500.0F, -500.0F, -500.0F);
479         GXColor4u8(col, col, 255, 255);
480         GXPosition3f32(0.0F, 0.0F, 500.0F);
481         GXColor4u8(col, col, 255, 255);
482     GXEnd();
483 }
484 
485 /*---------------------------------------------------------------------------*
486     Name:           SetCamera
487 
488     Description:    sets view matrix and loads projection matrix into hardware
489 
490     Arguments:      cam : pointer to the MyCameraObj structure
491 
492     Returns:        none
493  *---------------------------------------------------------------------------*/
SetCamera(MyCameraObj * cam)494 static void SetCamera( MyCameraObj* cam )
495 {
496     MTXLookAt(
497         cam->view,
498         &cam->cfg.location,
499         &cam->cfg.up,
500         &cam->cfg.target );
501 
502     MTXFrustum(
503         cam->proj,
504         cam->cfg.top,
505         - (cam->cfg.top),
506         cam->cfg.left,
507         - (cam->cfg.left),
508         cam->cfg.znear,
509         cam->cfg.zfar );
510     GXSetProjection(cam->proj, GX_PERSPECTIVE);
511 }
512 
513 /*---------------------------------------------------------------------------*
514     Name:           SetLight
515 
516     Description:    Sets up light & channel parameters.
517 
518     Arguments:      lightCtrl : pointer to array of MyLightObj structure.
519                     view : view matrix.
520 
521     Returns:        none
522  *---------------------------------------------------------------------------*/
SetLight(MyLightObj * lightCtrl,Mtx view)523 void SetLight( MyLightObj* lightCtrl, Mtx view )
524 {
525     f32 theta, phi;
526     Vec lpos;
527     u32 i;
528 
529     for ( i = 0 ; i < NUM_LIGHTS ; ++i )
530     {
531         // Light Position
532         theta = (f32)lightCtrl[i].theta * PI / 180.0F;
533         phi   = (f32)lightCtrl[i].phi   * PI / 180.0F;
534         lpos.x = 500.0F * cosf(phi) * sinf(theta);
535         lpos.y = 500.0F * sinf(phi);
536         lpos.z = 500.0F * cosf(phi) * cosf(theta);
537 
538         // convert light position into view space
539         MTXMultVec(view, &lpos, &lpos);
540 
541         GXInitLightPos(&lightCtrl[i].lobj, lpos.x, lpos.y, lpos.z);
542         GXInitLightColor(&lightCtrl[i].lobj, MyColors[lightCtrl[i].color]);
543     }
544 
545     // load each light into hardware
546     GXLoadLightObjImm(&lightCtrl[0].lobj, GX_LIGHT0);
547     GXLoadLightObjImm(&lightCtrl[1].lobj, GX_LIGHT1);
548     GXLoadLightObjImm(&lightCtrl[2].lobj, GX_LIGHT2);
549     GXLoadLightObjImm(&lightCtrl[3].lobj, GX_LIGHT3);
550 
551     // this test uses two color channels
552     GXSetNumChans(2);
553 
554     // light channel setting
555     GXSetChanCtrl(
556         GX_COLOR0,
557         GX_ENABLE,   // enable channel
558         GX_SRC_REG,  // amb source
559         GX_SRC_REG,  // mat source
560         GX_LIGHT0,   // light mask
561         GX_DF_CLAMP, // diffuse function
562         GX_AF_NONE);
563     GXSetChanCtrl(
564         GX_ALPHA0,
565         GX_ENABLE,   // enable channel
566         GX_SRC_REG,  // amb source
567         GX_SRC_REG,  // mat source
568         GX_LIGHT1,   // light mask
569         GX_DF_CLAMP, // diffuse function
570         GX_AF_NONE);
571     GXSetChanCtrl(
572         GX_COLOR1,
573         GX_ENABLE,   // enable channel
574         GX_SRC_REG,  // amb source
575         GX_SRC_REG,  // mat source
576         GX_LIGHT2,   // light mask
577         GX_DF_CLAMP, // diffuse function
578         GX_AF_NONE);
579     GXSetChanCtrl(
580         GX_ALPHA1,
581         GX_ENABLE,   // enable channel
582         GX_SRC_REG,  // amb source
583         GX_SRC_REG,  // mat source
584         GX_LIGHT3,   // light mask
585         GX_DF_CLAMP, // diffuse function
586         GX_AF_NONE);
587     // set up ambient color
588     GXSetChanAmbColor(GX_COLOR0A0, REG_AMBIENT0);
589     GXSetChanAmbColor(GX_COLOR1A1, REG_AMBIENT1);
590     // set up material color
591     GXSetChanMatColor(GX_COLOR0A0, REG_MATERIAL0);
592     GXSetChanMatColor(GX_COLOR1A1, REG_MATERIAL1);
593 
594     return;
595 }
596 
597 /*---------------------------------------------------------------------------*
598     Name:           DisableLight
599 
600     Description:    Disables lighting
601 
602     Arguments:      none
603 
604     Returns:        none
605  *---------------------------------------------------------------------------*/
DisableLight(void)606 static void DisableLight( void )
607 {
608     // use only one color channel to avoid wasting performance.
609     GXSetNumChans(1);
610 
611     GXSetChanCtrl(
612         GX_COLOR0A0,
613         GX_DISABLE,    // disable channel
614         GX_SRC_VTX,    // amb source
615         GX_SRC_VTX,    // mat source
616         GX_LIGHT_NULL, // light mask
617         GX_DF_NONE,    // diffuse function
618         GX_AF_NONE);
619     GXSetChanCtrl(
620         GX_COLOR1A1,
621         GX_DISABLE,    // disable channel
622         GX_SRC_VTX,    // amb source
623         GX_SRC_VTX,    // mat source
624         GX_LIGHT_NULL, // light mask
625         GX_DF_NONE,    // diffuse function
626         GX_AF_NONE);
627 }
628 
629 /*---------------------------------------------------------------------------*
630     Name:           SetColorMode
631 
632     Description:    select color channel or set blend operation of two colors
633 
634     Arguments:      mode: color mode
635 
636     Returns:        none
637  *---------------------------------------------------------------------------*/
SetColorMode(u32 mode)638 static void SetColorMode( u32 mode )
639 {
640     switch(mode)
641     {
642       case 0:
643         GXSetNumTexGens(0);
644         GXSetNumTevStages(1);
645         GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
646         GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
647         break;
648       case 1:
649         GXSetNumTexGens(0);
650         GXSetNumTevStages(1);
651         GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
652         GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR1A1);
653         break;
654       case 2:
655         GXSetNumTexGens(0);
656         GXSetNumTevStages(2);
657         GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
658         GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
659         GXSetTevOp(GX_TEVSTAGE1, GX_PASSCLR);
660         GXSetTevColorIn(GX_TEVSTAGE1,
661                         GX_CC_ZERO, GX_CC_CPREV, GX_CC_ONE, GX_CC_RASC);
662         GXSetTevAlphaIn(GX_TEVSTAGE1,
663                         GX_CA_ZERO, GX_CA_APREV, GX_CA_ONE, GX_CA_RASA);
664 
665         GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR1A1);
666         break;
667     }
668 }
669 
670 /*---------------------------------------------------------------------------*
671     Name:           PrintIntro
672 
673     Description:    Prints the directions on how to use this demo.
674 
675     Arguments:      none
676 
677     Returns:        none
678  *---------------------------------------------------------------------------*/
PrintIntro(void)679 static void PrintIntro( void )
680 {
681     OSReport("\n\n");
682     OSReport("************************************************\n");
683     OSReport("lit-alpha: one RGB light and one Alpha light\n");
684     OSReport("************************************************\n");
685     OSReport("to quit hit the start button\n");
686     OSReport("\n");
687     OSReport("Main Stick   : Move selected Light\n");
688     OSReport("Sub  Stick   : Rotate the model\n");
689     OSReport("L/R Triggers : Select a light\n");
690     OSReport("A Button     : Change the Model\n");
691     OSReport("B Button     : Select color channel to be used\n");
692     OSReport("************************************************\n");
693     OSReport("\n\n");
694 
695     OSReport("Displayed: %s\n", ColorModeMsg[0]);
696     OSReport("%s\n", LightNameMsg[0]);
697 }
698 
699 /*============================================================================*/
700