Mercurial > hg > Game > Cerium
annotate Renderer/Engine/SceneGraphRoot.h @ 1798:3babb36ac459 draft
array(bmskip table) allocate size change 256 to 256*sizeof(int)
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 05 Dec 2013 16:41:38 +0900 |
parents | ada0b6ff6575 |
children |
rev | line source |
---|---|
283 | 1 #ifndef INCLUDED_SCENE_GRAPH_ROOT |
2 #define INCLUDED_SCENE_GRAPH_ROOT | |
3 | |
539 | 4 #include "SceneGraph.h" |
5 #include "SceneGraphArray.h" | |
6 #include "Camera.h" | |
7 #include "SceneGraphIterator.h" | |
1003
37842bbd35f0
game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1002
diff
changeset
|
8 #include "GTaskArray.h" |
562 | 9 #include <sys/types.h> |
10 | |
11 typedef struct { | |
12 caddr_t file_mmap; | |
13 off_t size; | |
14 } st_mmap_t; | |
15 | |
16 class Application; | |
283 | 17 |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
18 class SceneGraphRoot; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
19 typedef void (*regist_func)(SceneGraphRoot *sgroot); |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
20 |
283 | 21 class SceneGraphRoot { |
22 public: | |
23 /* Constructor, Destructor */ | |
1143 | 24 SceneGraphRoot(float w, float h, TaskManager *manager); |
558 | 25 ~SceneGraphRoot(); |
283 | 26 |
27 /* Variables */ | |
562 | 28 TaskManager *tmanager; |
29 | |
283 | 30 // xml から読み込んだ、オリジナルの SceneGraph |
575
341f1f881a9b
Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
565
diff
changeset
|
31 // Static Singleton |
341f1f881a9b
Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
565
diff
changeset
|
32 // SceneGraphPtr *sg_src; |
341f1f881a9b
Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
565
diff
changeset
|
33 // int sg_src_length; |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
34 SceneGraphPtr list; |
283 | 35 |
36 // move, collision 用の SceneGraph (tree) | |
37 SceneGraphPtr sg_exec_tree; | |
38 | |
39 // 描画用の SceneGraph List (tree) | |
40 SceneGraphPtr sg_draw_tree; | |
41 | |
42 // sg_exec_tree に対応する list | |
43 SceneGraphPtr sg_available_list; | |
44 | |
45 // sg_draw_tree に対応する list | |
46 // draw_tree は描画後削除される | |
47 SceneGraphPtr sg_remove_list; | |
48 | |
49 SceneGraphArrayPtr sg_array1; | |
50 SceneGraphArrayPtr sg_array2; | |
51 SceneGraphArrayPtr sg_curArray; | |
52 | |
53 // コントローラーオブジェクト (Keyboard, Joystick, ..) | |
54 Pad *controller; | |
55 | |
56 // カメラオブジェクト | |
57 Camera *camera; | |
58 | |
597 | 59 // 光源のオブジェクト |
761 | 60 SceneGraphPtr light[4]; |
792 | 61 int light_switch[4]; |
62 int light_sysswitch; | |
677
24054155368c
add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
653
diff
changeset
|
63 // 光源の疑似 xml file |
761 | 64 // 光源は4つで決め打ち。 |
65 // 4 * lightnum (4) = 16; | |
66 float light_vector[16]; | |
597 | 67 |
283 | 68 // SceneGraphIterator |
69 SceneGraphIteratorPtr iterator; | |
70 | |
677
24054155368c
add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
653
diff
changeset
|
71 // fd of Linda taple space |
24054155368c
add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
653
diff
changeset
|
72 int tid; |
591 | 73 |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
74 // move task test flag |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
75 int move_finish_flag; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
76 |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
77 // 関数ポインタ |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
78 regist_func regist; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
79 // application で実行する task |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
80 HTaskPtr move_exec_task; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
81 |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
82 // とりあえず |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
83 int screen_w; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
84 int screen_h; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
85 |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
86 |
283 | 87 /** |
88 * Functions | |
89 */ | |
90 /* User API */ | |
1211 | 91 void createStringFont(TaskManager *manager, SceneGraphPtr root,const char *string, int pixeles, int screen_w,int screen_h, Uint32 color); |
92 void createFont(TaskManager *manager,const char *font,int pixels,Uint32 color,const char *filename, int len, char **obj_name); | |
539 | 93 void createFromXMLfile(TaskManager *manager, const char *); |
1251
6da91e7cbffb
improve create From COLLADA
Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp>
parents:
1226
diff
changeset
|
94 void createFromCOLLADAfile(TaskManager *manager, const char *); |
580
ec9dd24c2dc8
add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
575
diff
changeset
|
95 void createFromXMLmemory(TaskManager *manager, SceneGraph * node, char *data, int len); |
283 | 96 SceneGraphPtr createSceneGraph(int id); |
558 | 97 SceneGraphPtr createSceneGraph(); |
562 | 98 SceneGraphPtr createSceneGraph(const char *name); |
99 int getSgid(const char *name); | |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
100 void appTaskRegist(regist_func new_regist); |
562 | 101 |
283 | 102 void setSceneData(SceneGraphPtr sg); |
558 | 103 Pad *getController(); |
104 SceneGraphIteratorPtr getIterator(); | |
283 | 105 SceneGraphIteratorPtr getIterator(SceneGraphPtr list); |
558 | 106 CameraPtr getCamera(); |
761 | 107 SceneGraphPtr getLight(int id); |
793 | 108 void OnLightSwitch(int id); |
109 void OffLightSwitch(int id); | |
110 void OnLightSysSwitch(); | |
111 void OffLightSysSwitch(); | |
969
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
882
diff
changeset
|
112 |
1003
37842bbd35f0
game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1002
diff
changeset
|
113 /* GameTaskArray 生成用 */ |
37842bbd35f0
game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1002
diff
changeset
|
114 GTaskArrayPtr gtask_array; |
1002 | 115 void task_array_init(int id, int task_num, int param, int inData_num, int outData_num); |
1003
37842bbd35f0
game_task keep up with task_array.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1002
diff
changeset
|
116 void create_task_array(); |
1002 | 117 void task_array_finish(); |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
118 void set_gtask_array(int id, void *property, int size, PostFunction post_func); |
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
119 void set_gtask_array(int id, void *property, void* pad, int size, PostFunction post_func); |
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
120 void set_game_task(int id, void *property, int size); |
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
121 void set_game_task(int id, void *property, void *pad, int size); |
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
122 void set_move_task(SceneGraphPtr node, int move, void *property, int size); |
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
1003
diff
changeset
|
123 void set_pad_task(SceneGraphPtr node, int move, void *property, int size); |
283 | 124 |
125 /* Other System API */ | |
126 void allExecute(int screen_w, int screen_h); | |
1254 | 127 void treeApply(int screen_w, int screen_h); |
1324
ada0b6ff6575
add diffuse parameter
Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents:
1292
diff
changeset
|
128 void lightCalc(SceneGraphPtr cur_parent); |
1042
d0bb27bf985b
AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1033
diff
changeset
|
129 void flip(); |
d0bb27bf985b
AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1033
diff
changeset
|
130 void copyTree(SceneGraphPtr from, SceneGraphPtr to); |
1226
636dfdc30176
new API for SceneGraph
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1211
diff
changeset
|
131 void transTree(SceneGraphPtr t, SceneGraphPtr cur_parent); |
1042
d0bb27bf985b
AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1033
diff
changeset
|
132 |
d0bb27bf985b
AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1033
diff
changeset
|
133 // void oneExecute(int screen_w, int screen_h); |
558 | 134 void checkRemove(); |
135 SceneGraphPtr getExecuteSceneGraph(); | |
136 SceneGraphPtr getDrawSceneGraph(); | |
137 void updateControllerState(); | |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
138 void regist_execute(); |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
139 void move_finish(); |
793 | 140 float* getLightVector(); |
141 int* getLightSwitch(); | |
142 int getLightSysSwitch(); | |
283 | 143 |
1042
d0bb27bf985b
AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1033
diff
changeset
|
144 // void speExecute(int screen_w, int screen_h); |
d0bb27bf985b
AllExecute speparation.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1033
diff
changeset
|
145 // void speExecute(int screen_w, int screen_h, Application *app); |
539 | 146 |
1292
90efd2aac2cb
add matrix test and debug light vector
Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents:
1254
diff
changeset
|
147 // initialize API |
90efd2aac2cb
add matrix test and debug light vector
Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents:
1254
diff
changeset
|
148 void light_init(); |
90efd2aac2cb
add matrix test and debug light vector
Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents:
1254
diff
changeset
|
149 |
283 | 150 /* System API */ |
151 void registSceneGraph(SceneGraphPtr sg); | |
562 | 152 void registSceneGraphList(SceneGraphPtr sg); |
153 void addSceneGraphList(TaskManager *manager, SceneGraphPtr tmp); | |
283 | 154 void addNext(SceneGraphPtr sg); |
155 void allRemove(SceneGraphPtr list); | |
565 | 156 |
575
341f1f881a9b
Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
565
diff
changeset
|
157 int getLast() ; |
565 | 158 |
283 | 159 }; |
160 | |
161 typedef SceneGraphRoot *SceneGraphRootPtr; | |
162 | |
163 | |
539 | 164 // 大域変数は無くすこと |
653
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
597
diff
changeset
|
165 //extern SceneGraphRoot *sgroot; |
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
597
diff
changeset
|
166 //extern SceneGraphRoot *sgroot_A; |
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
597
diff
changeset
|
167 //extern SceneGraphRoot *sgroot_B; |
562 | 168 |
169 #endif | |
558 | 170 |
171 /* end */ |