Mercurial > hg > Members > kono > Cerium
annotate Renderer/Engine/viewer.h @ 922:655e11f6e437
moving OpenGL mode now!
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 29 Jul 2010 22:56:58 +0900 |
parents | ad10d6d39ca6 |
children | 9da903858400 651251d56f36 |
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 |
511 | 19 class Viewer : public MainLoop { |
510 | 20 |
283 | 21 public: |
922 | 22 Viewer(){}; |
748 | 23 Viewer(TaskManager *manager, ViewerDevice *dev, int bpp, int width, int height, int spenum); |
283 | 24 |
510 | 25 virtual ~Viewer() {} |
748 | 26 BASE_NEW_DELETE(Viewer); |
283 | 27 |
748 | 28 ViewerDevice *dev; |
507 | 29 Application *app; |
30 | |
31 TaskManager *manager; | |
32 key_stat *keyPtr; | |
33 HTaskPtr draw_dummy; | |
34 | |
283 | 35 /* screen info */ |
36 int bpp; | |
37 | |
748 | 38 int rgb_size[3]; |
283 | 39 int spe_num; |
748 | 40 int width; |
41 int height; | |
283 | 42 |
748 | 43 float *light_xyz; |
44 float *light_xyz_stock; | |
792 | 45 int *light_switch; |
46 int *light_switch_stock; | |
793 | 47 int *light_sysswitch; |
48 int light_sysswitch_stock; | |
748 | 49 |
283 | 50 Uint32 video_flags; |
51 Uint32 *pixels; | |
52 | |
914 | 53 int mem_flag; |
54 | |
558 | 55 SceneGraphRoot *sgroot; |
56 | |
748 | 57 //Uint32 *video_init(TaskManager *manager, int bpp, int width, int height); |
283 | 58 void init(); |
59 | |
60 int get_ticks(); | |
61 bool quit_check(); | |
62 void quit(); | |
748 | 63 HTaskPtr initLoop(); |
283 | 64 |
748 | 65 void clean_pixels() {} |
869 | 66 |
922 | 67 virtual void run_init(TaskManager *manager, Application *app); |
748 | 68 void run_loop(HTaskPtr task_next); |
69 void run_draw(HTaskPtr task_next); | |
70 void run_finish(); | |
71 void run_move(HTaskPtr task_next); | |
72 void run_collision(); | |
73 void rendering(HTaskPtr task_next); | |
74 void common_draw(HTaskPtr task_next); | |
75 void common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot); | |
507 | 76 |
748 | 77 void spe_rendering(HTaskPtr task_next); |
78 void spe_draw(HTaskPtr task_next); | |
79 // void exchange_sgroot(TaskManager *manager); | |
507 | 80 |
792 | 81 HTaskPtr update_task_create(void *data, int size, |
82 int load_id, int spe_id, HTaskPtr wait); | |
83 | |
507 | 84 void getKey(); |
85 void get_send_controll(); | |
511 | 86 |
558 | 87 // void createFromXMLfile(const char *file); |
88 // SceneGraph *createSceneGraph(int id); | |
89 // SceneGraph *createSceneGraph(); | |
90 // void setSceneData(SceneGraph *g); | |
512 | 91 void mainLoop(); |
511 | 92 |
886 | 93 void set_move_task(SceneGraphPtr node, int move_id, void *titlep, int size, PostFunction post_func) |
94 { | |
95 sgroot->set_move_task(node, move_id, titlep, size, post_func); | |
96 } | |
869 | 97 void set_game_task(int id, void *property, int size, PostFunction post_func) |
98 { | |
99 sgroot->set_game_task(id, property, size, post_func); | |
100 } | |
101 | |
671
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
102 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
|
103 { |
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
104 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
|
105 } |
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
106 |
558 | 107 void createFromXMLfile(const char *file) |
108 { | |
109 sgroot->createFromXMLfile(manager, file); | |
110 } | |
111 | |
112 SceneGraph * createSceneGraph(int id) | |
113 { | |
114 return sgroot->createSceneGraph(id); | |
115 } | |
116 | |
562 | 117 SceneGraph * createSceneGraph(const char *id) |
118 { | |
119 return sgroot->createSceneGraph(id); | |
120 } | |
121 | |
122 int getSgid(const char *id) | |
123 { | |
124 return sgroot->getSgid(id); | |
125 } | |
126 | |
558 | 127 SceneGraph * createSceneGraph() |
128 { | |
129 return sgroot->createSceneGraph(); | |
130 } | |
131 | |
132 void setSceneData(SceneGraph *g) | |
133 { | |
134 sgroot->setSceneData(g); | |
135 } | |
136 | |
589 | 137 int getLast() |
138 { | |
139 return sgroot->getLast(); | |
140 } | |
141 | |
793 | 142 SceneGraphPtr getLight(int id) |
143 { | |
144 return sgroot->getLight(id); | |
145 } | |
146 | |
147 void OnLightSwitch(int id) | |
148 { | |
149 sgroot->OnLightSwitch(id); | |
150 } | |
151 | |
152 void OffLightSwitch(int id) | |
153 { | |
154 sgroot->OffLightSwitch(id); | |
155 } | |
156 | |
157 void OnLightSysSwitch() | |
158 { | |
159 sgroot->OnLightSysSwitch(); | |
160 } | |
161 | |
162 void OffLightSysSwitch() | |
163 { | |
164 sgroot->OffLightSysSwitch(); | |
165 } | |
166 | |
283 | 167 }; |
168 | |
507 | 169 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK |
170 | |
171 | |
283 | 172 #endif |
173 |