Mercurial > hg > Game > Cerium
annotate TaskManager/Test/test_render/viewer.cpp @ 269:abf96b4caee5 draft
merge
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 04 Jun 2009 00:01:11 +0900 |
parents | e9735a64cd90 2b7d631695ca |
children | 237a75ab7a9b |
rev | line source |
---|---|
140 | 1 #include <SDL.h> |
109 | 2 #include "viewer.h" |
120 | 3 #include "viewer_types.h" |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
4 #include "SceneGraph.h" |
195 | 5 #include "SceneGraphRoot.h" |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
6 #include "scene_graph_pack.h" |
109 | 7 #include "sys.h" |
8 #include "Func.h" | |
9 #include "error.h" | |
10 #include "TaskManager.h" | |
212 | 11 #include <wchar.h> |
221 | 12 #include "Pad.h" |
212 | 13 |
109 | 14 |
15 extern void post2runLoop(void *); | |
16 extern void post2runDraw(void *); | |
17 | |
18 /* measure for FPS (Frame Per Second) */ | |
19 int start_time; | |
20 int this_time; | |
21 int frames; | |
22 | |
198
b832e6cff83e
rename snake_bg to panel
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
23 SceneGraphRootPtr sgroot; |
109 | 24 |
176 | 25 /* Data Pack sent to Other CPUs (ex. SPE) */ |
109 | 26 SceneGraphPack *sgpack; |
27 PolygonPack *ppack; | |
28 SpanPackPtr spackList; | |
29 SpanPackPtr *spackList_ptr; | |
210 | 30 |
109 | 31 int spackList_length; |
32 int spackList_length_align; | |
33 | |
140 | 34 /** |
176 | 35 * |
36 */ | |
37 | |
109 | 38 Viewer::Viewer(int b, int w, int h, int _num) |
39 { | |
40 bpp = b; | |
41 width = w; | |
42 height = h; | |
43 spe_num = _num; | |
44 } | |
45 | |
46 int | |
229 | 47 Viewer::get_ticks(void) |
109 | 48 { |
49 int time; | |
50 time = SDL_GetTicks(); | |
51 return time; | |
52 } | |
53 | |
54 bool | |
229 | 55 Viewer::quit_check(void) |
109 | 56 { |
57 SDL_Event event; | |
58 | |
59 while(SDL_PollEvent(&event)) { | |
60 if (event.type==SDL_QUIT) { | |
61 return true; | |
62 } | |
63 } | |
64 | |
65 Uint8 *keys=SDL_GetKeyState(NULL); | |
66 | |
67 if (keys[SDLK_q] == SDL_PRESSED) { | |
68 return true; | |
69 } | |
70 | |
71 return false; | |
72 } | |
73 | |
74 void | |
229 | 75 Viewer::quit(void) |
109 | 76 { |
77 SDL_Quit(); | |
78 } | |
79 | |
80 void | |
229 | 81 Viewer::swap_buffers(void) |
109 | 82 { |
83 SDL_GL_SwapBuffers(); | |
84 } | |
85 | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
86 extern void node_init(void); |
144 | 87 extern void create_cube_split(int); |
198
b832e6cff83e
rename snake_bg to panel
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
88 extern void panel_init(int); |
158 | 89 extern void universe_init(void); |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
198
diff
changeset
|
90 extern void ieshoot_init(void); |
210 | 91 extern void ball_bound_init(int, int); |
212 | 92 extern void lcube_init(int, int); |
93 extern void direction_init(void); | |
213
8ac35507094d
add SceneGraph "3D Super-Dandy"
gongo@localhost.localdomain
parents:
212
diff
changeset
|
94 extern void init_position(int, int); |
222 | 95 extern void vacuum_init(int w, int h); |
231
5ae15a5d3dc5
test program add (-sg 12)
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
229
diff
changeset
|
96 extern void untitled_init(void); |
109 | 97 void |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
177
diff
changeset
|
98 Viewer::run_init(const char *xml, int sg_number) |
109 | 99 { |
100 HTaskPtr task_next; | |
167
508beb59e0eb
DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents:
158
diff
changeset
|
101 HTaskPtr task_tex; |
109 | 102 |
103 start_time = get_ticks(); | |
104 this_time = 0; | |
105 frames = 0; | |
106 | |
221 | 107 sgroot = new SceneGraphRoot(this->width, this->height); |
195 | 108 //sgroot->createFromXMLFile(xml); |
140 | 109 |
144 | 110 switch (sg_number) { |
111 case 0: | |
112 case 1: | |
113 create_cube_split(sg_number); | |
114 break; | |
115 case 2: | |
153
70146cdec3d4
画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
150
diff
changeset
|
116 case 3: |
70146cdec3d4
画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
150
diff
changeset
|
117 case 4: |
198
b832e6cff83e
rename snake_bg to panel
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
195
diff
changeset
|
118 panel_init(sg_number); |
144 | 119 break; |
153
70146cdec3d4
画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
150
diff
changeset
|
120 case 5: |
158 | 121 universe_init(); |
122 break; | |
123 case 6: | |
199
1fd0107ebb25
add SceneGraph(ieshoot), add SystemSceneGraph(Camera)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
198
diff
changeset
|
124 ieshoot_init(); |
144 | 125 break; |
210 | 126 case 7: |
127 ball_bound_init(this->width, this->height); | |
128 break; | |
212 | 129 case 8: |
130 lcube_init(this->width, this->height); | |
144 | 131 break; |
212 | 132 case 9: |
133 direction_init(); | |
134 break; | |
213
8ac35507094d
add SceneGraph "3D Super-Dandy"
gongo@localhost.localdomain
parents:
212
diff
changeset
|
135 case 10: |
8ac35507094d
add SceneGraph "3D Super-Dandy"
gongo@localhost.localdomain
parents:
212
diff
changeset
|
136 init_position(this->width, this->height); |
8ac35507094d
add SceneGraph "3D Super-Dandy"
gongo@localhost.localdomain
parents:
212
diff
changeset
|
137 break; |
222 | 138 case 11: |
139 vacuum_init(this->width, this->height); | |
140 break; | |
231
5ae15a5d3dc5
test program add (-sg 12)
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
229
diff
changeset
|
141 case 12: |
5ae15a5d3dc5
test program add (-sg 12)
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
229
diff
changeset
|
142 untitled_init(); |
5ae15a5d3dc5
test program add (-sg 12)
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents:
229
diff
changeset
|
143 break; |
144 | 144 default: |
145 node_init(); | |
146 break; | |
147 } | |
142 | 148 |
217 | 149 sgpack = (SceneGraphPack*)manager->allocate(sizeof(SceneGraphPack)); |
109 | 150 sgpack->init(); |
217 | 151 ppack = (PolygonPack*)manager->allocate(sizeof(PolygonPack)); |
109 | 152 |
153 spackList_length = (this->height + split_screen_h - 1) / split_screen_h; | |
217 | 154 spackList = (SpanPack*)manager->allocate(sizeof(SpanPack)*spackList_length); |
109 | 155 |
176 | 156 /** |
157 * SPU に送る address list は 16 バイト倍数でないといけない。 | |
158 * spackList_length*sizeof(SpanPack*) が 16 バイト倍数になるような | |
159 * length_align を求めている。はみ出した部分は使われない | |
160 * (ex) spackList_length が 13 の場合 | |
161 * spackList_length_align = 16; | |
162 * 実際に送るデータは64バイトになるのでOK | |
163 * 14,15,16 の部分は何も入らない。 | |
164 */ | |
109 | 165 spackList_length_align = (spackList_length + 3)&(~3); |
166 | |
167 /* 各 SPU が持つ、SpanPack の address list */ | |
167
508beb59e0eb
DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents:
158
diff
changeset
|
168 spackList_ptr = |
217 | 169 (SpanPack**)manager->allocate(sizeof(SpanPack*)*spackList_length_align); |
109 | 170 |
171 for (int i = 0; i < spackList_length; i++) { | |
172 spackList_ptr[i] = &spackList[i]; | |
173 } | |
174 | |
126
74d0a70f60e9
fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
123
diff
changeset
|
175 for (int i = 1; i <= spackList_length; i++) { |
74d0a70f60e9
fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
123
diff
changeset
|
176 spackList[i-1].init(i*split_screen_h); |
74d0a70f60e9
fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
123
diff
changeset
|
177 } |
74d0a70f60e9
fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
123
diff
changeset
|
178 |
109 | 179 task_next = manager->create_task(TASK_DUMMY); |
244 | 180 |
109 | 181 |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
182 #if 0 |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
183 // 諸事情で、今は SceneGraphPack を作らずに |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
184 // そのまま SceneGraph でやっています |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
185 HTaskPtr task_sgp; |
109 | 186 task_sgp = manager->create_task(TASK_CREATE_SGP); |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
187 task_sgp->add_param((uint32)scene_graph); |
109 | 188 task_sgp->add_param((uint32)sgpack); |
189 task_next->wait_for(task_sgp); | |
190 task_sgp->spawn(); | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
191 #endif |
109 | 192 |
167
508beb59e0eb
DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents:
158
diff
changeset
|
193 for (int i = 0; i < spe_num; i++) { |
508beb59e0eb
DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents:
158
diff
changeset
|
194 task_tex = manager->create_task(TASK_INIT_TEXTURE); |
244 | 195 /* |
196 * ここはもう少しわかりやすい使い方がいいかもしれぬ。こんなもん? | |
197 */ | |
167
508beb59e0eb
DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents:
158
diff
changeset
|
198 task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i)); |
508beb59e0eb
DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents:
158
diff
changeset
|
199 task_next->wait_for(task_tex); |
508beb59e0eb
DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents:
158
diff
changeset
|
200 task_tex->spawn(); |
120 | 201 } |
202 | |
244 | 203 task_next->set_post(&post2runLoop, NULL); // set_post(function(this->run_loop()), NULL) |
204 task_next->spawn(); | |
205 // TASK_INIT_TEXTURE が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ | |
109 | 206 } |
207 | |
208 void | |
209 Viewer::run_loop(void) | |
210 { | |
211 HTaskPtr task_create_pp = NULL; | |
212 HTaskPtr task_create_sp = NULL; | |
213 HTaskPtr task_next; | |
214 bool quit_flg; | |
215 | |
216 quit_flg = quit_check(); | |
217 | |
218 if (quit_flg == true) { | |
219 this_time = get_ticks(); | |
220 run_finish(); | |
221 return; | |
222 } | |
223 | |
224 clean_pixels(); | |
225 | |
226 for (int i = 1; i <= spackList_length; i++) { | |
126
74d0a70f60e9
fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
123
diff
changeset
|
227 spackList[i-1].reinit(i*split_screen_h); |
109 | 228 } |
229 | |
230 task_next = manager->create_task(TASK_DUMMY); | |
244 | 231 |
109 | 232 |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
233 #if 0 |
157 | 234 // SceneGraphPack の update |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
235 HTaskPtr task_update_sgp = NULL; |
109 | 236 task_update_sgp = manager->create_task(TASK_UPDATE_SGP); |
237 task_update_sgp->add_inData(sgpack, sizeof(SceneGraphPack)); | |
238 task_update_sgp->add_outData(sgpack, sizeof(SceneGraphPack)); | |
239 task_update_sgp->add_param(width); | |
240 task_update_sgp->add_param(height); | |
241 task_next->wait_for(task_update_sgp); | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
242 task_update_sgp->spawn(); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
243 #else |
195 | 244 sgroot->updateControllerState(); |
245 sgroot->allExecute(width, height); | |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
217
diff
changeset
|
246 //sgroot->checkRemove(); |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
247 #endif |
109 | 248 |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
249 #if 0 |
157 | 250 // SceneGraphPack(配列) -> PolygonPack |
109 | 251 task_create_pp = manager->create_task(TASK_CREATE_PP); |
252 task_create_pp->add_inData(sgpack, sizeof(SceneGraphPack)); | |
253 task_create_pp->add_param((uint32)ppack); | |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
254 #else |
157 | 255 // SceneGraph(木構造) -> PolygonPack |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
256 task_create_pp = manager->create_task(TASK_CREATE_PP2); |
195 | 257 task_create_pp->add_param((uint32)sgroot->getDrawSceneGraph()); |
137
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
258 task_create_pp->add_param((uint32)ppack); |
91c74dbc32e4
SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents:
133
diff
changeset
|
259 #endif |
109 | 260 task_next->wait_for(task_create_pp); |
261 | |
262 int range_base = spe_num; | |
263 // 切り上げのつもり | |
264 int range = (spackList_length + range_base - 1) / range_base; | |
265 | |
266 for (int i = 0; i < range_base; i++) { | |
267 int index_start = range*i; | |
268 int index_end = (index_start + range >= spackList_length) | |
269 ? spackList_length : index_start + range; | |
270 | |
271 task_create_sp = manager->create_task(TASK_CREATE_SPAN); | |
272 task_create_sp->add_inData(ppack, sizeof(PolygonPack)); | |
273 task_create_sp->add_inData(spackList_ptr, | |
274 sizeof(SpanPack*)*spackList_length_align); | |
275 task_create_sp->add_inData(&spackList[index_start], sizeof(SpanPack)); | |
276 | |
277 task_create_sp->add_param(index_start); | |
278 | |
279 /** | |
133
8f1419174cdf
DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
130
diff
changeset
|
280 * ex. screen_height が 480, spenum が 6 の場合、各SPEのy担当範囲 |
109 | 281 * [ 1.. 80] [ 81..160] [161..240] |
282 * [241..320] [321..400] [401..480] | |
283 * | |
284 * ex. screen_height が 1080, spenum が 5 の場合、 | |
285 * [ 1..216] [217..432] [433..648] | |
286 * [649..864] [865..1080] | |
287 */ | |
288 task_create_sp->add_param(index_start*split_screen_h + 1); | |
289 task_create_sp->add_param(index_end*split_screen_h); | |
290 | |
291 task_next->wait_for(task_create_sp); | |
292 task_create_sp->wait_for(task_create_pp); | |
293 | |
294 task_create_sp->set_cpu(SPE_ANY); | |
295 task_create_sp->spawn(); | |
296 } | |
297 | |
298 task_create_pp->spawn(); | |
244 | 299 |
300 // Barrier 同期 | |
301 task_next->set_post(post2runDraw, NULL); // set_post(function(this->run_draw()), NULL) | |
109 | 302 task_next->spawn(); |
244 | 303 // TASK_CREATE_SPAN が全て終わったら DUMMY_TASK が Viewer::run_draw() を呼ぶ |
109 | 304 } |
305 | |
306 void | |
307 Viewer::run_draw(void) | |
308 { | |
309 HTaskPtr task_next; | |
310 HTaskPtr task_draw; | |
311 | |
312 task_next = manager->create_task(TASK_DUMMY); | |
313 | |
314 ppack->clear(); | |
315 for (int i = 0; i < spackList_length; i++) { | |
316 SpanPack *spack = &spackList[i]; | |
317 int startx = 1; | |
318 int endx = split_screen_w; | |
319 | |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
177
diff
changeset
|
320 int starty = spack->info.y_top - split_screen_h + 1; |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
177
diff
changeset
|
321 //int endy = spack->info.y_top; |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
177
diff
changeset
|
322 int rangey = (starty + split_screen_h - 1 > this->height) |
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
177
diff
changeset
|
323 ? this->height - starty + 1 : split_screen_h; |
109 | 324 |
325 while (startx < this->width) { | |
326 if (spack->info.size > 0) { | |
327 // Draw SpanPack | |
328 task_draw = manager->create_task(TASK_DRAW_SPAN); | |
329 task_draw->add_inData(spack, sizeof(SpanPack)); | |
193 | 330 |
331 task_draw->add_param( | |
332 (uint32)&pixels[(startx-1) + this->width*(starty-1)]); | |
333 task_draw->add_param(this->width); | |
109 | 334 } else { |
200 | 335 #if 0 |
222 | 336 //break; |
109 | 337 // Draw Background (現在は塗りつぶし) |
338 task_draw = manager->create_task(TASK_DRAW_BACK); | |
266 | 339 <<<<<<< local |
170 | 340 task_draw->add_param(0xffffffff); |
269 | 341 <<<<<<< local |
205 | 342 |
193 | 343 for (int k = 0; k < rangey; k++) { |
344 task_draw->add_outData( | |
345 &pixels[(startx-1)+this->width*(k+starty-1)], | |
346 (endx - startx + 1)*sizeof(int)); | |
347 } | |
200 | 348 #else |
349 memset(&pixels[(startx-1)+this->width*(starty-1)], | |
213
8ac35507094d
add SceneGraph "3D Super-Dandy"
gongo@localhost.localdomain
parents:
212
diff
changeset
|
350 0, (this->width)*sizeof(int)*rangey); |
212 | 351 //wmemset((wchar_t*)&pixels[(startx-1)+this->width*(starty-1)], |
352 //0xFFFFFFFF, (this->width)*sizeof(int)*rangey/sizeof(wchar_t)); | |
200 | 353 break; |
354 #endif | |
269 | 355 ======= |
267 | 356 ======= |
357 <<<<<<< local | |
133
8f1419174cdf
DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents:
130
diff
changeset
|
358 task_draw->add_param(0xffffff); |
266 | 359 ======= |
122 | 360 //task_draw->add_param(0x00ffcc55); |
361 task_draw->add_param(0); | |
362 //task_draw->add_param(st_rgb); | |
266 | 363 >>>>>>> other |
267 | 364 >>>>>>> other |
109 | 365 } |
176 | 366 |
109 | 367 for (int k = 0; k < rangey; k++) { |
368 task_draw->add_outData( | |
180
e3b7776b1420
いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents:
177
diff
changeset
|
369 &pixels[(startx-1)+this->width*(k+starty-1)], |
109 | 370 (endx - startx + 1)*sizeof(int)); |
269 | 371 >>>>>>> other |
109 | 372 } |
373 | |
374 task_draw->add_param(startx); | |
375 task_draw->add_param(endx); | |
376 task_draw->add_param(rangey); | |
377 task_draw->set_cpu(SPE_ANY); | |
378 task_next->wait_for(task_draw); | |
379 task_draw->spawn(); | |
380 | |
381 startx += split_screen_w; | |
382 endx += split_screen_w; | |
383 | |
384 if (endx > this->width) { | |
385 endx = this->width; | |
386 } | |
387 } | |
388 } | |
389 | |
244 | 390 task_next->set_post(post2runLoop, NULL); // set_post(function(this->run_loop()), NULL) |
109 | 391 task_next->spawn(); |
244 | 392 // TASK_DRAW_SPAN が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ |
109 | 393 |
394 frames++; | |
395 } | |
396 | |
397 void | |
398 Viewer::run_finish(void) | |
399 { | |
400 if (this_time != start_time) { | |
401 printf("%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0); | |
402 } | |
403 | |
219
335ea3665fcd
allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents:
217
diff
changeset
|
404 delete sgroot; |
109 | 405 |
406 quit(); | |
407 } |