Mercurial > hg > Members > kono > Cerium
annotate Renderer/Engine/viewer.h @ 860:649e4cb84683
Still on the way
author | yutaka@localhost.localdomain |
---|---|
date | Fri, 18 Jun 2010 01:30:06 +0900 |
parents | c260205d3185 |
children | bcc81531a672 |
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" |
507 | 13 |
562 | 14 class SceneGraphRoot; |
15 | |
511 | 16 class Application; |
283 | 17 |
511 | 18 class Viewer : public MainLoop { |
510 | 19 |
283 | 20 public: |
510 | 21 |
748 | 22 Viewer(TaskManager *manager, ViewerDevice *dev, int bpp, int width, int height, int spenum); |
283 | 23 |
510 | 24 virtual ~Viewer() {} |
748 | 25 BASE_NEW_DELETE(Viewer); |
283 | 26 |
748 | 27 ViewerDevice *dev; |
507 | 28 Application *app; |
29 | |
30 TaskManager *manager; | |
31 key_stat *keyPtr; | |
32 HTaskPtr draw_dummy; | |
33 | |
283 | 34 /* screen info */ |
35 int bpp; | |
36 | |
748 | 37 int rgb_size[3]; |
283 | 38 int spe_num; |
748 | 39 int width; |
40 int height; | |
283 | 41 |
748 | 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; | |
748 | 48 |
283 | 49 Uint32 video_flags; |
50 Uint32 *pixels; | |
51 | |
558 | 52 SceneGraphRoot *sgroot; |
53 | |
748 | 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(); | |
748 | 60 HTaskPtr initLoop(); |
283 | 61 |
748 | 62 void clean_pixels() {} |
63 | |
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); | |
748 | 74 void common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot); |
507 | 75 |
748 | 76 void spe_rendering(HTaskPtr task_next); |
77 void spe_draw(HTaskPtr task_next); | |
78 // void exchange_sgroot(TaskManager *manager); | |
507 | 79 |
792 | 80 HTaskPtr update_task_create(void *data, int size, |
81 int load_id, int spe_id, HTaskPtr wait); | |
82 | |
507 | 83 void getKey(); |
84 void get_send_controll(); | |
511 | 85 |
558 | 86 // void createFromXMLfile(const char *file); |
87 // SceneGraph *createSceneGraph(int id); | |
88 // SceneGraph *createSceneGraph(); | |
89 // void setSceneData(SceneGraph *g); | |
512 | 90 void mainLoop(); |
511 | 91 |
671
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
92 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
|
93 { |
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
94 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
|
95 } |
f42b303044f7
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
96 |
558 | 97 void createFromXMLfile(const char *file) |
98 { | |
99 sgroot->createFromXMLfile(manager, file); | |
100 } | |
101 | |
102 SceneGraph * createSceneGraph(int id) | |
103 { | |
104 return sgroot->createSceneGraph(id); | |
105 } | |
106 | |
562 | 107 SceneGraph * createSceneGraph(const char *id) |
108 { | |
109 return sgroot->createSceneGraph(id); | |
110 } | |
111 | |
112 int getSgid(const char *id) | |
113 { | |
114 return sgroot->getSgid(id); | |
115 } | |
116 | |
558 | 117 SceneGraph * createSceneGraph() |
118 { | |
119 return sgroot->createSceneGraph(); | |
120 } | |
121 | |
122 void setSceneData(SceneGraph *g) | |
123 { | |
124 sgroot->setSceneData(g); | |
125 } | |
126 | |
589 | 127 int getLast() |
128 { | |
129 return sgroot->getLast(); | |
130 } | |
131 | |
793 | 132 SceneGraphPtr getLight(int id) |
133 { | |
134 return sgroot->getLight(id); | |
135 } | |
136 | |
137 void OnLightSwitch(int id) | |
138 { | |
139 sgroot->OnLightSwitch(id); | |
140 } | |
141 | |
142 void OffLightSwitch(int id) | |
143 { | |
144 sgroot->OffLightSwitch(id); | |
145 } | |
146 | |
147 void OnLightSysSwitch() | |
148 { | |
149 sgroot->OnLightSysSwitch(); | |
150 } | |
151 | |
152 void OffLightSysSwitch() | |
153 { | |
154 sgroot->OffLightSysSwitch(); | |
155 } | |
156 | |
283 | 157 }; |
158 | |
507 | 159 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK |
160 | |
161 | |
283 | 162 #endif |
163 |