annotate TaskManager/Test/test_render/viewer.cpp @ 193:1ff24ca2f016 draft

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