Mercurial > hg > Members > kono > Cerium
comparison Renderer/Engine/SceneGraphRoot.cc @ 1033:431936c0cc96
add application main method and task.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 26 Nov 2010 04:32:59 +0900 |
parents | 443c01049702 |
children | b9cd0c88b69a |
comparison
equal
deleted
inserted
replaced
1010:44b2c4cb539d | 1033:431936c0cc96 |
---|---|
5 #include "xml.h" | 5 #include "xml.h" |
6 #include "sys.h" | 6 #include "sys.h" |
7 #include "TextureHash.h" | 7 #include "TextureHash.h" |
8 #include "texture.h" | 8 #include "texture.h" |
9 #include "Application.h" | 9 #include "Application.h" |
10 | |
11 | 10 |
12 static int cnt = 0; | 11 static int cnt = 0; |
13 static const int SGLIST_LENGTH = 138; | 12 static const int SGLIST_LENGTH = 138; |
14 static int sg_src_size = SGLIST_LENGTH ; | 13 static int sg_src_size = SGLIST_LENGTH ; |
15 static int sg_src_id = -1; | 14 static int sg_src_id = -1; |
407 | 406 |
408 /*removeのflagをもとにtreeを形成*/ | 407 /*removeのflagをもとにtreeを形成*/ |
409 while (t) { | 408 while (t) { |
410 SceneGraphPtr c = NULL; | 409 SceneGraphPtr c = NULL; |
411 if (!t->isRemoved()) { | 410 if (!t->isRemoved()) { |
412 c = t->clone(); | 411 c = t->clone(); |
413 addNext(c); | 412 addNext(c); |
414 cur_parent->addChild(c); | 413 cur_parent->addChild(c); |
415 c->frame = t->frame; | 414 c->frame = t->frame; |
416 /*親の回転、座標から、子の回転、座標を算出*/ | 415 /*親の回転、座標から、子の回転、座標を算出*/ |
417 get_matrix(c->matrix, c->angle, c->xyz, cur_parent->matrix); | 416 get_matrix(c->matrix, c->angle, c->xyz, cur_parent->matrix); |
721 { | 720 { |
722 gtask_array->finish(); | 721 gtask_array->finish(); |
723 } | 722 } |
724 | 723 |
725 void | 724 void |
726 SceneGraphRoot::set_game_task(int id, void *property, int size, PostFunction post_func) | 725 SceneGraphRoot::set_gtask_array(int id, void *property, int size, PostFunction post_func) |
727 { | 726 { |
728 gtask_array->next_task_array(id); | 727 gtask_array->next_task_array(id); |
729 | 728 |
730 gtask_array->game_task->set_inData(0, property, size); | 729 gtask_array->game_task->set_inData(0, property, size); |
731 gtask_array->game_task->set_outData(0, property, size); | 730 gtask_array->game_task->set_outData(0, property, size); |
732 | 731 |
733 } | 732 } |
734 | 733 |
735 void | 734 void |
736 SceneGraphRoot::set_game_task(int id, void *property, void *pad, int size, PostFunction post_func) | 735 SceneGraphRoot::set_gtask_array(int id, void *property, void *pad, int size, PostFunction post_func) |
737 { | 736 { |
738 gtask_array->next_task_array(id); | 737 gtask_array->next_task_array(id); |
739 | 738 |
740 gtask_array->game_task->set_inData(0, property, size); | 739 gtask_array->game_task->set_inData(0, property, size); |
741 gtask_array->game_task->set_inData(1, pad, sizeof(Pad)); | 740 gtask_array->game_task->set_inData(1, pad, sizeof(Pad)); |
742 gtask_array->game_task->set_outData(0, property, size); | 741 gtask_array->game_task->set_outData(0, property, size); |
743 | 742 |
744 } | 743 } |
745 | 744 |
746 void | 745 void |
746 SceneGraphRoot::set_game_task(int id, void *property, int size) | |
747 { | |
748 HTask *task = sgroot->tmanager->create_task(id); | |
749 task->set_cpu(SPE_ANY); | |
750 task->add_inData(property, size); | |
751 task->add_outData(property, size); | |
752 task->spawn(); | |
753 } | |
754 | |
755 void | |
756 SceneGraphRoot::set_game_task(int id, void *property, void *pad, int size) | |
757 { | |
758 HTask *task = sgroot->tmanager->create_task(id); | |
759 task->set_cpu(SPE_ANY); | |
760 task->add_inData(property, size); | |
761 task->add_inData(pad, sizeof(Pad)); | |
762 task->add_outData(property, size); | |
763 task->spawn(); | |
764 } | |
765 | |
766 | |
767 void | |
747 main_task_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) | 768 main_task_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) |
748 { | 769 { |
749 int size = node->property_size; | 770 int size = node->property_size; |
750 void *e = node->propertyptr; | 771 void *e = node->propertyptr; |
751 int move = node->move_id; | 772 int move = node->move_id; |
752 PostFunction post_func = node->post_func; | 773 SceneGraphRoot *sgroottmp = (SceneGraphRoot*)sgroot_; |
774 /* | |
775 ObjPropertyPtr property = (ObjPropertyPtr)node->propertyptr; | |
776 node->xyz[0] = property->x; | |
777 node->xyz[1] = property->y; | |
778 */ | |
779 sgroottmp->set_game_task(move, (void*)e, size); | |
780 } | |
781 | |
782 void | |
783 pad_task_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) | |
784 { | |
785 int size = node->property_size; | |
786 void *e = node->propertyptr; | |
787 int move = node->move_id; | |
788 SceneGraphRoot *sgroottmp = (SceneGraphRoot*)sgroot_; | |
789 void *pad = (void*)sgroottmp->getController(); | |
790 | |
753 /* | 791 /* |
754 ObjPropertyPtr property = (ObjPropertyPtr)node->propertyptr; | 792 ObjPropertyPtr property = (ObjPropertyPtr)node->propertyptr; |
755 property->root = node; | 793 property->root = node; |
794 node->xyz[0] = property->x; | |
795 node->xyz[1] = property->y; | |
756 */ | 796 */ |
757 | 797 |
758 SceneGraphRoot *sgroottmp = (SceneGraphRoot*)sgroot_; | 798 sgroottmp->set_game_task(move, (void*)e, pad, size); |
759 | 799 } |
760 sgroottmp->set_game_task(move, (void*)e, size, post_func); | 800 |
761 } | 801 void |
762 | 802 SceneGraphRoot::set_move_task(SceneGraphPtr node, int move, void *property, int size) |
763 void | |
764 pad_task_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) | |
765 { | |
766 int size = node->property_size; | |
767 void *e = node->propertyptr; | |
768 int move = node->move_id; | |
769 PostFunction post_func = node->post_func; | |
770 /* | |
771 ObjPropertyPtr property = (ObjPropertyPtr)node->propertyptr; | |
772 property->root = node; | |
773 */ | |
774 | |
775 SceneGraphRoot *sgroottmp = (SceneGraphRoot*)sgroot_; | |
776 void *pad = (void*)sgroottmp->getController(); | |
777 | |
778 sgroottmp->set_game_task(move, (void*)e, pad, size, post_func); | |
779 } | |
780 | |
781 void | |
782 SceneGraphRoot::set_move_task(SceneGraphPtr node, int move, void *property, int size, | |
783 PostFunction post_func) | |
784 { | 803 { |
785 node->move = main_task_move; | 804 node->move = main_task_move; |
786 node->post_func = post_func; | |
787 node->move_id = move; | 805 node->move_id = move; |
788 node->propertyptr = property; | 806 node->propertyptr = property; |
789 node->property_size = size; | 807 node->property_size = size; |
790 } | 808 } |
791 | 809 |
792 void | 810 void |
793 SceneGraphRoot::set_pad_task(SceneGraphPtr node, int move, void *property, int size, | 811 SceneGraphRoot::set_pad_task(SceneGraphPtr node, int move, void *property, int size) |
794 PostFunction post_func) | |
795 { | 812 { |
796 node->move = pad_task_move; | 813 node->move = pad_task_move; |
797 node->post_func = post_func; | |
798 node->move_id = move; | 814 node->move_id = move; |
799 node->propertyptr = property; | 815 node->propertyptr = property; |
800 node->property_size = size; | 816 node->property_size = size; |
801 } | 817 } |
802 | 818 |