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