// // SAMPLE TOD ANIMATION PROGRAM // // INCLUDE FILES //--------------- #include #include #include "pad.h" #include "tod.h" /* definition for TOD functions */ #include "IDLists.h" /* TMD ID list */ #include "step3.h" #include "addrs.h" // DEFINES //------------ // PROTOS //-------- void UpdateWorld(); void RenderWorld(); long ProcessInput(); // GLOBALS //---------- u_long pad; // For controller GsRVIEW2 view; // For viewing LinkObjectStruct theModel; ////////////////////////////////////////////////////////////////////////////////// void UpdateWorld() { } void RenderWorld() { DrawObjectLink(theModel.objs); } long ProcessInput() { /* Read the pad data */ pad = PadRead(); if(((pad & PADRright) > 0) || ((pad & PADRleft) > 0) || ((pad & PADRup) > 0)) { drawTod(&theModel); } if((pad & PADRdown) > 0) { // NextFrame(&theModel); } if ((pad & PADn)>0) { theModel.obj_coord[0].coord.t[0] += 10; theModel.obj_coord[0].coord.t[1] += 10; theModel.obj_coord[0].coord.t[2] += 10; theModel.obj_coord[1].coord.t[0] += 10; theModel.obj_coord[1].coord.t[1] += 10; theModel.obj_coord[1].coord.t[2] += 10; theModel.obj_coord[2].coord.t[0] += 10; theModel.obj_coord[2].coord.t[1] += 10; theModel.obj_coord[2].coord.t[2] += 10; GsSetRefView2( &view ); } if ((pad & PADo)>0) { view.vpz -= 100; GsSetRefView2(&view); } if((pad & PADLleft)>0) { view.vpx -= 100; GsSetRefView2(&view); } if ((pad & PADLright)>0) { view.vpx += 100; GsSetRefView2(&view); } if ((pad & PADLdown)>0) { view.vpy += 100; GsSetRefView2(&view); } if ((pad & PADLup)>0) { view.vpy -= 100; GsSetRefView2(&view); } // Move the view point to the initial place if ((pad & PADh)>0) { InitialiseView(&view,1000,0,-8000,-2000,-5000,-900,-1500,0); } if ((pad & PADk)>0) { return FALSE; } return TRUE; } // Main routine //-------------- void main() { long running=TRUE; PadInit(); Initialise3DGraphics(); InitialiseView(&view,100,0,0,0,-700,0,0,0); InitialiseLights(); InitialiseModelLink(&theModel,3,0,0,0,(u_long *)BALLS_TMD); initTod(&theModel,&simple_list,(u_long *)BALL4_TOD); //Set animation to first frame ResetAnim(&theModel); printf("\nposition 0 =%d\n",theModel.ID_list[0]); printf("position 1 =%d\n",theModel.ID_list[1]); printf("position 2 =%d\n",theModel.ID_list[2]); while(running) { if(ProcessInput() == FALSE) running = FALSE; UpdateWorld(); RenderWorld(); } ResetGraph(3); }