Mercurial > hg > Game > Cerium
view Renderer/Simple/SimpleEngine.cpp @ 503:516d5c91d5b4 draft double-linked-task-list
comment
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 11 Oct 2009 19:35:33 +0900 |
parents | df32980116bd |
children |
line wrap: on
line source
void SimpleEngine::init(int width, int height, int bpp) { if(SDL_Init( SDL_INIT_VIDEO ) < 0) { cout << "Couldn't initialize SDL:" << SDL_GetError() << endl; exit(1); } // etc... } TaskDepend SimpleEngine::update_all(SceneGraph* next, SceneGraph* now, TaskDepend wait) { SceneGraph *t, *nt; t = now; nt = next; //glPushMatrix(); int s=0; while(t) { //t->draw(stack); t->update(t->data_pack, nt->data_pack); if(t->child != NULL) { stack[s++] = t->matrix; //push t = t->child; } else if(t->brother != NULL) { stack[--s] = NULL; //pop stack[s++] = t->matrix; //push t = t->brother; } else { while(t) { if(t->brother != NULL) { stack[--s] = NULL; //pop stack[s++] = t->matrix; //push t = t->brother; break; } else { t = t->parent; if(t) { stack[--s] = NULL; //pop } } } } } //glPopMatrix(); } TaskDepend SimpleEngin::draw_all(SceneGraph* now, TaskDepend wait) { Polygon *t; t = this; //glPushMatrix(); int s=0; while(t) { t->draw(stack); if(t->child != NULL) { stack[s++] = t->matrix; //push t = t->child; } else if(t->brother != NULL) { stack[--s] = NULL; //pop stack[s++] = t->matrix; //push t = t->brother; } else { while(t) { if(t->brother != NULL) { stack[--s] = NULL; //pop stack[s++] = t->matrix; //push t = t->brother; break; } else { t = t->parent; if(t) { stack[--s] = NULL; //pop } } } } } //glPopMatrix(); }