void F3D_MoveMem( u32 w0, u32 w1 ) { switch (_SHIFTR( w0, 16, 8 )) { case F3D_MV_VIEWPORT://G_MV_VIEWPORT: gSPViewport( w1 ); break; case G_MV_MATRIX_1: gSPForceMatrix( w1 ); // force matrix takes four commands __RSP.PC[__RSP.PCi] += 24; break; case G_MV_L0: gSPLight( w1, LIGHT_1 ); break; case G_MV_L1: gSPLight( w1, LIGHT_2 ); break; case G_MV_L2: gSPLight( w1, LIGHT_3 ); break; case G_MV_L3: gSPLight( w1, LIGHT_4 ); break; case G_MV_L4: gSPLight( w1, LIGHT_5 ); break; case G_MV_L5: gSPLight( w1, LIGHT_6 ); break; case G_MV_L6: gSPLight( w1, LIGHT_7 ); break; case G_MV_L7: gSPLight( w1, LIGHT_8 ); break; case G_MV_LOOKATX: gSPLookAt(w1, 0); break; case G_MV_LOOKATY: gSPLookAt(w1, 1); break; } }
/*----------------------------------------------------------------------------- graphic00 -----------------------------------------------------------------------------*/ void graphic_00(void) { Dynamic* dynamic_ptr; NNScTask *t; static LookAt lookat; u16 perspNorm; u32 cnt; /* specify display list buffer/task buffer */ dynamic_ptr = &gfx_dynamic[gfx_gtask_no]; glist_ptr = &gfx_glist[gfx_gtask_no][0]; t = &gfx_task[gfx_gtask_no]; /* set RSP and RDP */ gfxRCPInit(); /* clear frame buffer and Z buffer */ gfxClearCfb(); /* calculate and set projection matrix */ guPerspective(&dynamic_ptr->projection, &perspNorm, 33, 320.0/240.0, 10, 2000, 1.0); guLookAtReflect(&dynamic_ptr->viewing, &lookat, 0, 50, -600 , 0, 0, 0, 0, 1, 0); gSPPerspNormalize(glist_ptr++, perspNorm); gSPLookAt(glist_ptr++, &lookat); gSPMatrix(glist_ptr++, &(dynamic_ptr->projection), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH); gSPMatrix(glist_ptr++, &(dynamic_ptr->viewing), G_MTX_PROJECTION | G_MTX_MUL | G_MTX_NOPUSH); /* draw model */ for(cnt = 0; cnt < numControllers; cnt++){ ModelController(dynamic_ptr,&mtx_cont[cnt]); } /* end top-level display list */ gDPFullSync(glist_ptr++); gSPEndDisplayList(glist_ptr++); /* Flush the dynamic segment */ osWritebackDCacheAll(); gfxTaskStart(t, gfx_glist[gfx_gtask_no], (s32)(glist_ptr - gfx_glist[gfx_gtask_no]) * sizeof (Gfx), GFX_GSPCODE_F3DEX, NN_SC_SWAPBUFFER); }
void F3DEX2CBFD_MoveMem( u32 w0, u32 w1 ) { switch (_SHIFTR( w0, 0, 8 )) { case F3DEX2_MV_VIEWPORT: gSPViewport( w1 ); break; case G_MV_LIGHT: { const u32 offset = _SHIFTR(w0, 5, 14); const u32 n = offset / 48; if (n < 2) gSPLookAt(w1, n); else gSPLightCBFD(w1, n - 2); } break; case G_MV_NORMALES: gSPSetVertexNormaleBase(w1); break; } }