Mercurial > hg > Game > Cerium
annotate Renderer/Engine/viewer.h @ 1161:cc1a50cac83d draft
use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
author | Yutaka_Kinjyo |
---|---|
date | Thu, 05 May 2011 00:15:43 +0900 |
parents | 5664473b4dba |
children | b8adf4e95e96 de5d434044e3 |
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 |
1002 | 111 void task_array_init(int id, int task_num, int param, int inData_num, int outData_num) |
112 { | |
113 sgroot->task_array_init(id, task_num, param, inData_num, outData_num); | |
114 } | |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
115 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
|
116 { |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
117 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
|
118 } |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
119 void set_pad_task(SceneGraphPtr node, int move, void *property, int size) |
886 | 120 { |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
121 sgroot->set_pad_task(node, move, property, size); |
869 | 122 } |
123 | |
671
7761ebf9c62a
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
124 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
|
125 { |
7761ebf9c62a
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
126 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
|
127 } |
7761ebf9c62a
fix several Renderer/Test with (void*)sgroot.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
589
diff
changeset
|
128 |
558 | 129 void createFromXMLfile(const char *file) |
130 { | |
131 sgroot->createFromXMLfile(manager, file); | |
132 } | |
133 | |
969
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
134 Pad * getController() |
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
135 { |
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
136 return sgroot->getController(); |
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
137 } |
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
138 |
558 | 139 SceneGraph * createSceneGraph(int id) |
140 { | |
141 return sgroot->createSceneGraph(id); | |
142 } | |
143 | |
562 | 144 SceneGraph * createSceneGraph(const char *id) |
145 { | |
969
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
928
diff
changeset
|
146 return sgroot->createSceneGraph(id); |
562 | 147 } |
148 | |
149 int getSgid(const char *id) | |
150 { | |
151 return sgroot->getSgid(id); | |
152 } | |
153 | |
558 | 154 SceneGraph * createSceneGraph() |
155 { | |
156 return sgroot->createSceneGraph(); | |
157 } | |
158 | |
159 void setSceneData(SceneGraph *g) | |
160 { | |
161 sgroot->setSceneData(g); | |
162 } | |
163 | |
589 | 164 int getLast() |
165 { | |
166 return sgroot->getLast(); | |
167 } | |
168 | |
793 | 169 SceneGraphPtr getLight(int id) |
170 { | |
171 return sgroot->getLight(id); | |
172 } | |
173 | |
174 void OnLightSwitch(int id) | |
175 { | |
176 sgroot->OnLightSwitch(id); | |
177 } | |
178 | |
179 void OffLightSwitch(int id) | |
180 { | |
181 sgroot->OffLightSwitch(id); | |
182 } | |
183 | |
184 void OnLightSysSwitch() | |
185 { | |
186 sgroot->OnLightSysSwitch(); | |
187 } | |
188 | |
189 void OffLightSysSwitch() | |
190 { | |
191 sgroot->OffLightSysSwitch(); | |
192 } | |
193 | |
283 | 194 }; |
195 | |
539 | 196 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK |
197 | |
198 | |
283 | 199 #endif |
200 |