Mercurial > hg > Members > kono > Cerium
diff example/cube/RenderingEngine.cpp @ 0:df32980116bd
Initial revision
author | gongo |
---|---|
date | Sat, 02 Feb 2008 19:15:39 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/cube/RenderingEngine.cpp Sat Feb 02 19:15:39 2008 +0900 @@ -0,0 +1,101 @@ +void +RenderingEngine::init(int width, int height, int bpp) +{ +} + +TaskDepend +RenderingEngine::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 +RenderingEngin::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(); +}