Mercurial > hg > Members > kono > Cerium
comparison example/cube/RenderingEngine.cpp @ 0:df32980116bd
Initial revision
author | gongo |
---|---|
date | Sat, 02 Feb 2008 19:15:39 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:df32980116bd |
---|---|
1 void | |
2 RenderingEngine::init(int width, int height, int bpp) | |
3 { | |
4 } | |
5 | |
6 TaskDepend | |
7 RenderingEngine::update_all(SceneGraph* next, SceneGraph* now, TaskDepend wait) | |
8 { | |
9 SceneGraph *t, *nt; | |
10 t = now; | |
11 nt = next; | |
12 | |
13 //glPushMatrix(); | |
14 int s=0; | |
15 while(t) | |
16 { | |
17 //t->draw(stack); | |
18 t->update(t->data_pack, nt->data_pack); | |
19 if(t->child != NULL) | |
20 { | |
21 stack[s++] = t->matrix; //push | |
22 t = t->child; | |
23 } | |
24 else if(t->brother != NULL) | |
25 { | |
26 stack[--s] = NULL; //pop | |
27 stack[s++] = t->matrix; //push | |
28 t = t->brother; | |
29 } | |
30 else | |
31 { | |
32 while(t) | |
33 { | |
34 if(t->brother != NULL) | |
35 { | |
36 stack[--s] = NULL; //pop | |
37 stack[s++] = t->matrix; //push | |
38 t = t->brother; | |
39 break; | |
40 } | |
41 else | |
42 { | |
43 t = t->parent; | |
44 if(t) | |
45 { | |
46 stack[--s] = NULL; //pop | |
47 } | |
48 } | |
49 } | |
50 } | |
51 } | |
52 //glPopMatrix(); | |
53 } | |
54 | |
55 TaskDepend | |
56 RenderingEngin::draw_all(SceneGraph* now, TaskDepend wait) | |
57 { | |
58 Polygon *t; | |
59 | |
60 t = this; | |
61 | |
62 //glPushMatrix(); | |
63 int s=0; | |
64 while(t) | |
65 { | |
66 t->draw(stack); | |
67 if(t->child != NULL) | |
68 { | |
69 stack[s++] = t->matrix; //push | |
70 t = t->child; | |
71 } | |
72 else if(t->brother != NULL) | |
73 { | |
74 stack[--s] = NULL; //pop | |
75 stack[s++] = t->matrix; //push | |
76 t = t->brother; | |
77 } | |
78 else | |
79 { | |
80 while(t) | |
81 { | |
82 if(t->brother != NULL) | |
83 { | |
84 stack[--s] = NULL; //pop | |
85 stack[s++] = t->matrix; //push | |
86 t = t->brother; | |
87 break; | |
88 } | |
89 else | |
90 { | |
91 t = t->parent; | |
92 if(t) | |
93 { | |
94 stack[--s] = NULL; //pop | |
95 } | |
96 } | |
97 } | |
98 } | |
99 } | |
100 //glPopMatrix(); | |
101 } |