Mercurial > hg > Game > Cerium
annotate Renderer/Engine/viewer.h @ 1211:7763f03a94e1 draft before-dma-manager
const char fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 22 Jul 2011 08:46:29 +0900 |
parents | 0ee23180d301 |
children | fe598e9b7f0e |
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" |
539 | 13 |
562 | 14 class SceneGraphRoot; |
15 | |
543 | 16 class Application; |
283 | 17 |
1035 | 18 |
986
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
19 typedef struct rendering_data { |
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
20 PolygonPack *ppack; |
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
21 SpanPackPtr spackList; |
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
22 SpanPackPtr *spackList_ptr; |
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
23 |
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
24 int spackList_length; |
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
25 int spackList_length_align; |
1160 | 26 } RenderingData ; |
986
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
27 |
1160 | 28 extern RenderingData r[2]; |
986
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
29 |
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
30 extern int ppi, spi; |
b3a8545eb2fa
double buffering of spanpack/polgonpack
root@henri.cr.ie.u-ryukyu.ac.jp
parents:
969
diff
changeset
|
31 |
543 | 32 class Viewer : public MainLoop { |
542 | 33 |
283 | 34 public: |
925
292bb8c79cdb
add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
35 Viewer(){ profile = 0;}; |
747 | 36 Viewer(TaskManager *manager, ViewerDevice *dev, int bpp, int width, int height, int spenum); |
283 | 37 |
542 | 38 virtual ~Viewer() {} |
747 | 39 BASE_NEW_DELETE(Viewer); |
283 | 40 |
747 | 41 ViewerDevice *dev; |
539 | 42 Application *app; |
43 | |
44 TaskManager *manager; | |
45 key_stat *keyPtr; | |
46 HTaskPtr draw_dummy; | |
47 | |
283 | 48 /* screen info */ |
49 int bpp; | |
50 | |
747 | 51 int rgb_size[3]; |
283 | 52 int spe_num; |
747 | 53 int width; |
54 int height; | |
283 | 55 |
747 | 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; | |
747 | 62 |
283 | 63 Uint32 video_flags; |
64 Uint32 *pixels; | |
65 | |
914 | 66 int mem_flag; |
925
292bb8c79cdb
add profile in Redering Engine
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
67 int profile; |
914 | 68 |
1160 | 69 int pp_sum_num; |
70 | |
558 | 71 SceneGraphRoot *sgroot; |
72 | |
747 | 73 //Uint32 *video_init(TaskManager *manager, int bpp, int width, int height); |
283 | 74 void init(); |
75 | |
76 int get_ticks(); | |
77 bool quit_check(); | |
78 void quit(); | |
747 | 79 HTaskPtr initLoop(); |
283 | 80 |
747 | 81 void clean_pixels() {} |
869 | 82 |
927
fada580e4604
remove garbage codes from viewerGL
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
83 void run_init(TaskManager *manager, Application *app); |
1112
fa1f4a1c47bf
fix viewer for non screen mode.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1095
diff
changeset
|
84 bool main_exec(HTaskPtr task_next); |
747 | 85 void run_loop(HTaskPtr task_next); |
86 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
|
87 virtual void run_finish(); |
747 | 88 void run_move(HTaskPtr task_next); |
89 void run_collision(); | |
1131
220f9032d2d2
RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents:
1125
diff
changeset
|
90 void create_pp(HTaskPtr task_next); |
220f9032d2d2
RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents:
1125
diff
changeset
|
91 void create_sp(HTaskPtr task_next); |
747 | 92 void common_draw(HTaskPtr task_next); |
1131
220f9032d2d2
RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents:
1125
diff
changeset
|
93 void rendering_pp(HTaskPtr task_next, SceneGraphRoot *sgroot); |
220f9032d2d2
RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents:
1125
diff
changeset
|
94 void rendering_sp(HTaskPtr task_next, SceneGraphRoot *sgroot); |
220f9032d2d2
RENDERING_TASK was divided into CREATE_PP_TASK and CREATE_SP_TASK.
root@dolphins.cr.ie.u-ryukyu.ac.jp
parents:
1125
diff
changeset
|
95 //void common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot); |
539 | 96 |
747 | 97 // void exchange_sgroot(TaskManager *manager); |
539 | 98 |
792 | 99 HTaskPtr update_task_create(void *data, int size, |
100 int load_id, int spe_id, HTaskPtr wait); | |
101 | |
539 | 102 void getKey(); |
103 void get_send_controll(); | |
543 | 104 |
558 | 105 // void createFromXMLfile(const char *file); |
106 // SceneGraph *createSceneGraph(int id); | |
107 // SceneGraph *createSceneGraph(); | |
108 // void setSceneData(SceneGraph *g); | |
927
fada580e4604
remove garbage codes from viewerGL
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
922
diff
changeset
|
109 virtual void mainLoop(); |
543 | 110 |
1211 | 111 void createStringFont(SceneGraphPtr root, const char *string, int pixels, int screen_w, int screen_h, Uint32 color) |
1205
b8adf4e95e96
add createStringFont()
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
1160
diff
changeset
|
112 { |
b8adf4e95e96
add createStringFont()
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
1160
diff
changeset
|
113 sgroot -> createStringFont(manager, root, string, pixels, screen_w, screen_h, color); |
b8adf4e95e96
add createStringFont()
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
1160
diff
changeset
|
114 } |
1211 | 115 void createFont(const char *font,int pixels,Uint32 color, const char *filename, int len, char **obj_name) |
1205
b8adf4e95e96
add createStringFont()
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
1160
diff
changeset
|
116 { |
b8adf4e95e96
add createStringFont()
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
1160
diff
changeset
|
117 sgroot -> createFont(manager,font,pixels,color,filename, len, obj_name); |
b8adf4e95e96
add createStringFont()
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
1160
diff
changeset
|
118 } |
1002 | 119 void task_array_init(int id, int task_num, int param, int inData_num, int outData_num) |
120 { | |
121 sgroot->task_array_init(id, task_num, param, inData_num, outData_num); | |
122 } | |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
123 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
|
124 { |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
125 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
|
126 } |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
127 void set_pad_task(SceneGraphPtr node, int move, void *property, int size) |
886 | 128 { |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
129 sgroot->set_pad_task(node, move, property, size); |
869 | 130 } |
131 | |
671
7761ebf9c62a
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
132 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
|
133 { |
7761ebf9c62a
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
134 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
|
135 } |
7761ebf9c62a
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
136 |
558 | 137 void createFromXMLfile(const char *file) |
138 { | |
139 sgroot->createFromXMLfile(manager, file); | |
140 } | |
141 | |
969
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
142 Pad * getController() |
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
143 { |
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
144 return sgroot->getController(); |
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
145 } |
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
146 |
558 | 147 SceneGraph * createSceneGraph(int id) |
148 { | |
149 return sgroot->createSceneGraph(id); | |
150 } | |
151 | |
562 | 152 SceneGraph * createSceneGraph(const char *id) |
153 { | |
969
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
154 return sgroot->createSceneGraph(id); |
562 | 155 } |
156 | |
157 int getSgid(const char *id) | |
158 { | |
159 return sgroot->getSgid(id); | |
160 } | |
161 | |
558 | 162 SceneGraph * createSceneGraph() |
163 { | |
164 return sgroot->createSceneGraph(); | |
165 } | |
166 | |
167 void setSceneData(SceneGraph *g) | |
168 { | |
169 sgroot->setSceneData(g); | |
170 } | |
171 | |
589 | 172 int getLast() |
173 { | |
174 return sgroot->getLast(); | |
175 } | |
176 | |
793 | 177 SceneGraphPtr getLight(int id) |
178 { | |
179 return sgroot->getLight(id); | |
180 } | |
181 | |
182 void OnLightSwitch(int id) | |
183 { | |
184 sgroot->OnLightSwitch(id); | |
185 } | |
186 | |
187 void OffLightSwitch(int id) | |
188 { | |
189 sgroot->OffLightSwitch(id); | |
190 } | |
191 | |
192 void OnLightSysSwitch() | |
193 { | |
194 sgroot->OnLightSysSwitch(); | |
195 } | |
196 | |
197 void OffLightSysSwitch() | |
198 { | |
199 sgroot->OffLightSysSwitch(); | |
200 } | |
201 | |
283 | 202 }; |
203 | |
539 | 204 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK |
205 | |
206 | |
283 | 207 #endif |
208 |