annotate TaskManager/Test/test_render/viewer.cpp @ 267:943c2ebe4483 draft

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