comparison Renderer/Engine/SceneGraphRoot.cc @ 758:77f936380930 draft

fix create_task
author hiroki@henri.cr.ie.u-ryukyu.ac.jp
date Mon, 01 Feb 2010 17:08:36 +0900
parents 1666dba6f6d9
children 45f7ab7101ea
comparison
equal deleted inserted replaced
757:2aa6e7150588 758:77f936380930
409 list->move_execute(screen_w, screen_h); 409 list->move_execute(screen_w, screen_h);
410 list->collision_check(screen_w, screen_h, list); 410 list->collision_check(screen_w, screen_h, list);
411 411
412 list->frame++; 412 list->frame++;
413 list = list->next; 413 list = list->next;
414 } 414 }
415 415
416 get_matrix(light->matrix, light->angle, light->xyz, camera->matrix); 416 get_matrix(light->matrix, light->angle, light->xyz, camera->matrix);
417 417
418 light_vector[0] = 0.0f; 418 light_vector[0] = 0.0f;
419 light_vector[1] = 0.0f; 419 light_vector[1] = 0.0f;
424 424
425 light_vector[0] /= light_vector[2]; 425 light_vector[0] /= light_vector[2];
426 light_vector[1] /= light_vector[2]; 426 light_vector[1] /= light_vector[2];
427 427
428 if(sg_exec_tree != NULL) { 428 if(sg_exec_tree != NULL) {
429 return; 429 return;
430 } 430 }
431 431
432 /*removeのflagをもとにtreeを形成*/ 432 /*removeのflagをもとにtreeを形成*/
433 while (t) { 433 while (t) {
434 SceneGraphPtr c = NULL; 434 SceneGraphPtr c = NULL;
478 478
479 sg_exec_tree = camera->children; 479 sg_exec_tree = camera->children;
480 } 480 }
481 481
482 void 482 void
483 SceneGraphRoot::oneExecute(int screen_w, int screen_h)
484 {
485 SceneGraphPtr list = sg_available_list;
486 SceneGraphPtr t = sg_exec_tree;
487 SceneGraphPtr cur_parent = camera;
488
489 // 前フレームで描画した SceneGraph は削除
490 allRemove(sg_remove_list);
491
492 // 前フレームに作られた SceneGraph は描画用に移行
493 // 現フレームでの操作は以下の tree,list には適用されない
494 sg_draw_tree = sg_exec_tree;
495 sg_remove_list = sg_available_list;
496
497 // 現フレームで新しく SceneGraph がコピーされるので初期化
498 sg_exec_tree = NULL;
499 sg_available_list = NULL;
500
501 camera->move_execute(screen_w, screen_h);
502 camera->update(screen_w, screen_h);
503
504 camera->children = NULL;
505 camera->lastChild = NULL;
506
507 /* ここから */
508 list->move_execute(screen_w, screen_h);
509 list->collision_check(screen_w, screen_h, list);
510 /* ここまで exec_task にする */
511
512
513 /* ここから下を exec_task の post_func に*/
514 list->frame++;
515 list = list->next;
516
517 get_matrix(light->matrix, light->angle, light->xyz, camera->matrix);
518
519 light_vector[0] = 0.0f;
520 light_vector[1] = 0.0f;
521 light_vector[2] = 0.0f;
522 light_vector[3] = 1.0f;
523
524 ApplyMatrix(light_vector, light->matrix);
525
526 light_vector[0] /= light_vector[2];
527 light_vector[1] /= light_vector[2];
528
529 if(sg_exec_tree != NULL) {
530 return;
531 }
532 }
533
534 void
483 SceneGraphRoot::allRemove(SceneGraphPtr list) 535 SceneGraphRoot::allRemove(SceneGraphPtr list)
484 { 536 {
485 SceneGraphPtr p = list; 537 SceneGraphPtr p = list;
486 538
487 while (p) { 539 while (p) {