Mercurial > hg > Game > Cerium
annotate Renderer/Engine/viewer.h @ 848:a033d464c812 draft
addChild fix
author | tkaito |
---|---|
date | Sun, 06 Jun 2010 03:31:52 +0900 |
parents | 66497087393d |
children | 63a08f3a468a |
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() {} |
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); | |
72 void common_rendering(HTaskPtr task_next, SceneGraphRoot *sgroot); | |
539 | 73 |
747 | 74 void spe_rendering(HTaskPtr task_next); |
75 void spe_draw(HTaskPtr task_next); | |
76 // void exchange_sgroot(TaskManager *manager); | |
539 | 77 |
792 | 78 HTaskPtr update_task_create(void *data, int size, |
79 int load_id, int spe_id, HTaskPtr wait); | |
80 | |
539 | 81 void getKey(); |
82 void get_send_controll(); | |
543 | 83 |
558 | 84 // void createFromXMLfile(const char *file); |
85 // SceneGraph *createSceneGraph(int id); | |
86 // SceneGraph *createSceneGraph(); | |
87 // void setSceneData(SceneGraph *g); | |
544 | 88 void mainLoop(); |
543 | 89 |
671
7761ebf9c62a
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
90 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
|
91 { |
7761ebf9c62a
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
92 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
|
93 } |
7761ebf9c62a
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
94 |
558 | 95 void createFromXMLfile(const char *file) |
96 { | |
97 sgroot->createFromXMLfile(manager, file); | |
98 } | |
99 | |
100 SceneGraph * createSceneGraph(int id) | |
101 { | |
102 return sgroot->createSceneGraph(id); | |
103 } | |
104 | |
562 | 105 SceneGraph * createSceneGraph(const char *id) |
106 { | |
107 return sgroot->createSceneGraph(id); | |
108 } | |
109 | |
110 int getSgid(const char *id) | |
111 { | |
112 return sgroot->getSgid(id); | |
113 } | |
114 | |
558 | 115 SceneGraph * createSceneGraph() |
116 { | |
117 return sgroot->createSceneGraph(); | |
118 } | |
119 | |
120 void setSceneData(SceneGraph *g) | |
121 { | |
122 sgroot->setSceneData(g); | |
123 } | |
124 | |
589 | 125 int getLast() |
126 { | |
127 return sgroot->getLast(); | |
128 } | |
129 | |
793 | 130 SceneGraphPtr getLight(int id) |
131 { | |
132 return sgroot->getLight(id); | |
133 } | |
134 | |
135 void OnLightSwitch(int id) | |
136 { | |
137 sgroot->OnLightSwitch(id); | |
138 } | |
139 | |
140 void OffLightSwitch(int id) | |
141 { | |
142 sgroot->OffLightSwitch(id); | |
143 } | |
144 | |
145 void OnLightSysSwitch() | |
146 { | |
147 sgroot->OnLightSysSwitch(); | |
148 } | |
149 | |
150 void OffLightSysSwitch() | |
151 { | |
152 sgroot->OffLightSysSwitch(); | |
153 } | |
154 | |
283 | 155 }; |
156 | |
539 | 157 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK |
158 | |
159 | |
283 | 160 #endif |
161 |