Mercurial > hg > Members > kono > Cerium
annotate Renderer/Engine/viewer.h @ 994:33616b2789de
SDL mode fix
author | yutaka@charles.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Mon, 11 Oct 2010 14:21:02 +0900 |
parents | ac437c3cf766 |
children | c79651141045 |
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 |
969
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
107 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
|
108 { |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
109 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
|
110 } |
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, 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
|
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, pad, size, post_func); |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
114 } |
886 | 115 void set_move_task(SceneGraphPtr node, int move_id, void *titlep, int size, PostFunction post_func) |
116 { | |
117 sgroot->set_move_task(node, move_id, titlep, size, post_func); | |
118 } | |
969
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
119 void set_pad_task(SceneGraphPtr node, int move, void *property, int size, PostFunction post_func) |
869 | 120 { |
969
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
121 sgroot->set_pad_task(node, move, property, size, post_func); |
869 | 122 } |
123 | |
671
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
124 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
|
125 { |
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
126 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
|
127 } |
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
128 |
558 | 129 void createFromXMLfile(const char *file) |
130 { | |
131 sgroot->createFromXMLfile(manager, file); | |
132 } | |
133 | |
969
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
134 Pad * getController() |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
135 { |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
136 return sgroot->getController(); |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
137 } |
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
138 |
558 | 139 SceneGraph * createSceneGraph(int id) |
140 { | |
141 return sgroot->createSceneGraph(id); | |
142 } | |
143 | |
562 | 144 SceneGraph * createSceneGraph(const char *id) |
145 { | |
969
9a53faae88d8
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
146 return sgroot->createSceneGraph(id); |
562 | 147 } |
148 | |
149 int getSgid(const char *id) | |
150 { | |
151 return sgroot->getSgid(id); | |
152 } | |
153 | |
558 | 154 SceneGraph * createSceneGraph() |
155 { | |
156 return sgroot->createSceneGraph(); | |
157 } | |
158 | |
159 void setSceneData(SceneGraph *g) | |
160 { | |
161 sgroot->setSceneData(g); | |
162 } | |
163 | |
589 | 164 int getLast() |
165 { | |
166 return sgroot->getLast(); | |
167 } | |
168 | |
793 | 169 SceneGraphPtr getLight(int id) |
170 { | |
171 return sgroot->getLight(id); | |
172 } | |
173 | |
174 void OnLightSwitch(int id) | |
175 { | |
176 sgroot->OnLightSwitch(id); | |
177 } | |
178 | |
179 void OffLightSwitch(int id) | |
180 { | |
181 sgroot->OffLightSwitch(id); | |
182 } | |
183 | |
184 void OnLightSysSwitch() | |
185 { | |
186 sgroot->OnLightSysSwitch(); | |
187 } | |
188 | |
189 void OffLightSysSwitch() | |
190 { | |
191 sgroot->OffLightSysSwitch(); | |
192 } | |
193 | |
283 | 194 }; |
195 | |
507 | 196 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK |
197 | |
198 | |
283 | 199 #endif |
200 |