annotate TaskManager/Test/test_render/viewer.cc @ 421:6094dfd1f08c draft

comment
author game@henri.cr.ie.u-ryukyu.ac.jp
date Thu, 24 Sep 2009 12:35:32 +0900
parents a3ef5c15edac
children 217258e3d148
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
1 #include <SDL.h>
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
2 #include "viewer.h"
120
13b43de5ef5d fix Load Texture
gongo@gendarme.local
parents: 109
diff changeset
3 #include "viewer_types.h"
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
4 #include "SceneGraph.h"
195
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 194
diff changeset
5 #include "SceneGraphRoot.h"
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
6 #include "scene_graph_pack.h"
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
7 #include "sys.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
8 #include "Func.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
9 #include "error.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
10 #include "TaskManager.h"
212
gongo@localhost.localdomain
parents: 210
diff changeset
11 #include <wchar.h>
221
0b0e0f323742 Cameraの設定、Makefile 修正
gongo@gendarme.local
parents: 219
diff changeset
12 #include "Pad.h"
212
gongo@localhost.localdomain
parents: 210
diff changeset
13
408
28f96e039c11 add Move, Draw, ChainMove
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 407
diff changeset
14 static void post2runLoop(void *viewer);
28f96e039c11 add Move, Draw, ChainMove
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 407
diff changeset
15 static void post2runDraw(void *viewer);
28f96e039c11 add Move, Draw, ChainMove
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 407
diff changeset
16 static void post2speRunLoop(void *viewer);
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
17 //static void post2runMove(void *viewer);
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
18 //static void post2exchange_sgroot(void *viewer);
408
28f96e039c11 add Move, Draw, ChainMove
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 407
diff changeset
19 static void post2speRunLoop(void *viewer);
28f96e039c11 add Move, Draw, ChainMove
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 407
diff changeset
20 static void post2runMoveDrawLoop(void *viewer);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
21
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
22 /* measure for FPS (Frame Per Second) */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
23 int start_time;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
24 int this_time;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
25 int frames;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
26
198
b832e6cff83e rename snake_bg to panel
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 195
diff changeset
27 SceneGraphRootPtr sgroot;
415
0ec031961882 SceneGraph switch add
tkaito@henri.cr.ie.u-ryukyu.ac.jp
parents: 412
diff changeset
28 SceneGraphRootPtr sgroot_2;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
29
176
gongo@localhost.localdomain
parents: 170
diff changeset
30 /* Data Pack sent to Other CPUs (ex. SPE) */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31 SceneGraphPack *sgpack;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
32 PolygonPack *ppack;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
33 SpanPackPtr spackList;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
34 SpanPackPtr *spackList_ptr;
210
e75f9eb97180 fix DrawSpan
gongo@localhost.localdomain
parents: 205
diff changeset
35
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
36 int spackList_length;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
37 int spackList_length_align;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
38
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
39 /**
176
gongo@localhost.localdomain
parents: 170
diff changeset
40 *
gongo@localhost.localdomain
parents: 170
diff changeset
41 */
gongo@localhost.localdomain
parents: 170
diff changeset
42
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
43 Viewer::Viewer(int b, int w, int h, int _num)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
44 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
45 bpp = b;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
46 width = w;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
47 height = h;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
48 spe_num = _num;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
49 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
50
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
51 int
229
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
52 Viewer::get_ticks(void)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
53 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
54 int time;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
55 time = SDL_GetTicks();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
56 return time;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
57 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
58
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
59 bool
229
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
60 Viewer::quit_check(void)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
61 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
62 SDL_Event event;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
63
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
64 while(SDL_PollEvent(&event)) {
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
65 if (event.type==SDL_QUIT) {
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
66 return true;
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
67 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
68 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
69
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
70 Uint8 *keys=SDL_GetKeyState(NULL);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
71
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
72 if (keys[SDLK_q] == SDL_PRESSED) {
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
73 return true;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
74 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
75
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
76 return false;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
77 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
78
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
79 void
229
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
80 Viewer::quit(void)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
81 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
82 SDL_Quit();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
83 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
84
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
85 void
229
e6eb4f8d6b0e add Random class
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 222
diff changeset
86 Viewer::swap_buffers(void)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
87 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
88 SDL_GL_SwapBuffers();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
89 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
90
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
91 extern void node_init(TaskManager *manager);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
92 extern void create_cube_split(TaskManager *manager, int);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
93 extern void panel_init(TaskManager *manager, int bg);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
94 extern void universe_init(TaskManager *manager);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
95 extern void ieshoot_init(TaskManager *manager);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
96 extern void ball_bound_init(TaskManager *manager, int, int);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
97 extern void lcube_init(TaskManager *manager, int, int);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
98 extern void direction_init(TaskManager *manager);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
99 extern void init_position(TaskManager *manager, int, int);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
100 extern void vacuum_init(TaskManager *manager, int w, int h);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
101 extern void untitled_init(TaskManager *manager);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
102 extern void chain_init(TaskManager *manager, int w, int h);
412
dbd70772322c chain_old.cc add (Application/)
tkaito@henri.cr.ie.u-ryukyu.ac.jp
parents: 408
diff changeset
103 extern void chain_old_init(TaskManager *manager, int w, int h);
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
104 extern void boss1_init(TaskManager *manager, int w, int h);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
105 extern void init_gaplant(TaskManager *manager, int w, int h);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
106 extern void vacuum_init2(TaskManager *manager, int w, int h);
323
a65430fb7790 add gaplant
aaa
parents: 321
diff changeset
107
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
108 void
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
109 Viewer::run_init(TaskManager *manager, const char *xml, int sg_number)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
110 {
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
111 this->manager = manager;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
112
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
113 start_time = get_ticks();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
114 this_time = 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
115 frames = 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
116
221
0b0e0f323742 Cameraの設定、Makefile 修正
gongo@gendarme.local
parents: 219
diff changeset
117 sgroot = new SceneGraphRoot(this->width, this->height);
415
0ec031961882 SceneGraph switch add
tkaito@henri.cr.ie.u-ryukyu.ac.jp
parents: 412
diff changeset
118 sgroot_2 = new SceneGraphRoot(this->width, this->height);
195
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 194
diff changeset
119 //sgroot->createFromXMLFile(xml);
421
6094dfd1f08c comment
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 419
diff changeset
120 // ここの switch は application->init(this, manager, sg_no); になるべき
144
gongo@localhost.localdomain
parents: 143
diff changeset
121 switch (sg_number) {
gongo@localhost.localdomain
parents: 143
diff changeset
122 case 0:
gongo@localhost.localdomain
parents: 143
diff changeset
123 case 1:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
124 create_cube_split(manager, sg_number);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
125 break;
144
gongo@localhost.localdomain
parents: 143
diff changeset
126 case 2:
153
70146cdec3d4 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 150
diff changeset
127 case 3:
70146cdec3d4 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 150
diff changeset
128 case 4:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
129 panel_init(manager, sg_number);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
130 break;
153
70146cdec3d4 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 150
diff changeset
131 case 5:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
132 universe_init(manager);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
133 break;
158
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 157
diff changeset
134 case 6:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
135 ieshoot_init(manager);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
136 break;
210
e75f9eb97180 fix DrawSpan
gongo@localhost.localdomain
parents: 205
diff changeset
137 case 7:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
138 ball_bound_init(manager, this->width, this->height);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
139 break;
212
gongo@localhost.localdomain
parents: 210
diff changeset
140 case 8:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
141 lcube_init(manager, this->width, this->height);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
142 break;
212
gongo@localhost.localdomain
parents: 210
diff changeset
143 case 9:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
144 direction_init(manager);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
145 break;
213
8ac35507094d add SceneGraph "3D Super-Dandy"
gongo@localhost.localdomain
parents: 212
diff changeset
146 case 10:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
147 init_position(manager, this->width, this->height);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
148 break;
222
gongo@localhost.localdomain
parents: 221
diff changeset
149 case 11:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
150 // vacuum_init(manager, this->width, this->height);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
151 break;
231
5ae15a5d3dc5 test program add (-sg 12)
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents: 229
diff changeset
152 case 12:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
153 untitled_init(manager);
231
5ae15a5d3dc5 test program add (-sg 12)
tkaito@nw0534.st.ie.u-ryukyu.ac.jp
parents: 229
diff changeset
154 break;
321
f22280772f20 merge 317
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 318
diff changeset
155 case 13:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
156 boss1_init(manager, this->width, this->height);
378
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
157 break;
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
158 case 14:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
159 init_gaplant(manager, this->width, this->height);
378
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
160 break;
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
161 case 15:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
162 vacuum_init2(manager, this->width, this->height);
378
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
163 break;
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
164 case 16:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
165 chain_init(manager, this->width, this-> height);
398
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
166 speLoop();
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
167 return;
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
168 break;
412
dbd70772322c chain_old.cc add (Application/)
tkaito@henri.cr.ie.u-ryukyu.ac.jp
parents: 408
diff changeset
169 case 17:
dbd70772322c chain_old.cc add (Application/)
tkaito@henri.cr.ie.u-ryukyu.ac.jp
parents: 408
diff changeset
170 chain_old_init(manager, this->width, this-> height);
dbd70772322c chain_old.cc add (Application/)
tkaito@henri.cr.ie.u-ryukyu.ac.jp
parents: 408
diff changeset
171 break;
144
gongo@localhost.localdomain
parents: 143
diff changeset
172 default:
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
173 node_init(manager);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
174 break;
398
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
175 }
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
176
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
177 mainLoop();
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
178 }
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
179
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
180
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
181 HTaskPtr
398
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
182 Viewer::initLoop()
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
183 {
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
184 HTaskPtr task_next;
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
185 HTaskPtr task_tex;
142
dc68420f705f add xml
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 140
diff changeset
186
217
gongo@localhost.localdomain
parents: 213
diff changeset
187 sgpack = (SceneGraphPack*)manager->allocate(sizeof(SceneGraphPack));
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
188 sgpack->init();
217
gongo@localhost.localdomain
parents: 213
diff changeset
189 ppack = (PolygonPack*)manager->allocate(sizeof(PolygonPack));
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
190
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
191 spackList_length = (this->height + split_screen_h - 1) / split_screen_h;
217
gongo@localhost.localdomain
parents: 213
diff changeset
192 spackList = (SpanPack*)manager->allocate(sizeof(SpanPack)*spackList_length);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
193
176
gongo@localhost.localdomain
parents: 170
diff changeset
194 /**
gongo@localhost.localdomain
parents: 170
diff changeset
195 * SPU に送る address list は 16 バイト倍数でないといけない。
gongo@localhost.localdomain
parents: 170
diff changeset
196 * spackList_length*sizeof(SpanPack*) が 16 バイト倍数になるような
gongo@localhost.localdomain
parents: 170
diff changeset
197 * length_align を求めている。はみ出した部分は使われない
gongo@localhost.localdomain
parents: 170
diff changeset
198 * (ex) spackList_length が 13 の場合
gongo@localhost.localdomain
parents: 170
diff changeset
199 * spackList_length_align = 16;
gongo@localhost.localdomain
parents: 170
diff changeset
200 * 実際に送るデータは64バイトになるのでOK
gongo@localhost.localdomain
parents: 170
diff changeset
201 * 14,15,16 の部分は何も入らない。
gongo@localhost.localdomain
parents: 170
diff changeset
202 */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
203 spackList_length_align = (spackList_length + 3)&(~3);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
204
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
205 /* 各 SPU が持つ、SpanPack の address list */
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 158
diff changeset
206 spackList_ptr =
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
207 (SpanPack**)manager->allocate(sizeof(SpanPack*)*spackList_length_align);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
208
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
209 for (int i = 0; i < spackList_length; i++) {
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
210 spackList_ptr[i] = &spackList[i];
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
211 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
212
126
74d0a70f60e9 fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 123
diff changeset
213 for (int i = 1; i <= spackList_length; i++) {
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
214 spackList[i-1].init(i*split_screen_h);
126
74d0a70f60e9 fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 123
diff changeset
215 }
74d0a70f60e9 fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 123
diff changeset
216
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
217 task_next = manager->create_task(TASK_DUMMY);
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
218
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 158
diff changeset
219 for (int i = 0; i < spe_num; i++) {
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
220 task_tex = manager->create_task(TASK_INIT_TEXTURE);
378
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
221 /*
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
222 * ここはもう少しわかりやすい使い方がいいかもしれぬ。こんなもん?
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
223 */
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
224 task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i));
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
225 task_next->wait_for(task_tex);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
226 task_tex->spawn();
120
13b43de5ef5d fix Load Texture
gongo@gendarme.local
parents: 109
diff changeset
227 }
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
228
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
229 return task_next;
398
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
230 }
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
231
417
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
232 /* Loop って言っても1回しか実行されない */
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
233 void
398
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
234 Viewer::speLoop()
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
235 {
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
236 HTaskPtr task_next = initLoop();
417
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
237 // key の情報を格納する領域を確保する (global_alloc(KEY_STATUS))
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
238 HTaskPtr init_key_task = manager->create_task(INIT_KEY_TASK);
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
239 init_key_task->spawn();
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
240
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
241 // SPE に送信する KEY_STATUS の領域確保
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
242 key_stat *key = (key_stat*)manager->allocate(sizeof(key_stat));
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
243 this->keyPtr = key;
398
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
244
406
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
245 // post2runLoop は旧バージョン用なので post2speRunLoop の様なものを別につくるべき
421
6094dfd1f08c comment
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 419
diff changeset
246 //task_next->set_post(post2speRunLoop, (void*)this); // set_post(function(this->run_loop()), NULL)
6094dfd1f08c comment
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 419
diff changeset
247 //task_next->spawn();
398
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
248 // TASK_INIT_TEXTURE が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ
406
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
249
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
250 /* test */
415
0ec031961882 SceneGraph switch add
tkaito@henri.cr.ie.u-ryukyu.ac.jp
parents: 412
diff changeset
251
406
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
252 HTaskPtr task_switch = manager->create_task(TASK_SWITCH);
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
253 task_switch->wait_for(task_next);
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
254 task_switch->set_post(post2runMoveDrawLoop, (void*)this);
415
0ec031961882 SceneGraph switch add
tkaito@henri.cr.ie.u-ryukyu.ac.jp
parents: 412
diff changeset
255 task_switch->spawn();
406
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
256 }
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
257
417
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
258 void
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
259 Viewer::getKey()
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
260 {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
261 Pad *pad = sgroot->getController();
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
262 if (pad->right.isHold()) {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
263 keyPtr->right = HOLD;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
264 } else if (pad->right.isPush()) {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
265 keyPtr->right = PUSH;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
266 } else {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
267 keyPtr->right = NONE;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
268 }
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
269
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
270 if (pad->left.isHold()) {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
271 keyPtr->left = HOLD;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
272 } else if (pad->left.isPush()) {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
273 keyPtr->left = PUSH;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
274 } else {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
275 keyPtr->left = NONE;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
276 }
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
277
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
278 if (pad->up.isHold()) {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
279 keyPtr->up = HOLD;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
280 } else if (pad->up.isPush()) {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
281 keyPtr->up = PUSH;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
282 } else {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
283 keyPtr->up = NONE;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
284 }
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
285
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
286 if (pad->down.isHold()) {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
287 keyPtr->down = HOLD;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
288 } else if (pad->down.isPush()) {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
289 keyPtr->down = PUSH;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
290 } else {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
291 keyPtr->down = NONE;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
292 }
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
293
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
294 if (pad->circle.isHold()) {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
295 keyPtr->circle = HOLD;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
296 } else if (pad->circle.isPush()) {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
297 keyPtr->circle = PUSH;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
298 } else {
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
299 keyPtr->circle = NONE;
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
300 }
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
301 }
406
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
302
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
303 static void
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
304 post2runMoveDrawLoop(void *viewer_)
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
305 {
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
306 Viewer *viewer = (Viewer*)viewer_;
417
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
307
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
308 // 同じ PPE 上なので sgroot(ポインタ) を add_param で送る。
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
309 //HTaskPtr send_key_task = viewer->manager->create_task(SEND_KEY);
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
310 //send_key_task->add_param((int)sgroot);
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
311 // set input data -> viewer keyPtr
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
312 viewer->getKey();
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
313 HTaskPtr update_key = viewer->manager->create_task(UPDATE_KEY);
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
314 update_key->add_inData(viewer->keyPtr, sizeof(key_stat));
0e62e80fc039 add key
Hiroki NAKASONE <hiroki@cr.ie.u-ryukyu.ac.jp>
parents: 408
diff changeset
315 update_key->spawn();
406
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
316
421
6094dfd1f08c comment
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 419
diff changeset
317 /* TASK_MOVE は外から引数で取ってくるべき */
6094dfd1f08c comment
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 419
diff changeset
318 HTaskPtr move_task = viewer->manager->create_task(viewer->move_taskid);
408
28f96e039c11 add Move, Draw, ChainMove
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 407
diff changeset
319 //move_task->add_param(sgroot);
406
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
320
408
28f96e039c11 add Move, Draw, ChainMove
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 407
diff changeset
321 HTaskPtr draw_task = viewer->manager->create_task(TASK_DRAW);
406
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
322
408
28f96e039c11 add Move, Draw, ChainMove
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 407
diff changeset
323 HTaskPtr switch_task = viewer->manager->create_task(TASK_SWITCH);
421
6094dfd1f08c comment
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 419
diff changeset
324
406
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
325 switch_task->wait_for(move_task);
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
326 switch_task->wait_for(draw_task);
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
327 move_task->spawn();
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
328 draw_task->spawn();
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
329
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
330 switch_task->set_post(post2runMoveDrawLoop, (void*)viewer);
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
331 switch_task->spawn();
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
332
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
333 }
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
334
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
335 static void
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
336 post2speRunLoop(void *viewer_)
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
337 {
408
28f96e039c11 add Move, Draw, ChainMove
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 407
diff changeset
338 Viewer *viewer = (Viewer *)viewer_;
406
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
339 HTaskPtr task_next = viewer->manager->create_task(TASK_DUMMY);
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
340 viewer->run_move(task_next);
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
341 }
da48fe13a459 add task/SendKey
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 401
diff changeset
342
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
343 void
398
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
344 Viewer::mainLoop()
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
345 {
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
346 HTaskPtr task_next = initLoop();
120
13b43de5ef5d fix Load Texture
gongo@gendarme.local
parents: 109
diff changeset
347
401
222fc81fff47 fix viewer.cpp
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 399
diff changeset
348 task_next->set_post(&post2runLoop, (void *)this); // set_post(function(this->run_loop()), NULL)
378
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
349 task_next->spawn();
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
350 }
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
351
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
352 static void
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
353 post2runMove(void *viewer_)
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
354 {
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
355 Viewer *viewer = (Viewer*)viewer_;
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
356 HTaskPtr task_next = viewer->manager->create_task(TASK_DUMMY);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
357 viewer->run_move(task_next);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
358 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
359
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
360 void
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
361 Viewer::run_move(HTaskPtr task_next)
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
362 {
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
363 sgroot->updateControllerState();
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
364 sgroot->allExecute(width, height);
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
365 }
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
366
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
367 void
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
368 Viewer::run_collision()
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
369 {
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
370 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
371
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
372 void
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
373 Viewer::rendering(HTaskPtr task_next)
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
374 {
401
222fc81fff47 fix viewer.cpp
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 399
diff changeset
375 HTaskPtr task_create_pp = manager->create_task(TASK_CREATE_PP2);
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
376
157
gongo@henri.cr.ie.u-ryukyu.ac.jp
parents: 155
diff changeset
377 // SceneGraph(木構造) -> PolygonPack
401
222fc81fff47 fix viewer.cpp
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 399
diff changeset
378
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
379 task_create_pp->add_param((uint32)sgroot->getDrawSceneGraph());
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
380 task_create_pp->add_param((uint32)ppack);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
381
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
382 task_next->wait_for(task_create_pp);
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
383
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
384 int range_base = spe_num;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
385 // 切り上げのつもり
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
386 int range = (spackList_length + range_base - 1) / range_base;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
387
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
388 for (int i = 0; i < range_base; i++) {
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
389 int index_start = range*i;
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
390 int index_end = (index_start + range >= spackList_length)
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
391 ? spackList_length : index_start + range;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
392
401
222fc81fff47 fix viewer.cpp
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 399
diff changeset
393 HTaskPtr task_create_sp = manager->create_task(TASK_CREATE_SPAN);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
394 task_create_sp->add_inData(ppack, sizeof(PolygonPack));
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
395 task_create_sp->add_inData(spackList_ptr,
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
396 sizeof(SpanPack*)*spackList_length_align);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
397 task_create_sp->add_inData(&spackList[index_start], sizeof(SpanPack));
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
398
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
399 task_create_sp->add_param(index_start);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
400
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
401 /**
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
402 * ex. screen_height が 480, spenum が 6 の場合、各SPEのy担当範囲
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
403 * [ 1.. 80] [ 81..160] [161..240]
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
404 * [241..320] [321..400] [401..480]
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
405 *
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
406 * ex. screen_height が 1080, spenum が 5 の場合、
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
407 * [ 1..216] [217..432] [433..648]
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
408 * [649..864] [865..1080]
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
409 */
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
410 task_create_sp->add_param(index_start*split_screen_h + 1);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
411 task_create_sp->add_param(index_end*split_screen_h);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
412
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
413 task_next->wait_for(task_create_sp);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
414 task_create_sp->wait_for(task_create_pp);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
415
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
416 task_create_sp->set_cpu(SPE_ANY);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
417 task_create_sp->spawn();
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
418 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
419
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
420 task_create_pp->spawn();
378
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
421
244
e9735a64cd90 mail modify
e065746@localhost.localdomain
parents: 231
diff changeset
422 // Barrier 同期
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
423 // run_draw() を呼ぶ post2runDraw
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
424 task_next->set_post(post2runDraw, (void*)this); // set_post(function(this->run_draw()), NULL)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
425 task_next->spawn();
401
222fc81fff47 fix viewer.cpp
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 399
diff changeset
426
378
bdeb7a73285b test_nogl not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 376
diff changeset
427 // TASK_CREATE_SPAN が全て終わったら DUMMY_TASK が Viewer::run_draw() を呼ぶ
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
428 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
429
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
430 static void
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
431 post2runLoop(void *viewer_)
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
432 {
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
433 Viewer *viewer = (Viewer*)viewer_;
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
434 HTaskPtr task_next = viewer->manager->create_task(TASK_DUMMY);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
435 viewer->run_loop(task_next);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
436
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
437 }
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
438
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
439 void
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
440 Viewer::run_loop(HTaskPtr task_next)
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
441 {
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
442 bool quit_flg;
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
443 quit_flg = quit_check();
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
444 if (quit_flg == true) {
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
445 this_time = get_ticks();
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
446 run_finish();
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
447 return;
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
448 }
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
449
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
450 clean_pixels();
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
451
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
452 for (int i = 1; i <= spackList_length; i++) {
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
453 spackList[i-1].reinit(i*split_screen_h);
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
454 }
398
fce889e94547 separate existing source
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 397
diff changeset
455
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
456 //run_move(task_next);
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
457 sgroot->updateControllerState();
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
458 sgroot->allExecute(width, height);
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
459 //sgroot->checkRemove();
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
460
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
461 // ここから下は Rendering という関数にする
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
462 rendering(task_next);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
463 }
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
464
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
465 static void
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
466 post2runDraw(void *viewer_)
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
467 {
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
468 Viewer *viewer = (Viewer*)viewer_;
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
469 HTaskPtr task_next = viewer->manager->create_task(TASK_DUMMY);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
470 viewer->run_draw(task_next);
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
471
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
472 }
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
473
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
474 void
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
475 Viewer::run_draw(HTaskPtr task_next) // 引数に post2runLoop を入れるようにする
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
476 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
477 HTaskPtr task_draw;
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
478
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
479 //task_next = manager->create_task(TASK_DUMMY);
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
480 //task_next->set_post(post2runLoop, (void*)this);
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
481
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
482 ppack->clear();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
483 for (int i = 0; i < spackList_length; i++) {
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
484 SpanPack *spack = &spackList[i];
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
485 int startx = 1;
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
486 int endx = split_screen_w;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
487
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
488 int starty = spack->info.y_top - split_screen_h + 1;
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
489 //int endy = spack->info.y_top;
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
490 int rangey = (starty + split_screen_h - 1 > this->height)
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
491 ? this->height - starty + 1 : split_screen_h;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
492
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
493 while (startx < this->width) {
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
494 if (spack->info.size > 0) {
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
495 // Draw SpanPack
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
496 task_draw = manager->create_task(TASK_DRAW_SPAN);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
497 task_draw->add_inData(spack, sizeof(SpanPack));
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
498
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
499 task_draw->add_param(
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
500 (uint32)&pixels[(startx-1) + this->width*(starty-1)]);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
501 task_draw->add_param(this->width);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
502 } else {
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
503 memset(&pixels[(startx-1)+this->width*(starty-1)],
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
504 0, (this->width)*sizeof(int)*rangey);
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
505 break;
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
506 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
507
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
508 task_draw->add_param(startx);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
509 task_draw->add_param(endx);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
510 task_draw->add_param(rangey);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
511 task_draw->set_cpu(SPE_ANY);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
512 task_next->wait_for(task_draw);
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
513 task_draw->spawn();
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
514
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
515 startx += split_screen_w;
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
516 endx += split_screen_w;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
517
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
518 if (endx > this->width) {
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
519 endx = this->width;
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
520 }
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
521 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
522 }
396
0b623693e6ec don't move. separate allExecute from run_loop
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 378
diff changeset
523
397
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
524
ce86b0186a4a delete manager (in kernel/ppe/TaskManager.h)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 396
diff changeset
525 task_next->set_post(post2runLoop, (void*)this); // set_post(function(this->run_loop()), NULL)
399
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
526 task_next->spawn();
943174e92f22 fix viewer.cc (run_loop)
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 398
diff changeset
527 // TASK_DRAW_SPAN が全て終わったら DUMMY_TASK が Viewer::run_loop() を呼ぶ
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
528
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
529 frames++;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
530 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
531
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
532 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
533 Viewer::run_finish(void)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
534 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
535 if (this_time != start_time) {
374
4fad8f9329ac CHAIN ADDED
kazz@kazzone.ie.u-ryukyu.ac.jp
parents: 231
diff changeset
536 printf("%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
537 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
538
219
335ea3665fcd allExecute する度に SceneGraph をコピーしていく様に変更
gongo@gendarme.local
parents: 217
diff changeset
539 delete sgroot;
415
0ec031961882 SceneGraph switch add
tkaito@henri.cr.ie.u-ryukyu.ac.jp
parents: 412
diff changeset
540 delete sgroot_2;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
541 quit();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
542 }
421
6094dfd1f08c comment
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 419
diff changeset
543
6094dfd1f08c comment
game@henri.cr.ie.u-ryukyu.ac.jp
parents: 419
diff changeset
544 /* end */