Mercurial > hg > Members > kono > Cerium
annotate Renderer/Engine/viewer.h @ 1032:8892d0ea7985
merge
author | Yutaka_Kinjyo |
---|---|
date | Tue, 16 Nov 2010 14:59:28 +0900 |
parents | 295b3c79fb44 |
children | 431936c0cc96 |
rev | line source |
---|---|
283 | 1 #ifndef INCLUDED_VIEWER |
2 #define INCLUDED_VIEWER | |
3 | |
4 #include <SDL.h> | |
5 | |
507 | 6 #include "viewer_types.h" |
7 #include "TaskManager.h" | |
8 #include "KeyStat.h" | |
510 | 9 #include "MainLoop.h" |
507 | 10 #include "Application.h" |
558 | 11 #include "SceneGraphRoot.h" |
748 | 12 #include "ViewerDevice.h" |
909 | 13 #include "matrix.h" |
507 | 14 |
562 | 15 class SceneGraphRoot; |
16 | |
511 | 17 class Application; |
283 | 18 |
986
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
19 typedef struct rendering_data { |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
20 PolygonPack *ppack; |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
21 SpanPackPtr spackList; |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
22 SpanPackPtr *spackList_ptr; |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
23 |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
24 int spackList_length; |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
25 int spackList_length_align; |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
26 } RederingData ; |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
27 |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
28 extern RederingData r[2]; |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
29 |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
30 extern int ppi, spi; |
ac437c3cf766
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
31 |
511 | 32 class Viewer : public MainLoop { |
510 | 33 |
283 | 34 public: |
925
9da903858400
add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
35 Viewer(){ profile = 0;}; |
748 | 36 Viewer(TaskManager *manager, ViewerDevice *dev, int bpp, int width, int height, int spenum); |
283 | 37 |
510 | 38 virtual ~Viewer() {} |
748 | 39 BASE_NEW_DELETE(Viewer); |
283 | 40 |
748 | 41 ViewerDevice *dev; |
507 | 42 Application *app; |
43 | |
44 TaskManager *manager; | |
45 key_stat *keyPtr; | |
46 HTaskPtr draw_dummy; | |
47 | |
283 | 48 /* screen info */ |
49 int bpp; | |
50 | |
748 | 51 int rgb_size[3]; |
283 | 52 int spe_num; |
748 | 53 int width; |
54 int height; | |
283 | 55 |
748 | 56 float *light_xyz; |
57 float *light_xyz_stock; | |
792 | 58 int *light_switch; |
59 int *light_switch_stock; | |
793 | 60 int *light_sysswitch; |
61 int light_sysswitch_stock; | |
748 | 62 |
283 | 63 Uint32 video_flags; |
64 Uint32 *pixels; | |
65 | |
914 | 66 int mem_flag; |
925
9da903858400
add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
67 int profile; |
914 | 68 |
558 | 69 SceneGraphRoot *sgroot; |
70 | |
748 | 71 //Uint32 *video_init(TaskManager *manager, int bpp, int width, int height); |
283 | 72 void init(); |
73 | |
74 int get_ticks(); | |
75 bool quit_check(); | |
76 void quit(); | |
748 | 77 HTaskPtr initLoop(); |
283 | 78 |
748 | 79 void clean_pixels() {} |
869 | 80 |
927
651251d56f36
remove garbage codes from viewerGL
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
81 void run_init(TaskManager *manager, Application *app); |
748 | 82 void run_loop(HTaskPtr task_next); |
83 void run_draw(HTaskPtr task_next); | |
927
651251d56f36
remove garbage codes from viewerGL
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
84 virtual void run_finish(); |
748 | 85 void run_move(HTaskPtr task_next); |
86 void run_collision(); | |
87 void rendering(HTaskPtr task_next); | |
88 void common_draw(HTaskPtr task_next); | |
89 void common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot); | |
507 | 90 |
748 | 91 void spe_rendering(HTaskPtr task_next); |
92 void spe_draw(HTaskPtr task_next); | |
93 // void exchange_sgroot(TaskManager *manager); | |
507 | 94 |
792 | 95 HTaskPtr update_task_create(void *data, int size, |
96 int load_id, int spe_id, HTaskPtr wait); | |
97 | |
507 | 98 void getKey(); |
99 void get_send_controll(); | |
511 | 100 |
558 | 101 // void createFromXMLfile(const char *file); |
102 // SceneGraph *createSceneGraph(int id); | |
103 // SceneGraph *createSceneGraph(); | |
104 // void setSceneData(SceneGraph *g); | |
927
651251d56f36
remove garbage codes from viewerGL
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
105 virtual void mainLoop(); |
511 | 106 |
1002 | 107 void task_array_init(int id, int task_num, int param, int inData_num, int outData_num) |
108 { | |
109 sgroot->task_array_init(id, task_num, param, inData_num, outData_num); | |
110 } | |
969
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
111 void set_game_task(int id, void *property, int size, PostFunction post_func) |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
112 { |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
113 sgroot->set_game_task(id, property, size, post_func); |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
114 } |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
115 void set_game_task(int id, void *property, void *pad, int size, PostFunction post_func) |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
116 { |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
117 sgroot->set_game_task(id, property, pad, size, post_func); |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
118 } |
1003
295b3c79fb44
game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1002
diff
changeset
|
119 void set_move_task(SceneGraphPtr node, int move, void *titlep, int size, PostFunction post_func) |
886 | 120 { |
1003
295b3c79fb44
game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1002
diff
changeset
|
121 sgroot->set_move_task(node, move, titlep, size, post_func); |
886 | 122 } |
969
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
123 void set_pad_task(SceneGraphPtr node, int move, void *property, int size, PostFunction post_func) |
869 | 124 { |
969
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
125 sgroot->set_pad_task(node, move, property, size, post_func); |
869 | 126 } |
127 | |
671
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
128 void createFromXMLmemory(SceneGraph * node, char *data, int len) |
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
129 { |
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
130 sgroot->createFromXMLmemory(manager, node, data, len); |
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
131 } |
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
132 |
558 | 133 void createFromXMLfile(const char *file) |
134 { | |
135 sgroot->createFromXMLfile(manager, file); | |
136 } | |
137 | |
969
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
138 Pad * getController() |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
139 { |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
140 return sgroot->getController(); |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
141 } |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
142 |
558 | 143 SceneGraph * createSceneGraph(int id) |
144 { | |
145 return sgroot->createSceneGraph(id); | |
146 } | |
147 | |
562 | 148 SceneGraph * createSceneGraph(const char *id) |
149 { | |
969
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
150 return sgroot->createSceneGraph(id); |
562 | 151 } |
152 | |
153 int getSgid(const char *id) | |
154 { | |
155 return sgroot->getSgid(id); | |
156 } | |
157 | |
558 | 158 SceneGraph * createSceneGraph() |
159 { | |
160 return sgroot->createSceneGraph(); | |
161 } | |
162 | |
163 void setSceneData(SceneGraph *g) | |
164 { | |
165 sgroot->setSceneData(g); | |
166 } | |
167 | |
589 | 168 int getLast() |
169 { | |
170 return sgroot->getLast(); | |
171 } | |
172 | |
793 | 173 SceneGraphPtr getLight(int id) |
174 { | |
175 return sgroot->getLight(id); | |
176 } | |
177 | |
178 void OnLightSwitch(int id) | |
179 { | |
180 sgroot->OnLightSwitch(id); | |
181 } | |
182 | |
183 void OffLightSwitch(int id) | |
184 { | |
185 sgroot->OffLightSwitch(id); | |
186 } | |
187 | |
188 void OnLightSysSwitch() | |
189 { | |
190 sgroot->OnLightSysSwitch(); | |
191 } | |
192 | |
193 void OffLightSysSwitch() | |
194 { | |
195 sgroot->OffLightSysSwitch(); | |
196 } | |
197 | |
283 | 198 }; |
199 | |
507 | 200 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK |
201 | |
202 | |
283 | 203 #endif |
204 |