annotate example/cube/RenderingEngine.cpp @ 540:c5a411c19e7e

merge
author tkaito@henri.cr.ie.u-ryukyu.ac.jp
date Wed, 21 Oct 2009 20:02:23 +0900
parents df32980116bd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
df32980116bd Initial revision
gongo
parents:
diff changeset
1 void
df32980116bd Initial revision
gongo
parents:
diff changeset
2 RenderingEngine::init(int width, int height, int bpp)
df32980116bd Initial revision
gongo
parents:
diff changeset
3 {
df32980116bd Initial revision
gongo
parents:
diff changeset
4 }
df32980116bd Initial revision
gongo
parents:
diff changeset
5
df32980116bd Initial revision
gongo
parents:
diff changeset
6 TaskDepend
df32980116bd Initial revision
gongo
parents:
diff changeset
7 RenderingEngine::update_all(SceneGraph* next, SceneGraph* now, TaskDepend wait)
df32980116bd Initial revision
gongo
parents:
diff changeset
8 {
df32980116bd Initial revision
gongo
parents:
diff changeset
9 SceneGraph *t, *nt;
df32980116bd Initial revision
gongo
parents:
diff changeset
10 t = now;
df32980116bd Initial revision
gongo
parents:
diff changeset
11 nt = next;
df32980116bd Initial revision
gongo
parents:
diff changeset
12
df32980116bd Initial revision
gongo
parents:
diff changeset
13 //glPushMatrix();
df32980116bd Initial revision
gongo
parents:
diff changeset
14 int s=0;
df32980116bd Initial revision
gongo
parents:
diff changeset
15 while(t)
df32980116bd Initial revision
gongo
parents:
diff changeset
16 {
df32980116bd Initial revision
gongo
parents:
diff changeset
17 //t->draw(stack);
df32980116bd Initial revision
gongo
parents:
diff changeset
18 t->update(t->data_pack, nt->data_pack);
df32980116bd Initial revision
gongo
parents:
diff changeset
19 if(t->child != NULL)
df32980116bd Initial revision
gongo
parents:
diff changeset
20 {
df32980116bd Initial revision
gongo
parents:
diff changeset
21 stack[s++] = t->matrix; //push
df32980116bd Initial revision
gongo
parents:
diff changeset
22 t = t->child;
df32980116bd Initial revision
gongo
parents:
diff changeset
23 }
df32980116bd Initial revision
gongo
parents:
diff changeset
24 else if(t->brother != NULL)
df32980116bd Initial revision
gongo
parents:
diff changeset
25 {
df32980116bd Initial revision
gongo
parents:
diff changeset
26 stack[--s] = NULL; //pop
df32980116bd Initial revision
gongo
parents:
diff changeset
27 stack[s++] = t->matrix; //push
df32980116bd Initial revision
gongo
parents:
diff changeset
28 t = t->brother;
df32980116bd Initial revision
gongo
parents:
diff changeset
29 }
df32980116bd Initial revision
gongo
parents:
diff changeset
30 else
df32980116bd Initial revision
gongo
parents:
diff changeset
31 {
df32980116bd Initial revision
gongo
parents:
diff changeset
32 while(t)
df32980116bd Initial revision
gongo
parents:
diff changeset
33 {
df32980116bd Initial revision
gongo
parents:
diff changeset
34 if(t->brother != NULL)
df32980116bd Initial revision
gongo
parents:
diff changeset
35 {
df32980116bd Initial revision
gongo
parents:
diff changeset
36 stack[--s] = NULL; //pop
df32980116bd Initial revision
gongo
parents:
diff changeset
37 stack[s++] = t->matrix; //push
df32980116bd Initial revision
gongo
parents:
diff changeset
38 t = t->brother;
df32980116bd Initial revision
gongo
parents:
diff changeset
39 break;
df32980116bd Initial revision
gongo
parents:
diff changeset
40 }
df32980116bd Initial revision
gongo
parents:
diff changeset
41 else
df32980116bd Initial revision
gongo
parents:
diff changeset
42 {
df32980116bd Initial revision
gongo
parents:
diff changeset
43 t = t->parent;
df32980116bd Initial revision
gongo
parents:
diff changeset
44 if(t)
df32980116bd Initial revision
gongo
parents:
diff changeset
45 {
df32980116bd Initial revision
gongo
parents:
diff changeset
46 stack[--s] = NULL; //pop
df32980116bd Initial revision
gongo
parents:
diff changeset
47 }
df32980116bd Initial revision
gongo
parents:
diff changeset
48 }
df32980116bd Initial revision
gongo
parents:
diff changeset
49 }
df32980116bd Initial revision
gongo
parents:
diff changeset
50 }
df32980116bd Initial revision
gongo
parents:
diff changeset
51 }
df32980116bd Initial revision
gongo
parents:
diff changeset
52 //glPopMatrix();
df32980116bd Initial revision
gongo
parents:
diff changeset
53 }
df32980116bd Initial revision
gongo
parents:
diff changeset
54
df32980116bd Initial revision
gongo
parents:
diff changeset
55 TaskDepend
df32980116bd Initial revision
gongo
parents:
diff changeset
56 RenderingEngin::draw_all(SceneGraph* now, TaskDepend wait)
df32980116bd Initial revision
gongo
parents:
diff changeset
57 {
df32980116bd Initial revision
gongo
parents:
diff changeset
58 Polygon *t;
df32980116bd Initial revision
gongo
parents:
diff changeset
59
df32980116bd Initial revision
gongo
parents:
diff changeset
60 t = this;
df32980116bd Initial revision
gongo
parents:
diff changeset
61
df32980116bd Initial revision
gongo
parents:
diff changeset
62 //glPushMatrix();
df32980116bd Initial revision
gongo
parents:
diff changeset
63 int s=0;
df32980116bd Initial revision
gongo
parents:
diff changeset
64 while(t)
df32980116bd Initial revision
gongo
parents:
diff changeset
65 {
df32980116bd Initial revision
gongo
parents:
diff changeset
66 t->draw(stack);
df32980116bd Initial revision
gongo
parents:
diff changeset
67 if(t->child != NULL)
df32980116bd Initial revision
gongo
parents:
diff changeset
68 {
df32980116bd Initial revision
gongo
parents:
diff changeset
69 stack[s++] = t->matrix; //push
df32980116bd Initial revision
gongo
parents:
diff changeset
70 t = t->child;
df32980116bd Initial revision
gongo
parents:
diff changeset
71 }
df32980116bd Initial revision
gongo
parents:
diff changeset
72 else if(t->brother != NULL)
df32980116bd Initial revision
gongo
parents:
diff changeset
73 {
df32980116bd Initial revision
gongo
parents:
diff changeset
74 stack[--s] = NULL; //pop
df32980116bd Initial revision
gongo
parents:
diff changeset
75 stack[s++] = t->matrix; //push
df32980116bd Initial revision
gongo
parents:
diff changeset
76 t = t->brother;
df32980116bd Initial revision
gongo
parents:
diff changeset
77 }
df32980116bd Initial revision
gongo
parents:
diff changeset
78 else
df32980116bd Initial revision
gongo
parents:
diff changeset
79 {
df32980116bd Initial revision
gongo
parents:
diff changeset
80 while(t)
df32980116bd Initial revision
gongo
parents:
diff changeset
81 {
df32980116bd Initial revision
gongo
parents:
diff changeset
82 if(t->brother != NULL)
df32980116bd Initial revision
gongo
parents:
diff changeset
83 {
df32980116bd Initial revision
gongo
parents:
diff changeset
84 stack[--s] = NULL; //pop
df32980116bd Initial revision
gongo
parents:
diff changeset
85 stack[s++] = t->matrix; //push
df32980116bd Initial revision
gongo
parents:
diff changeset
86 t = t->brother;
df32980116bd Initial revision
gongo
parents:
diff changeset
87 break;
df32980116bd Initial revision
gongo
parents:
diff changeset
88 }
df32980116bd Initial revision
gongo
parents:
diff changeset
89 else
df32980116bd Initial revision
gongo
parents:
diff changeset
90 {
df32980116bd Initial revision
gongo
parents:
diff changeset
91 t = t->parent;
df32980116bd Initial revision
gongo
parents:
diff changeset
92 if(t)
df32980116bd Initial revision
gongo
parents:
diff changeset
93 {
df32980116bd Initial revision
gongo
parents:
diff changeset
94 stack[--s] = NULL; //pop
df32980116bd Initial revision
gongo
parents:
diff changeset
95 }
df32980116bd Initial revision
gongo
parents:
diff changeset
96 }
df32980116bd Initial revision
gongo
parents:
diff changeset
97 }
df32980116bd Initial revision
gongo
parents:
diff changeset
98 }
df32980116bd Initial revision
gongo
parents:
diff changeset
99 }
df32980116bd Initial revision
gongo
parents:
diff changeset
100 //glPopMatrix();
df32980116bd Initial revision
gongo
parents:
diff changeset
101 }