annotate Renderer/test_render/vacuum.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 15bfacccde99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
1 #include <math.h>
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
2 #include "SceneGraphRoot.h"
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
3 #include "SGList.h"
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
4
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
5 static void cube_move_left(SceneGraphPtr node, int screen_w, int screen_h);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
6 static void cube_move_right(SceneGraphPtr node, int screen_w, int screen_h);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
7 static void cube_move_idle(SceneGraphPtr node, int screen_w, int screen_h);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
8 static void cube_collision(SceneGraphPtr node, int screen_w, int screen_h,
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
9 SceneGraphPtr tree);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
10 static void cube_split(SceneGraphPtr root);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
11
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
12 static void vacuum_move(SceneGraphPtr node, int w, int h);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
13 //static void vacuum_coll(SceneGraphPtr node, int w, int h);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
14
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
15 static float vacuum_speed = 3.0f;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
16
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
17 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
18 cube_move_left(SceneGraphPtr node, int screen_w, int screen_h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
19 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20 node->xyz[0] -= node->stack_xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
21 #if 0
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
22 node->xyz[1] -= node->stack_xyz[0] * node->stack_xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
23 node->xyz[2] -= node->stack_xyz[0] * node->stack_xyz[2];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
24 #else
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
25 node->xyz[1] += node->stack_xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
26 //node->xyz[2] -= node->stack_xyz[2];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
27 #endif
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
28
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
29 if (node->xyz[0] < 0) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
30 node->set_move_collision(cube_move_right, cube_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
31 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
32
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
33 if (node->xyz[1] < 0 || node->xyz[1] > screen_h) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
34 node->stack_xyz[1] = -node->stack_xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
35 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
36
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
37 //node->angle[0] += 2.0f;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
38 //node->angle[1] += 2.0f * node->stack_xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
39 //node->angle[2] += 2.0f * node->stack_xyz[2];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
40
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
41 if (++node->frame > 60) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
42 cube_split(node);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
43 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
44 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
45
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
46 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
47 cube_move_right(SceneGraphPtr node, int screen_w, int screen_h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
48 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
49 node->xyz[0] += node->stack_xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
50 #if 0
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
51 node->xyz[1] -= node->stack_xyz[0] * node->stack_xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
52 node->xyz[2] -= node->stack_xyz[0] * node->stack_xyz[2];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
53 #else
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
54 node->xyz[1] += node->stack_xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
55 #endif
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
56
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
57 if (node->xyz[0] > screen_w) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
58 node->set_move_collision(cube_move_left, cube_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
59 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
60
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
61 if (node->xyz[1] < 0 || node->xyz[1] > screen_h) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
62 node->stack_xyz[1] = -node->stack_xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
63 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
64
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
65 //node->angle[0] += 2.0f;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
66 //node->angle[1] += 2.0f * node->stack_xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
67 //node->angle[2] += 2.0f * node->stack_xyz[2];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
68
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
69 if (++node->frame > 60) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
70 cube_split(node);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
71 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
72 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
73
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
74 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
75 cube_split(SceneGraphPtr root)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
76 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
77 SceneGraphPtr p = root->clone();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
78 root->addBrother(p);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
79
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
80 root->set_move_collision(cube_move_left, cube_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
81 p->set_move_collision(cube_move_right, cube_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
82
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
83 root->frame = 0;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
84 p->frame = 0;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
85
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
86 p->xyz[0] = root->xyz[0] + 2;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
87 p->xyz[1] = root->xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
88 p->xyz[2] = root->xyz[2];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
89
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
90 p->stack_xyz[0] = 2.0f;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
91 p->stack_xyz[1] = random()%3-1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
92 p->stack_xyz[2] = random()%3-1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
93
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
94 root->xyz[0] -= 2;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
95 root->stack_xyz[0] = 2.0f;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
96 root->stack_xyz[1] = random()%3-1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
97 root->stack_xyz[2] = 0.0f;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
98 //root->stack_xyz[2] = random()%3-1;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
99 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
100
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
101
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
102 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
103 cube_move_idle(SceneGraphPtr node, int screen_w, int screen_h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
104 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
105 Pad *pad = sgroot->getController();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
106
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
107 if (pad->circle.isPush()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
108 cube_split(node);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
109 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
110 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
111
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
112 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
113 cube_collision(SceneGraphPtr node, int screen_w, int screen_h,
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
114 SceneGraphPtr tree)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
115 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
116 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
117
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
118 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
119 vacuum_coll(SceneGraphPtr node, int screen_w, int screen_h,
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
120 SceneGraphPtr tree)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
121 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
122 SceneGraphIteratorPtr it = sgroot->getIterator();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
123 //xSceneGraphPtr bigm;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
124 Pad *pad = sgroot->getController();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
125 float dx, dy, r;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
126 float q = 0;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
127
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
128 if (pad->cross.isRelease()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
129 return;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
130 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
131
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
132 return;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
133
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
134 for (; it->hasNext(MCUBE);) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
135 it->next(MCUBE);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
136 SceneGraphPtr mcube = it->get();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
137
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
138 dx = node->xyz[0] - mcube->xyz[0];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
139 dy = node->xyz[1] - mcube->xyz[1];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
140
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
141 r = sqrt(dx*dx + dy*dy);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
142
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
143 if (r >= 1) q = 300/r;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
144
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
145 if (r < 50.0f) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
146 mcube->remove();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
147 continue;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
148 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
149
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
150 if (dx == 0) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
151 if(mcube->xyz[1] > node->xyz[1]) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
152 mcube->xyz[1] -= q;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
153 } else if(mcube->xyz[1] < node->xyz[1]) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
154 mcube->xyz[1] += q;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
155 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
156 } else {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
157 if(mcube->xyz[0] > node->xyz[0]) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
158 mcube->xyz[0] -= q*cos(atan(dy/dx));
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
159 mcube->xyz[1] -= q*sin(atan(dy/dx));
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
160 mcube->stack_xyz[0] = -q*cos(atan(dy/dx));
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
161 mcube->stack_xyz[1] = -q*sin(atan(dy/dx));
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
162 } else if(mcube->xyz[0] < mcube->xyz[0]) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
163 mcube->xyz[0] += q*cos(atan(dy/dx));
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
164 mcube->xyz[1] += q*sin(atan(dy/dx));
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
165 mcube->stack_xyz[0] = -q*cos(atan(dy/dx));
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
166 mcube->stack_xyz[1] = -q*sin(atan(dy/dx));
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
167 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
168 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
169 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
170 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
171
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
172 static void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
173 vacuum_move(SceneGraphPtr node , int w, int h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
174 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
175 Pad *pad = sgroot->getController();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
176
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
177 if (pad->right.isHold()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
178 node->xyz[0] += vacuum_speed;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
179 } else if (pad->left.isHold()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
180 node->xyz[0] -= vacuum_speed;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
181 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
182
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
183 if (pad->up.isHold()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
184 node->xyz[1] -= vacuum_speed;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
185 } else if (pad->down.isHold()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
186 node->xyz[1] += vacuum_speed;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
187 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
188
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
189 if (pad->start.isPush()) {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
190 node->xyz[0] = w/2;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
191 node->xyz[1] = h*0.8;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
192 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
193 }
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
194
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
195 void
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
196 vacuum_init(int w, int h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
197 {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
198 SceneGraphPtr cube;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
199 SceneGraphPtr vacuum;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
200 SceneGraphPtr back;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
201
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
202 sgroot->createFromXMLfile("xml_file/mcube.xml");
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
203
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
204 cube = sgroot->createSceneGraph(MCUBE);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
205 cube->xyz[0] = w/2;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
206 cube->xyz[1] = h/2;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
207 cube->xyz[2] = 0.0f;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
208 cube->set_move_collision(cube_move_idle, cube_collision);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
209
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
210 vacuum = sgroot->createSceneGraph(BIGMCUBE);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
211 vacuum->xyz[0] = w/2;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
212 vacuum->xyz[1] = h*0.8;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
213 vacuum->set_move_collision(vacuum_move, vacuum_coll);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
214
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
215 back = sgroot->createSceneGraph();
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
216 back->addChild(vacuum);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
217 back->addChild(cube);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
218
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
219 sgroot->setSceneData(back);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
220 }