annotate Renderer/Engine/SgChange.cc @ 1319:31455d34e502 draft

collada file reader minor changes.
author Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp>
date Sun, 18 Dec 2011 09:39:14 +0900
parents 5664473b4dba
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
1 #include <SDL.h>
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
2 #include "SgChange.h"
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
3 #include "viewer_types.h"
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
4 #include "SceneGraph.h"
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
5 #include "SceneGraphRoot.h"
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
6 #include "scene_graph_pack.h"
1050
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 986
diff changeset
7 #include "matrix_calc.h"
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
8 #include "Func.h"
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
9 #include "error.h"
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
10 #include "TaskManager.h"
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
11 #include <wchar.h>
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
12 #include "Pad.h"
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
13 #include "Application.h"
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
14 #include "lindaapi.h"
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
15
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
16 static void post2runLoop(SchedTask *s, void *viewer, void *s1);
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
17 static void post2run(SchedTask *s, void *viewer, void *s1);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
18 static void post2runDraw(SchedTask *s, void *viewer, void *s1);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
19 static void post2rendering(SchedTask *s, void *viewer, void *s1);
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
20
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
21 /* measure for FPS (Frame Per Second) */
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
22 extern int start_time;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
23 extern int this_time;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
24 extern int frames;
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
25
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
26 /* Data Pack sent to Other CPUs (ex. SPE) */
1160
Yutaka_Kinjyo
parents: 1143
diff changeset
27 extern RenderingData r[2];
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
28
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
29 void
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
30 SgChange::run_init()
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
31 {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
32 int width = viewer->width;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
33 int height = viewer->height;
1143
786e800abfb4 minor fix
Yutaka_Kinjyo
parents: 1131
diff changeset
34 sgroot_A = new SceneGraphRoot(width, height, manager);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
35 sgroot_A->tmanager = viewer->manager;
1143
786e800abfb4 minor fix
Yutaka_Kinjyo
parents: 1131
diff changeset
36 sgroot_B = new SceneGraphRoot(width, height, manager);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
37 sgroot_B->tmanager = viewer->manager;
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
38 }
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
39
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
40 HTaskPtr
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
41 SgChange::initLoop()
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
42 {
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
43 return viewer->initLoop();
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
44 }
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
45
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
46 void
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
47 SgChange::mainLoop()
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
48 {
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
49 HTaskPtr task_next = initLoop();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
50
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
51 task_next->set_post(&post2run, (void *)this, 0);
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
52 task_next->spawn();
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
53 }
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
54
680
4f7512038ced Test/SgRootChange not work
hiroki@localhost.localdomain
parents: 653
diff changeset
55
4f7512038ced Test/SgRootChange not work
hiroki@localhost.localdomain
parents: 653
diff changeset
56
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
57 static void
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
58 post2run(SchedTask *s, void *sgchange_, void *arg)
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
59 {
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
60 SgChange *sgchange = (SgChange*)sgchange_;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
61 HTaskPtr task_next = sgchange->manager->create_task(Dummy);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
62 sgchange->run_loop(task_next);
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
63 psx_sync_n();
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
64 }
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
65
781
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
66 static void
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
67 post2runLoop(SchedTask *s, void *sgchange_, void *arg)
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
68 {
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
69 SgChange *sgchange = (SgChange*)sgchange_;
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
70 HTaskPtr task_next = sgchange->manager->create_task(Dummy);
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
71 sgchange->viewer->light_xyz_stock = sgchange->sgroot_A->getLightVector();
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
72 sgchange->pass_draw_tree();
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
73 sgchange->run_loop(task_next);
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
74
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
75 psx_sync_n();
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
76 }
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
77
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
78
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
79 void
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
80 SgChange::pass_draw_tree()
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
81 {
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
82 sgroot_B->sg_draw_tree = sgroot_A->sg_exec_tree;
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
83 }
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
84
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
85 void
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
86 SgChange::run_loop(HTaskPtr task_next)
781
836ca3419f9d working on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 779
diff changeset
87 {
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
88 viewer->dev->clear_screen();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
89
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
90 bool quit_flg;
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
91 quit_flg = viewer->quit_check();
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
92 if (quit_flg == true) {
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 801
diff changeset
93 // this_time = viewer->get_ticks();
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
94 viewer->run_finish();
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
95 return;
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
96 }
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
97
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
98 viewer->dev->clean_pixels();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
99
986
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 801
diff changeset
100 for (int i = 1; i <= r[spi].spackList_length; i++) {
b3a8545eb2fa double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents: 801
diff changeset
101 r[spi].spackList[i-1].reinit(i*split_screen_h);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
102 }
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
103
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
104 sgroot_A->updateControllerState();
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
105
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
106 HTaskPtr loop_task = manager->create_task(Dummy);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
107 loop_task->set_post(post2runLoop, (void *)this, 0);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
108
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
109 HTaskPtr draw_task = manager->create_task(Dummy);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
110 draw_task->set_post(post2rendering, (void *)this, 0);
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
111
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
112 /*
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
113 application 側で sgroot に task を生成登録する
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
114 引数を渡したりは後でやる。
762
d77fe7cfad19 Test/create_task.cc work
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
115 登録された関数を実行して task を生成登録する。
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
116 */
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
117 sgroot_A->regist_execute();
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
118
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
119 //HTaskPtr move_task = manager->create_task(RunMove);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
120 HTaskPtr move_task = manager->create_task(ExecMove);
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
121 move_task->set_param(0, (memaddr)this);
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
122 move_task->set_param(1, viewer->width);
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
123 move_task->set_param(2, viewer->height);
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
124
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
125 /*
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
126 TTaskPtr move_finish = manager->create_task(Dummy);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
127 loop_task->wait_for(move_finish);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
128 move_finish は app の move_task の post_func で実行させてやる
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
129 */
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
130
762
d77fe7cfad19 Test/create_task.cc work
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
131 /*
d77fe7cfad19 Test/create_task.cc work
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
132 描画終了確認用のダミータスク
d77fe7cfad19 Test/create_task.cc work
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
133 描画の最後で spwan させる
d77fe7cfad19 Test/create_task.cc work
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
134 */
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
135 HTaskPtr dummy_task = manager->create_task(Dummy);
715
8397aa75c902 not work SgChange
hiroki@localhost.localdomain
parents: 682
diff changeset
136
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
137 draw_finish = dummy_task;
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
138
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
139 loop_task->wait_for(draw_finish);
759
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
140 // move_task に wait_for ではなく sgroot_A->move_exec_task に wait_for するべき
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
141 // どこかで move_exec_task->spawn() しないとな
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
142 loop_task->wait_for(sgroot_A->move_exec_task);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
143
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
144 //loop_task->wait_for(move_task);
45f7ab7101ea first of all commit, not work Rendering/Test/create_task
hiroki
parents: 758
diff changeset
145
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
146
751
1666dba6f6d9 rendering, move_coll parallel running
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 747
diff changeset
147 draw_task->spawn();
758
77f936380930 fix create_task
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 751
diff changeset
148 // この時点で app の task_id を知っていないとダメか
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
149 move_task->spawn();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
150 loop_task->spawn();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
151 }
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
152
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
153 static void
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
154 post2rendering(SchedTask *s, void *sgchange_, void *arg)
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
155 {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
156 SgChange *sgchange = (SgChange *)sgchange_;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
157 HTaskPtr task_next = sgchange->manager->create_task(Dummy);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
158 sgchange->rendering(task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
159
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
160 }
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
161
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
162 void
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
163 SgChange::rendering(HTaskPtr task_next)
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
164 {
1131
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1050
diff changeset
165 viewer->rendering_pp(task_next, sgroot_B);
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1050
diff changeset
166 viewer->rendering_sp(task_next, sgroot_B);
220f9032d2d2 RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents: 1050
diff changeset
167
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
168 task_next->set_post(post2runDraw, (void*)this, 0);
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
169 task_next->spawn();
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
170 }
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
171
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
172
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
173 static void
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
174 post2runDraw(SchedTask *s, void *sgchange_, void *arg)
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
175 {
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
176 SgChange *sgchange = (SgChange *)sgchange_;
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
177 HTaskPtr task_next = sgchange->manager->create_task(Dummy);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
178 sgchange->run_draw(task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
179 }
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
180
747
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
181 void
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
182 SgChange::run_draw(HTaskPtr task_next) // 引数に post2runLoop を入れるようにする
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
183 {
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
184 viewer->common_draw(task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
185
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
186 this->draw_finish->wait_for(task_next);
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
187 task_next->spawn();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
188 this->draw_finish->spawn();
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
189
18d31d18a6b2 TaskManager changeset 683, Renderer changeset 746
hiroki
parents: 653
diff changeset
190 frames++;
653
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
191 }
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
192
7a311860a76e remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
diff changeset
193 /* end */