annotate TaskManager/Test/test_render/viewer.cpp @ 213:159519cdca1f

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