Mercurial > hg > Members > kono > Cerium
comparison Renderer/Engine/viewer.cc @ 1018:736a833db108
sg_drawable_num add. CreatePolygonFromSceneGraph not done.
author | tkaito |
---|---|
date | Sun, 07 Nov 2010 02:53:05 +0900 |
parents | 34a9ba655fbe |
children | 360f8eba78f1 |
comparison
equal
deleted
inserted
replaced
1016:e4e96ab3044d | 1018:736a833db108 |
---|---|
625 | 625 |
626 } | 626 } |
627 | 627 |
628 } | 628 } |
629 | 629 |
630 /* flag_drawable な Scenegraph の総数を求める */ | |
631 int | |
632 sg_drawable_num(SceneGraphPtr sg) | |
633 { | |
634 int sg_count = 0; | |
635 while (sg) { | |
636 if (sg->flag_drawable) { | |
637 sg_count++; | |
638 } | |
639 if (sg->children != NULL) { | |
640 sg = sg->children; | |
641 } else if (sg->brother != NULL) { | |
642 sg = sg->brother; | |
643 } else { | |
644 while (sg) { | |
645 if (sg->brother != NULL) { | |
646 sg = sg->brother; | |
647 break; | |
648 } else { | |
649 if (sg->parent == NULL) { | |
650 sg = NULL; | |
651 break; | |
652 } else { | |
653 sg = sg->parent; | |
654 } | |
655 } | |
656 } | |
657 } | |
658 } | |
659 return sg_count; | |
660 } | |
661 | |
630 void | 662 void |
631 create_pp_task(SceneGraphPtr sg, TaskManager *manager, int spe_num, HTaskPtr task_next) | 663 create_pp_task(SceneGraphPtr sg, TaskManager *manager, int spe_num, HTaskPtr task_next) |
632 { | 664 { |
633 | |
634 MatrixListInfo *matrix_info = (MatrixListInfo*)manager->allocate(sizeof(MatrixListInfo)); | |
635 collect_matrix(sg, matrix_info, manager); | |
636 | 665 |
637 /* | 666 /* |
638 * SceneGraph を辿って coord_xyz, coord_tex, normal, matrix, real_matrix 及び、 | 667 * SceneGraph を辿って coord_xyz, coord_tex, normal, matrix, real_matrix 及び、 |
639 * PolygonPack の TrianglePack (空) を送る。pp->info.size の計算もここで。 | 668 * PolygonPack の TrianglePack (空) を送る。pp->info.size の計算もここで。 |
640 * | 669 * |
641 */ | 670 */ |
671 //int spe_num = 6; | |
672 | |
673 HTask **task_array = (HTask**)manager->allocate(sizeof(HTask*)*spe_num); | |
674 Task **pp = (Task**)manager->allocate(sizeof(Task*)*spe_num); | |
675 | |
676 int sg_num = sg_drawable_num(sg); | |
677 | |
678 for (int k = 0; k < spe_num; k++) { | |
679 task_array[k] = manager->create_task_array(CreatePolygonFromSceneGraph,sg_num,4,6,1); | |
680 pp[k] = 0; | |
681 } | |
682 | |
683 while (sg) { | |
684 if (sg->flag_drawable) { | |
685 | |
686 } | |
687 if (sg->children != NULL) { | |
688 sg = sg->children; | |
689 } else if (sg->brother != NULL) { | |
690 sg = sg->brother; | |
691 } else { | |
692 while (sg) { | |
693 if (sg->brother != NULL) { | |
694 sg = sg->brother; | |
695 break; | |
696 } else { | |
697 if (sg->parent == NULL) { | |
698 sg = NULL; | |
699 break; | |
700 } else { | |
701 sg = sg->parent; | |
702 } | |
703 } | |
704 } | |
705 } | |
706 } | |
707 | |
708 //MatrixListInfo *matrix_info = (MatrixListInfo*)manager->allocate(sizeof(MatrixListInfo)); | |
709 //collect_matrix(sg, matrix_info, manager); | |
642 | 710 |
643 //HTaskPtr phase_wait = manager->create_task(Dummy); | 711 //HTaskPtr phase_wait = manager->create_task(Dummy); |
644 | 712 /* |
645 for (MatrixListInfo* t = matrix_info; t != NULL; t = t->next) { | 713 for (MatrixListInfo* t = matrix_info; t != NULL; t = t->next) { |
646 | 714 |
647 printf("list_length %d \n", t->list_length); | 715 printf("list_length %d \n", t->list_length); |
648 | 716 |
649 int alloc_size = 16*1024; | 717 int alloc_size = 16*1024; |
677 } | 745 } |
678 } | 746 } |
679 | 747 |
680 printf("-----------------------\n"); | 748 printf("-----------------------\n"); |
681 //return create_pp_wait; | 749 //return create_pp_wait; |
682 | 750 */ |
683 } | 751 } |
684 | 752 |
685 void | 753 void |
686 Viewer::common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot) | 754 Viewer::common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot) |
687 { | 755 { |
697 #endif | 765 #endif |
698 | 766 |
699 | 767 |
700 | 768 |
701 #else | 769 #else |
702 | 770 //SceneGraphPtr sg = sgroot->getDrawSceneGraph(); |
771 //printf("sg->size = %lld\n", sg->size); | |
703 HTaskPtr task_create_pp = manager->create_task(CreatePolygonFromSceneGraph); | 772 HTaskPtr task_create_pp = manager->create_task(CreatePolygonFromSceneGraph); |
704 // SceneGraph(木構造) -> PolygonPack | 773 // SceneGraph(木構造) -> PolygonPack |
705 | 774 |
706 task_create_pp->set_param(0,(memaddr)sgroot->getDrawSceneGraph()); | 775 task_create_pp->set_param(0,(memaddr)sgroot->getDrawSceneGraph()); |
707 task_create_pp->set_param(1,(memaddr)r[ppi].ppack); | 776 task_create_pp->set_param(1,(memaddr)r[ppi].ppack); |