# HG changeset patch # User tkaito@henri.cr.ie.u-ryukyu.ac.jp # Date 1253707075 -32400 # Node ID 0ec0319618821ae0285b2b7c50d5de3d2bafe866 # Parent dbd70772322c9d9786f7d3eda9539b74997169eb SceneGraph switch add diff -r dbd70772322c -r 0ec031961882 TaskManager/Test/test_render/SceneGraphRoot.h --- a/TaskManager/Test/test_render/SceneGraphRoot.h Wed Sep 23 17:10:10 2009 +0900 +++ b/TaskManager/Test/test_render/SceneGraphRoot.h Wed Sep 23 20:57:55 2009 +0900 @@ -74,4 +74,6 @@ #endif +// 大域変数は無くすこと extern SceneGraphRootPtr sgroot; +extern SceneGraphRootPtr sgroot_2; diff -r dbd70772322c -r 0ec031961882 TaskManager/Test/test_render/task/Switch.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/task/Switch.cc Wed Sep 23 20:57:55 2009 +0900 @@ -0,0 +1,17 @@ +#include +#include +#include "Switch.h" +#include "viewer_types.h" +#include "SceneGraphRoot.h" + +SchedDefineTask(Switch); + +int +Switch::run(void *rbuf, void *wbuf) +{ + SceneGraphRootPtr tmp = sgroot; + sgroot = sgroot_2; + sgroot_2 = tmp; + + return 0; +} diff -r dbd70772322c -r 0ec031961882 TaskManager/Test/test_render/task/Switch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/Test/test_render/task/Switch.h Wed Sep 23 20:57:55 2009 +0900 @@ -0,0 +1,12 @@ +#ifndef INCLUDED_TASK_SWITCH +#define INCLUDED_TASK_SWITCH + +#include "SchedTask.h" + +class Switch : public SchedTask { +public: + SchedConstructor(Switch); + int run(void *rbuf, void *wbuf); +}; + +#endif diff -r dbd70772322c -r 0ec031961882 TaskManager/Test/test_render/task/task_init.cc --- a/TaskManager/Test/test_render/task/task_init.cc Wed Sep 23 17:10:10 2009 +0900 +++ b/TaskManager/Test/test_render/task/task_init.cc Wed Sep 23 20:57:55 2009 +0900 @@ -22,6 +22,7 @@ SchedExternTask(ShowTime); SchedExternTask(SendKey); SchedExternTask(ChainMove); +SchedExternTask(Switch); /** @@ -50,6 +51,7 @@ SchedRegisterTask(SEND_KEY, SendKey); SchedRegisterTask(SHOW_TIME, ShowTime); + SchedRegisterTask(TASK_SWITCH, Switch); // usr SchedRegisterTask(CHAIN_MOVE, ChainMove); diff -r dbd70772322c -r 0ec031961882 TaskManager/Test/test_render/viewer.cc --- a/TaskManager/Test/test_render/viewer.cc Wed Sep 23 17:10:10 2009 +0900 +++ b/TaskManager/Test/test_render/viewer.cc Wed Sep 23 20:57:55 2009 +0900 @@ -25,7 +25,7 @@ int frames; SceneGraphRootPtr sgroot; -//SceneGraphRootPtr sgroot_2; +SceneGraphRootPtr sgroot_2; /* Data Pack sent to Other CPUs (ex. SPE) */ SceneGraphPack *sgpack; @@ -115,7 +115,7 @@ frames = 0; sgroot = new SceneGraphRoot(this->width, this->height); - //sgroot_2 = new SceneGraphRoot(this->width, this->height); + sgroot_2 = new SceneGraphRoot(this->width, this->height); //sgroot->createFromXMLFile(xml); switch (sg_number) { @@ -168,6 +168,8 @@ break; case 17: chain_old_init(manager, this->width, this-> height); + speLoop(); + return; break; default: node_init(manager); @@ -240,9 +242,11 @@ // TASK_INIT_TEXTURE が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ /* test */ + HTaskPtr task_switch = manager->create_task(TASK_SWITCH); task_switch->wait_for(task_next); task_switch->set_post(post2runMoveDrawLoop, (void*)this); + task_switch->spawn(); } @@ -306,8 +310,8 @@ rendering(task_next); } + */ - void Viewer::mainLoop() { @@ -537,6 +541,6 @@ } delete sgroot; - //delete sgroot_2; + delete sgroot_2; quit(); }