comparison TaskManager/Test/test_render/viewer.cc @ 421:6094dfd1f08c draft

comment
author game@henri.cr.ie.u-ryukyu.ac.jp
date Thu, 24 Sep 2009 12:35:32 +0900
parents a3ef5c15edac
children 217258e3d148
comparison
equal deleted inserted replaced
420:cd9baead0c39 421:6094dfd1f08c
115 frames = 0; 115 frames = 0;
116 116
117 sgroot = new SceneGraphRoot(this->width, this->height); 117 sgroot = new SceneGraphRoot(this->width, this->height);
118 sgroot_2 = new SceneGraphRoot(this->width, this->height); 118 sgroot_2 = new SceneGraphRoot(this->width, this->height);
119 //sgroot->createFromXMLFile(xml); 119 //sgroot->createFromXMLFile(xml);
120 120 // ここの switch は application->init(this, manager, sg_no); になるべき
121 switch (sg_number) { 121 switch (sg_number) {
122 case 0: 122 case 0:
123 case 1: 123 case 1:
124 create_cube_split(manager, sg_number); 124 create_cube_split(manager, sg_number);
125 break; 125 break;
241 // SPE に送信する KEY_STATUS の領域確保 241 // SPE に送信する KEY_STATUS の領域確保
242 key_stat *key = (key_stat*)manager->allocate(sizeof(key_stat)); 242 key_stat *key = (key_stat*)manager->allocate(sizeof(key_stat));
243 this->keyPtr = key; 243 this->keyPtr = key;
244 244
245 // post2runLoop は旧バージョン用なので post2speRunLoop の様なものを別につくるべき 245 // post2runLoop は旧バージョン用なので post2speRunLoop の様なものを別につくるべき
246 task_next->set_post(post2speRunLoop, (void*)this); // set_post(function(this->run_loop()), NULL) 246 //task_next->set_post(post2speRunLoop, (void*)this); // set_post(function(this->run_loop()), NULL)
247 task_next->spawn(); 247 //task_next->spawn();
248 // TASK_INIT_TEXTURE が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ 248 // TASK_INIT_TEXTURE が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ
249 249
250 /* test */ 250 /* test */
251 251
252 HTaskPtr task_switch = manager->create_task(TASK_SWITCH); 252 HTaskPtr task_switch = manager->create_task(TASK_SWITCH);
312 viewer->getKey(); 312 viewer->getKey();
313 HTaskPtr update_key = viewer->manager->create_task(UPDATE_KEY); 313 HTaskPtr update_key = viewer->manager->create_task(UPDATE_KEY);
314 update_key->add_inData(viewer->keyPtr, sizeof(key_stat)); 314 update_key->add_inData(viewer->keyPtr, sizeof(key_stat));
315 update_key->spawn(); 315 update_key->spawn();
316 316
317 HTaskPtr move_task = viewer->manager->create_task(TASK_MOVE); 317 /* TASK_MOVE は外から引数で取ってくるべき */
318 HTaskPtr move_task = viewer->manager->create_task(viewer->move_taskid);
318 //move_task->add_param(sgroot); 319 //move_task->add_param(sgroot);
319 320
320 HTaskPtr draw_task = viewer->manager->create_task(TASK_DRAW); 321 HTaskPtr draw_task = viewer->manager->create_task(TASK_DRAW);
321 322
322 HTaskPtr switch_task = viewer->manager->create_task(TASK_SWITCH); 323 HTaskPtr switch_task = viewer->manager->create_task(TASK_SWITCH);
324
323 switch_task->wait_for(move_task); 325 switch_task->wait_for(move_task);
324 switch_task->wait_for(draw_task); 326 switch_task->wait_for(draw_task);
325 move_task->spawn(); 327 move_task->spawn();
326 draw_task->spawn(); 328 draw_task->spawn();
327 329
336 Viewer *viewer = (Viewer *)viewer_; 338 Viewer *viewer = (Viewer *)viewer_;
337 HTaskPtr task_next = viewer->manager->create_task(TASK_DUMMY); 339 HTaskPtr task_next = viewer->manager->create_task(TASK_DUMMY);
338 viewer->run_move(task_next); 340 viewer->run_move(task_next);
339 } 341 }
340 342
341 /*
342 void
343 Viewer::spe_run_loop()
344 {
345
346 bool quit_flg;
347 quit_flg = quit_check();
348 if (quit_flg == true) {
349 this_time = get_ticks();
350 run_finish();
351 return;
352 }
353
354 clean_pixels();
355
356 for (int i = 1; i <= spackList_length; i++) {
357 spackList[i-1].reinit(i*split_screen_h);
358 }
359
360 //run_move(task_next);
361 sgroot->updateControllerState();
362 sgroot->speExecute(width, height);
363 //sgroot->checkRemove();
364
365 // ここから下は Rendering という関数にする
366 rendering(task_next);
367
368 }
369
370 */
371 void 343 void
372 Viewer::mainLoop() 344 Viewer::mainLoop()
373 { 345 {
374 HTaskPtr task_next = initLoop(); 346 HTaskPtr task_next = initLoop();
375 347
376 task_next->set_post(&post2runLoop, (void *)this); // set_post(function(this->run_loop()), NULL) 348 task_next->set_post(&post2runLoop, (void *)this); // set_post(function(this->run_loop()), NULL)
377 task_next->spawn(); 349 task_next->spawn();
378 // TASK_INIT_TEXTURE が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ 350 }
379 }
380
381
382 /*
383 static void
384 post2exchange_sgroot(void *viewer_)
385 {
386 Viewer *viewer = (Viewer*)viewer_;
387 HTaskPtr task_next = viewer->manager->create_task(TASK_DUMMY);
388 viewer->exchange_sgroot(task_next);
389 }
390
391 void
392 Viewer::exchange_sgroot(TaskManager *manager)
393 {
394
395 SceneGraphRootPtr tmp = sgroot;
396 sgroot = sgroot_2;
397 sgroot_2 = tmp;
398
399 }
400 */
401
402 /*
403 void
404 Viewer::spe_run_move(HTaskPtr task_next)
405 {
406 HTaskPtr move_task = manager->create_task(MOVE_TASK);
407 move_task->add_param(sgroot);
408 task_next->wait_for(move_task);
409 }
410 */
411 351
412 static void 352 static void
413 post2runMove(void *viewer_) 353 post2runMove(void *viewer_)
414 { 354 {
415 Viewer *viewer = (Viewer*)viewer_; 355 Viewer *viewer = (Viewer*)viewer_;
598 538
599 delete sgroot; 539 delete sgroot;
600 delete sgroot_2; 540 delete sgroot_2;
601 quit(); 541 quit();
602 } 542 }
543
544 /* end */