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