Mercurial > hg > Game > Cerium
changeset 969:52c4353308e7 draft
add new function for dandy.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 26 Aug 2010 03:20:42 +0900 |
parents | 122b1fddfa94 |
children | 9d5433e8da58 |
files | Renderer/Engine/SceneGraphRoot.cc Renderer/Engine/SceneGraphRoot.h Renderer/Engine/viewer.cc Renderer/Engine/viewer.h |
diffstat | 4 files changed, 67 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraphRoot.cc Mon Aug 09 00:09:00 2010 +0900 +++ b/Renderer/Engine/SceneGraphRoot.cc Thu Aug 26 03:20:42 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 */
--- a/Renderer/Engine/SceneGraphRoot.h Mon Aug 09 00:09:00 2010 +0900 +++ b/Renderer/Engine/SceneGraphRoot.h Thu Aug 26 03:20:42 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);
--- a/Renderer/Engine/viewer.cc Mon Aug 09 00:09:00 2010 +0900 +++ b/Renderer/Engine/viewer.cc Thu Aug 26 03:20:42 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
--- a/Renderer/Engine/viewer.h Mon Aug 09 00:09:00 2010 +0900 +++ b/Renderer/Engine/viewer.h Thu Aug 26 03:20:42 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)