# HG changeset patch # User Yutaka Kinjyo # Date 1282822808 -32400 # Node ID ff3ead9eaa3c1c6081e1b018d368713e3da1e1d4 # Parent 33630c6ff445cf90d4d1f44e82a98b10f2f7f26a# Parent 9a53faae88d82fdb279c016ea00dc9d5c6abc9ee merge diff -r 33630c6ff445 -r ff3ead9eaa3c Renderer/Engine/SceneGraphRoot.cc --- a/Renderer/Engine/SceneGraphRoot.cc Thu Aug 26 20:38:06 2010 +0900 +++ b/Renderer/Engine/SceneGraphRoot.cc Thu Aug 26 20:40:08 2010 +0900 @@ -6,7 +6,6 @@ #include "sys.h" #include "TextureHash.h" #include "texture.h" -//#include "SGList.h" #include "Application.h" static int cnt = 0; @@ -707,6 +706,20 @@ task->add_outData(property, size); task->add_param((memaddr)1); task->set_post(post_func, (void*)property, 0); + wait_game_task->wait_for(task); + task->spawn(); +} + +void +SceneGraphRoot::set_game_task(int id, void *property, void *pad, int size, PostFunction post_func) +{ + HTask *task = sgroot->tmanager->create_task(id); + task->set_cpu(SPE_ANY); + task->add_inData(property, size); + task->add_inData(pad, sizeof(Pad)); + task->add_outData(property, size); + task->set_post(post_func, (void*)property, 0); + wait_game_task->wait_for(task); task->spawn(); } @@ -717,11 +730,26 @@ void *e = node->propertyptr; int move = node->move_id; PostFunction post_func = node->post_func; + SceneGraphRoot *sgroottmp = (SceneGraphRoot*)sgroot_; sgroottmp->set_game_task(move, (void*)e, size, post_func); } void +pad_task_move(SceneGraphPtr node, void *sgroot_, int screen_w, int screen_h) +{ + int size = node->property_size; + void *e = node->propertyptr; + int move = node->move_id; + PostFunction post_func = node->post_func; + + SceneGraphRoot *sgroottmp = (SceneGraphRoot*)sgroot_; + void *pad = (void*)sgroottmp->getController(); + + sgroottmp->set_game_task(move, (void*)e, pad, size, post_func); +} + +void SceneGraphRoot::set_move_task(SceneGraphPtr node, int move, void *property, int size, PostFunction post_func) { @@ -732,4 +760,15 @@ node->property_size = size; } +void +SceneGraphRoot::set_pad_task(SceneGraphPtr node, int move, void *property, int size, + PostFunction post_func) +{ + node->move = pad_task_move; + node->post_func = post_func; + node->move_id = move; + node->propertyptr = property; + node->property_size = size; +} + /* end */ diff -r 33630c6ff445 -r ff3ead9eaa3c Renderer/Engine/SceneGraphRoot.h --- a/Renderer/Engine/SceneGraphRoot.h Thu Aug 26 20:38:06 2010 +0900 +++ b/Renderer/Engine/SceneGraphRoot.h Thu Aug 26 20:40:08 2010 +0900 @@ -105,9 +105,13 @@ void OffLightSwitch(int id); void OnLightSysSwitch(); void OffLightSysSwitch(); + + /* GameTask 生成用 */ + HTaskPtr wait_game_task; void set_game_task(int id, void *property, int size, PostFunction post_func); + void set_game_task(int id, void *property, void* pad, int size, PostFunction post_func); void set_move_task(SceneGraphPtr node, int move, void *property, int size, PostFunction post_func); - + void set_pad_task(SceneGraphPtr node, int move, void *property, int size, PostFunction post_func); /* Other System API */ void allExecute(int screen_w, int screen_h); diff -r 33630c6ff445 -r ff3ead9eaa3c Renderer/Engine/viewer.cc --- a/Renderer/Engine/viewer.cc Thu Aug 26 20:38:06 2010 +0900 +++ b/Renderer/Engine/viewer.cc Thu Aug 26 20:40:08 2010 +0900 @@ -332,6 +332,8 @@ spackList[i-1].reinit(i*split_screen_h); } + /* ここでGameTaskの終了を待つTaskを生成しておく */ + sgroot->wait_game_task = manager->create_task(Dummy,0,0,0,0); sgroot->updateControllerState(); sgroot->allExecute(width, height); light_xyz_stock = sgroot->getLightVector(); @@ -704,11 +706,13 @@ #else HTaskPtr task_create_pp = manager->create_task(CreatePolygonFromSceneGraph); - + HTaskPtr game_task = sgroot->wait_game_task; // SceneGraph(木構造) -> PolygonPack task_create_pp->set_param(0,(memaddr)sgroot->getDrawSceneGraph()); task_create_pp->set_param(1,(memaddr)ppack); + /* GameTaskの終了を待ってからポリゴンを作る */ + task_create_pp->wait_for(game_task); task_next->wait_for(task_create_pp); @@ -754,7 +758,7 @@ } task_create_pp->spawn(); - + game_task->spawn(); } HTaskPtr diff -r 33630c6ff445 -r ff3ead9eaa3c Renderer/Engine/viewer.h --- a/Renderer/Engine/viewer.h Thu Aug 26 20:38:06 2010 +0900 +++ b/Renderer/Engine/viewer.h Thu Aug 26 20:40:08 2010 +0900 @@ -91,13 +91,21 @@ // void setSceneData(SceneGraph *g); virtual void mainLoop(); + void set_game_task(int id, void *property, int size, PostFunction post_func) + { + sgroot->set_game_task(id, property, size, post_func); + } + void set_game_task(int id, void *property, void *pad, int size, PostFunction post_func) + { + sgroot->set_game_task(id, property, pad, size, post_func); + } void set_move_task(SceneGraphPtr node, int move_id, void *titlep, int size, PostFunction post_func) { sgroot->set_move_task(node, move_id, titlep, size, post_func); } - void set_game_task(int id, void *property, int size, PostFunction post_func) + void set_pad_task(SceneGraphPtr node, int move, void *property, int size, PostFunction post_func) { - sgroot->set_game_task(id, property, size, post_func); + sgroot->set_pad_task(node, move, property, size, post_func); } void createFromXMLmemory(SceneGraph * node, char *data, int len) @@ -110,6 +118,11 @@ sgroot->createFromXMLfile(manager, file); } + Pad * getController() + { + return sgroot->getController(); + } + SceneGraph * createSceneGraph(int id) { return sgroot->createSceneGraph(id); @@ -117,7 +130,7 @@ SceneGraph * createSceneGraph(const char *id) { - return sgroot->createSceneGraph(id); + return sgroot->createSceneGraph(id); } int getSgid(const char *id)