Mercurial > hg > Game > Cerium
changeset 415:0ec031961882 draft
SceneGraph switch add
author | tkaito@henri.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Wed, 23 Sep 2009 20:57:55 +0900 |
parents | dbd70772322c |
children | a10f5322d262 |
files | TaskManager/Test/test_render/SceneGraphRoot.h TaskManager/Test/test_render/task/Switch.cc TaskManager/Test/test_render/task/Switch.h TaskManager/Test/test_render/task/task_init.cc TaskManager/Test/test_render/viewer.cc |
diffstat | 5 files changed, 41 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- /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 <stdlib.h> +#include <string.h> +#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; +}
--- /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
--- 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);
--- 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(); }