annotate TaskManager/Test/test_render/viewer.cpp @ 268:2b7d631695ca draft

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 04 Jun 2009 00:00:09 +0900
parents e3b7776b1420 943c2ebe4483
children abf96b4caee5
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"
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
5 #include "scene_graph_pack.h"
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
6 #include "sys.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
7 #include "Func.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
8 #include "error.h"
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
9 #include "TaskManager.h"
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
10 #include "Keyboard.h"
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
11 #include "Joystick.h"
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
12
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
13 extern void post2runLoop(void *);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
14 extern void post2runDraw(void *);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
15
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
16 /* measure for FPS (Frame Per Second) */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
17 int start_time;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
18 int this_time;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
19 int frames;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
20
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
21 extern SceneGraphPtr scene_graph;
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
22 extern SceneGraphPtr scene_graph_viewer;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
23
176
gongo@localhost.localdomain
parents: 170
diff changeset
24 /* Data Pack sent to Other CPUs (ex. SPE) */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
25 SceneGraphPack *sgpack;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
26 PolygonPack *ppack;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
27 SpanPackPtr spackList;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
28 SpanPackPtr *spackList_ptr;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
29 int spackList_length;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
30 int spackList_length_align;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
31
177
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
32 static float *zRow;
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
33
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
34 /**
176
gongo@localhost.localdomain
parents: 170
diff changeset
35 *
gongo@localhost.localdomain
parents: 170
diff changeset
36 */
gongo@localhost.localdomain
parents: 170
diff changeset
37
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
38 /**
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
39 * Joystick があればそれを使い、
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
40 * 無ければキーボードを返す
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
41 */
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
42 static Pad*
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
43 create_controller(void)
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
44 {
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
45 if (SDL_NumJoysticks()) {
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
46 SDL_Joystick *joy = SDL_JoystickOpen(0);
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
47 if (!joy) {
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
48 fprintf(stderr, "%s: failed to open joystick", __FUNCTION__);
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
49 return new Keyboard;
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
50 } else {
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
51 printf("Use Joystick\n");
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
52 return new Joystick(joy);
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
53 }
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
54 } else {
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
55 printf("Use Keyboard\n");
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
56 return new Keyboard;
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
57 }
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
58 }
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
59
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
60
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
61 Viewer::Viewer(int b, int w, int h, int _num)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
62 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
63 bpp = b;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
64 width = w;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
65 height = h;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
66 spe_num = _num;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
67 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
68
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
69 int
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
70 Viewer::get_ticks()
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
71 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
72 int time;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
73 time = SDL_GetTicks();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
74 return time;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
75 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
76
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
77 bool
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
78 Viewer::quit_check()
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
79 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
80 SDL_Event event;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
81
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
82 while(SDL_PollEvent(&event)) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
83 if (event.type==SDL_QUIT) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
84 return true;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
85 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
86 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
87
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
88 Uint8 *keys=SDL_GetKeyState(NULL);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
89
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
90 if (keys[SDLK_q] == SDL_PRESSED) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
91 return true;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
92 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
93
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
94 return false;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
95 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
96
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
97 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
98 Viewer::quit()
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
99 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
100 SDL_Quit();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
101 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
102
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
103 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
104 Viewer::swap_buffers()
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
105 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
106 SDL_GL_SwapBuffers();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
107 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
108
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
109 extern void node_init(void);
144
gongo@localhost.localdomain
parents: 143
diff changeset
110 extern void create_cube_split(int);
153
70146cdec3d4 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 150
diff changeset
111 extern void create_snake_bg(int);
158
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 157
diff changeset
112 extern void universe_init(void);
142
dc68420f705f add xml
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 140
diff changeset
113
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
114 void
180
e3b7776b1420 いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents: 177
diff changeset
115 Viewer::run_init(const char *xml, int sg_number)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
116 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
117 HTaskPtr task_next;
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 158
diff changeset
118 HTaskPtr task_tex;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
119
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
120 start_time = get_ticks();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
121 this_time = 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
122 frames = 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
123
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
124 //scene_graph = SceneGraph::createFromXMLfile(xml);
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
125 /**
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
126 * これを実行すると、
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
127 * scene_graph にオリジナルの SceneGraph Object のリストが、
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
128 * scene_graph_viewer に描画用の SceneGraph が生成される
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
129 */
142
dc68420f705f add xml
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 140
diff changeset
130 //SceneGraph::createFromXMLfile(xml);
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
131 //polygon->viewer = this;
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
132
144
gongo@localhost.localdomain
parents: 143
diff changeset
133 switch (sg_number) {
gongo@localhost.localdomain
parents: 143
diff changeset
134 case 0:
gongo@localhost.localdomain
parents: 143
diff changeset
135 case 1:
gongo@localhost.localdomain
parents: 143
diff changeset
136 create_cube_split(sg_number);
gongo@localhost.localdomain
parents: 143
diff changeset
137 break;
gongo@localhost.localdomain
parents: 143
diff changeset
138 case 2:
153
70146cdec3d4 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 150
diff changeset
139 case 3:
70146cdec3d4 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 150
diff changeset
140 case 4:
70146cdec3d4 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 150
diff changeset
141 create_snake_bg(sg_number);
144
gongo@localhost.localdomain
parents: 143
diff changeset
142 break;
153
70146cdec3d4 画像のサイズテストを加える -sg = [2,3,4]
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 150
diff changeset
143 case 5:
158
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 157
diff changeset
144 universe_init();
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 157
diff changeset
145 break;
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 157
diff changeset
146 case 6:
144
gongo@localhost.localdomain
parents: 143
diff changeset
147 node_init();
gongo@localhost.localdomain
parents: 143
diff changeset
148 break;
gongo@localhost.localdomain
parents: 143
diff changeset
149 default:
gongo@localhost.localdomain
parents: 143
diff changeset
150 node_init();
gongo@localhost.localdomain
parents: 143
diff changeset
151 break;
gongo@localhost.localdomain
parents: 143
diff changeset
152 }
142
dc68420f705f add xml
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 140
diff changeset
153
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
154 scene_graph->controller = create_controller();
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
155
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
156 sgpack = (SceneGraphPack*)manager->malloc(sizeof(SceneGraphPack));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
157 sgpack->init();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
158 ppack = (PolygonPack*)manager->malloc(sizeof(PolygonPack));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
159
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
160 spackList_length = (this->height + split_screen_h - 1) / split_screen_h;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
161 spackList = (SpanPack*)manager->malloc(sizeof(SpanPack)*spackList_length);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
162
176
gongo@localhost.localdomain
parents: 170
diff changeset
163 /**
gongo@localhost.localdomain
parents: 170
diff changeset
164 * SPU に送る address list は 16 バイト倍数でないといけない。
gongo@localhost.localdomain
parents: 170
diff changeset
165 * spackList_length*sizeof(SpanPack*) が 16 バイト倍数になるような
gongo@localhost.localdomain
parents: 170
diff changeset
166 * length_align を求めている。はみ出した部分は使われない
gongo@localhost.localdomain
parents: 170
diff changeset
167 * (ex) spackList_length が 13 の場合
gongo@localhost.localdomain
parents: 170
diff changeset
168 * spackList_length_align = 16;
gongo@localhost.localdomain
parents: 170
diff changeset
169 * 実際に送るデータは64バイトになるのでOK
gongo@localhost.localdomain
parents: 170
diff changeset
170 * 14,15,16 の部分は何も入らない。
gongo@localhost.localdomain
parents: 170
diff changeset
171 */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
172 spackList_length_align = (spackList_length + 3)&(~3);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
173
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
174 /* 各 SPU が持つ、SpanPack の address list */
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 158
diff changeset
175 spackList_ptr =
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 158
diff changeset
176 (SpanPack**)manager->malloc(sizeof(SpanPack*)*spackList_length_align);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
177
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
178 for (int i = 0; i < spackList_length; i++) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
179 spackList_ptr[i] = &spackList[i];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
180 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
181
126
74d0a70f60e9 fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 123
diff changeset
182 for (int i = 1; i <= spackList_length; i++) {
74d0a70f60e9 fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 123
diff changeset
183 spackList[i-1].init(i*split_screen_h);
74d0a70f60e9 fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 123
diff changeset
184 }
74d0a70f60e9 fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 123
diff changeset
185
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
186 task_next = manager->create_task(TASK_DUMMY);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
187 task_next->set_post(&post2runLoop, NULL);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
188
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
189 #if 0
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
190 // 諸事情で、今は SceneGraphPack を作らずに
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
191 // そのまま SceneGraph でやっています
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
192 HTaskPtr task_sgp;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
193 task_sgp = manager->create_task(TASK_CREATE_SGP);
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
194 task_sgp->add_param((uint32)scene_graph);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
195 task_sgp->add_param((uint32)sgpack);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
196 task_next->wait_for(task_sgp);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
197 task_sgp->spawn();
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
198 #endif
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
199
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 158
diff changeset
200 for (int i = 0; i < spe_num; i++) {
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 158
diff changeset
201 task_tex = manager->create_task(TASK_INIT_TEXTURE);
176
gongo@localhost.localdomain
parents: 170
diff changeset
202 /* ここはもう少しわかりやすい使い方がいいかもしれぬ。こんなもん? */
167
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 158
diff changeset
203 task_tex->set_cpu((CPU_TYPE)((int)SPE_0 + i));
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 158
diff changeset
204 task_next->wait_for(task_tex);
508beb59e0eb DrawSpan で使う Tile の Hash の扱いは class TileHash を生成する事に。
gongo@localhost.localdomain
parents: 158
diff changeset
205 task_tex->spawn();
120
13b43de5ef5d fix Load Texture
gongo@gendarme.local
parents: 109
diff changeset
206 }
13b43de5ef5d fix Load Texture
gongo@gendarme.local
parents: 109
diff changeset
207
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
208 task_next->spawn();
177
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
209
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
210 zRow=(float*)manager->malloc(sizeof(float)*split_screen_w*split_screen_h);
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
211
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
212 for (int i = 0; i < split_screen_w*split_screen_h; i++) {
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
213 zRow[i] = 65535.0f; // __FLT_MAX__ とかでも
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
214 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
215 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
216
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
217 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
218 Viewer::run_loop(void)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
219 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
220 HTaskPtr task_create_pp = NULL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
221 HTaskPtr task_create_sp = NULL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
222 HTaskPtr task_next;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
223 bool quit_flg;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
224
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
225 quit_flg = quit_check();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
226
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
227 if (quit_flg == true) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
228 this_time = get_ticks();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
229 run_finish();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
230 return;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
231 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
232
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
233 clean_pixels();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
234
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
235 for (int i = 1; i <= spackList_length; i++) {
126
74d0a70f60e9 fix RGBA mask (bgr -> rgba)
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 123
diff changeset
236 spackList[i-1].reinit(i*split_screen_h);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
237 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
238
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
239 task_next = manager->create_task(TASK_DUMMY);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
240 task_next->set_post(post2runDraw, NULL);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
241
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
242 #if 0
157
gongo@henri.cr.ie.u-ryukyu.ac.jp
parents: 155
diff changeset
243 // SceneGraphPack の update
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
244 HTaskPtr task_update_sgp = NULL;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
245 task_update_sgp = manager->create_task(TASK_UPDATE_SGP);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
246 task_update_sgp->add_inData(sgpack, sizeof(SceneGraphPack));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
247 task_update_sgp->add_outData(sgpack, sizeof(SceneGraphPack));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
248 task_update_sgp->add_param(width);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
249 task_update_sgp->add_param(height);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
250 task_next->wait_for(task_update_sgp);
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
251 task_update_sgp->spawn();
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
252 #else
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
253 scene_graph->controller->check();
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
254 scene_graph_viewer->all_execute(width, height);
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
255 #endif
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
256
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
257 #if 0
157
gongo@henri.cr.ie.u-ryukyu.ac.jp
parents: 155
diff changeset
258 // SceneGraphPack(配列) -> PolygonPack
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
259 task_create_pp = manager->create_task(TASK_CREATE_PP);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
260 task_create_pp->add_inData(sgpack, sizeof(SceneGraphPack));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
261 task_create_pp->add_param((uint32)ppack);
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
262 #else
157
gongo@henri.cr.ie.u-ryukyu.ac.jp
parents: 155
diff changeset
263 // SceneGraph(木構造) -> PolygonPack
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
264 task_create_pp = manager->create_task(TASK_CREATE_PP2);
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
265 task_create_pp->add_param((uint32)scene_graph_viewer);
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
266 task_create_pp->add_param((uint32)ppack);
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
267 #endif
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
268 task_next->wait_for(task_create_pp);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
269
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
270 int range_base = spe_num;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
271 // 切り上げのつもり
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
272 int range = (spackList_length + range_base - 1) / range_base;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
273
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
274 for (int i = 0; i < range_base; i++) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
275 int index_start = range*i;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
276 int index_end = (index_start + range >= spackList_length)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
277 ? spackList_length : index_start + range;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
278
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
279 task_create_sp = manager->create_task(TASK_CREATE_SPAN);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
280 task_create_sp->add_inData(ppack, sizeof(PolygonPack));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
281 task_create_sp->add_inData(spackList_ptr,
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
282 sizeof(SpanPack*)*spackList_length_align);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
283 task_create_sp->add_inData(&spackList[index_start], sizeof(SpanPack));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
284
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
285 task_create_sp->add_param(index_start);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
286
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
287 /**
133
8f1419174cdf DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
288 * ex. screen_height が 480, spenum が 6 の場合、各SPEのy担当範囲
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
289 * [ 1.. 80] [ 81..160] [161..240]
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
290 * [241..320] [321..400] [401..480]
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
291 *
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
292 * ex. screen_height が 1080, spenum が 5 の場合、
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
293 * [ 1..216] [217..432] [433..648]
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
294 * [649..864] [865..1080]
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
295 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
296 task_create_sp->add_param(index_start*split_screen_h + 1);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
297 task_create_sp->add_param(index_end*split_screen_h);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
298
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
299 task_next->wait_for(task_create_sp);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
300 task_create_sp->wait_for(task_create_pp);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
301
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
302 task_create_sp->set_cpu(SPE_ANY);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
303 task_create_sp->spawn();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
304 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
305
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
306 task_create_pp->spawn();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
307 task_next->spawn();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
308 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
309
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
310 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
311 Viewer::run_draw(void)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
312 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
313 HTaskPtr task_next;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
314 HTaskPtr task_draw;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
315
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
316 task_next = manager->create_task(TASK_DUMMY);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
317 task_next->set_post(post2runLoop, NULL);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
318
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
319 ppack->clear();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
320
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
321 for (int i = 0; i < spackList_length; i++) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
322 SpanPack *spack = &spackList[i];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
323 int startx = 1;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
324 int endx = split_screen_w;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
325
180
e3b7776b1420 いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents: 177
diff changeset
326 int starty = spack->info.y_top - split_screen_h + 1;
e3b7776b1420 いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents: 177
diff changeset
327 //int endy = spack->info.y_top;
e3b7776b1420 いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents: 177
diff changeset
328 int rangey = (starty + split_screen_h - 1 > this->height)
e3b7776b1420 いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents: 177
diff changeset
329 ? this->height - starty + 1 : split_screen_h;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
330
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
331 while (startx < this->width) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
332 if (spack->info.size > 0) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
333 // Draw SpanPack
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
334 task_draw = manager->create_task(TASK_DRAW_SPAN);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
335 task_draw->add_inData(spack, sizeof(SpanPack));
177
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
336
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
337 task_draw->add_inData(zRow,
deb02b0e6291 zRow の生成、初期化の変更
gongo@localhost.localdomain
parents: 176
diff changeset
338 sizeof(float)*(endx-startx+1)*rangey);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
339 } else {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
340 // Draw Background (現在は塗りつぶし)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
341 task_draw = manager->create_task(TASK_DRAW_BACK);
266
8c9cae96404b merge 151 263
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150 122
diff changeset
342 <<<<<<< local
170
5a4f2497c22d fix ViewerSDL
gongo@localhost.localdomain
parents: 169
diff changeset
343 task_draw->add_param(0xffffffff);
267
943c2ebe4483 merge 172 264
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 170 266
diff changeset
344 =======
943c2ebe4483 merge 172 264
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 170 266
diff changeset
345 <<<<<<< local
133
8f1419174cdf DrawSpan のテクスチャ座標を求める部分で、width と height が逆に使われてた。
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 130
diff changeset
346 task_draw->add_param(0xffffff);
266
8c9cae96404b merge 151 263
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150 122
diff changeset
347 =======
122
08e47bbca4f5 add SceneGraph move
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 120
diff changeset
348 //task_draw->add_param(0x00ffcc55);
08e47bbca4f5 add SceneGraph move
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 120
diff changeset
349 task_draw->add_param(0);
08e47bbca4f5 add SceneGraph move
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 120
diff changeset
350 //task_draw->add_param(st_rgb);
266
8c9cae96404b merge 151 263
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150 122
diff changeset
351 >>>>>>> other
267
943c2ebe4483 merge 172 264
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 170 266
diff changeset
352 >>>>>>> other
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
353 }
176
gongo@localhost.localdomain
parents: 170
diff changeset
354
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
355 for (int k = 0; k < rangey; k++) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
356 task_draw->add_outData(
180
e3b7776b1420 いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
gongo@localhost.localdomain
parents: 177
diff changeset
357 &pixels[(startx-1)+this->width*(k+starty-1)],
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
358 (endx - startx + 1)*sizeof(int));
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
359 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
360
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
361 task_draw->add_param(startx);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
362 task_draw->add_param(endx);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
363 task_draw->add_param(rangey);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
364 task_draw->set_cpu(SPE_ANY);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
365 task_next->wait_for(task_draw);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
366 task_draw->spawn();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
367
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
368 startx += split_screen_w;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
369 endx += split_screen_w;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
370
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
371 if (endx > this->width) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
372 endx = this->width;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
373 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
374 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
375 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
376
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
377 task_next->spawn();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
378
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
379 frames++;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
380 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
381
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
382 void
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
383 Viewer::run_finish(void)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
384 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
385 if (this_time != start_time) {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
386 printf("%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
387 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
388
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
389 scene_graph->delete_data();
140
67a5469dfef2 add Controller
gongo@charles.cr.ie.u-ryukyu.ac.jp
parents: 138
diff changeset
390 scene_graph->controller->close();
137
91c74dbc32e4 SceneGraphPack の代わりに、今は SceneGraph をそのまま使う様に設定。
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 133
diff changeset
391 delete scene_graph;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
392
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
393 quit();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents:
diff changeset
394 }