Mercurial > hg > Game > Cerium
annotate Renderer/Engine/SceneGraphRoot.h @ 987:6c3dffa8996f draft akira
merge
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 02 Oct 2010 03:19:33 +0900 |
parents | 52c4353308e7 |
children | ceca625af064 |
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" | |
562 | 8 #include <sys/types.h> |
9 | |
10 typedef struct { | |
11 caddr_t file_mmap; | |
12 off_t size; | |
13 } st_mmap_t; | |
14 | |
15 class Application; | |
283 | 16 |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
17 class SceneGraphRoot; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
18 typedef void (*regist_func)(SceneGraphRoot *sgroot); |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
19 |
283 | 20 class SceneGraphRoot { |
21 public: | |
22 /* Constructor, Destructor */ | |
23 SceneGraphRoot(float w, float h); | |
558 | 24 ~SceneGraphRoot(); |
283 | 25 |
26 /* Variables */ | |
562 | 27 TaskManager *tmanager; |
28 | |
283 | 29 // xml から読み込んだ、オリジナルの SceneGraph |
575
341f1f881a9b
Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
565
diff
changeset
|
30 // Static Singleton |
341f1f881a9b
Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
565
diff
changeset
|
31 // SceneGraphPtr *sg_src; |
341f1f881a9b
Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
565
diff
changeset
|
32 // int sg_src_length; |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
33 SceneGraphPtr list; |
283 | 34 |
35 // move, collision 用の SceneGraph (tree) | |
36 SceneGraphPtr sg_exec_tree; | |
37 | |
38 // 描画用の SceneGraph List (tree) | |
39 SceneGraphPtr sg_draw_tree; | |
40 | |
41 // sg_exec_tree に対応する list | |
42 SceneGraphPtr sg_available_list; | |
43 | |
44 // sg_draw_tree に対応する list | |
45 // draw_tree は描画後削除される | |
46 SceneGraphPtr sg_remove_list; | |
47 | |
48 SceneGraphArrayPtr sg_array1; | |
49 SceneGraphArrayPtr sg_array2; | |
50 SceneGraphArrayPtr sg_curArray; | |
51 | |
52 // コントローラーオブジェクト (Keyboard, Joystick, ..) | |
53 Pad *controller; | |
54 | |
55 // カメラオブジェクト | |
56 Camera *camera; | |
57 | |
597 | 58 // 光源のオブジェクト |
761 | 59 SceneGraphPtr light[4]; |
792 | 60 int light_switch[4]; |
61 int light_sysswitch; | |
677
24054155368c
add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
653
diff
changeset
|
62 // 光源の疑似 xml file |
761 | 63 // 光源は4つで決め打ち。 |
64 // 4 * lightnum (4) = 16; | |
65 float light_vector[16]; | |
597 | 66 |
283 | 67 // SceneGraphIterator |
68 SceneGraphIteratorPtr iterator; | |
69 | |
677
24054155368c
add Load light info for some spe
yutaka@henri.cr.ie.u-ryukyu.ac.jp
parents:
653
diff
changeset
|
70 // 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
|
71 int tid; |
591 | 72 |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
73 // move task test flag |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
74 int move_finish_flag; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
75 |
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 regist_func regist; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
78 // application で実行する task |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
79 HTaskPtr move_exec_task; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
80 |
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 int screen_w; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
83 int screen_h; |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
84 |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
85 |
283 | 86 /** |
87 * Functions | |
88 */ | |
89 /* User API */ | |
539 | 90 void createFromXMLfile(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
|
91 void createFromXMLmemory(TaskManager *manager, SceneGraph * node, char *data, int len); |
283 | 92 SceneGraphPtr createSceneGraph(int id); |
558 | 93 SceneGraphPtr createSceneGraph(); |
562 | 94 SceneGraphPtr createSceneGraph(const char *name); |
95 int getSgid(const char *name); | |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
96 void appTaskRegist(regist_func new_regist); |
562 | 97 |
283 | 98 void setSceneData(SceneGraphPtr sg); |
558 | 99 Pad *getController(); |
100 SceneGraphIteratorPtr getIterator(); | |
283 | 101 SceneGraphIteratorPtr getIterator(SceneGraphPtr list); |
558 | 102 CameraPtr getCamera(); |
761 | 103 SceneGraphPtr getLight(int id); |
793 | 104 void OnLightSwitch(int id); |
105 void OffLightSwitch(int id); | |
106 void OnLightSysSwitch(); | |
107 void OffLightSysSwitch(); | |
969
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
882
diff
changeset
|
108 |
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
882
diff
changeset
|
109 /* GameTask 生成用 */ |
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
882
diff
changeset
|
110 HTaskPtr wait_game_task; |
869 | 111 void set_game_task(int id, void *property, int size, PostFunction post_func); |
969
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
882
diff
changeset
|
112 void set_game_task(int id, void *property, void* pad, int size, PostFunction post_func); |
882 | 113 void set_move_task(SceneGraphPtr node, int move, void *property, int size, PostFunction post_func); |
969
52c4353308e7
add new function for dandy.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
882
diff
changeset
|
114 void set_pad_task(SceneGraphPtr node, int move, void *property, int size, PostFunction post_func); |
283 | 115 |
116 /* Other System API */ | |
117 void allExecute(int screen_w, int screen_h); | |
758 | 118 void oneExecute(int screen_w, int screen_h); |
558 | 119 void checkRemove(); |
120 SceneGraphPtr getExecuteSceneGraph(); | |
121 SceneGraphPtr getDrawSceneGraph(); | |
122 void updateControllerState(); | |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
123 void regist_execute(); |
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
758
diff
changeset
|
124 void move_finish(); |
793 | 125 float* getLightVector(); |
126 int* getLightSwitch(); | |
127 int getLightSysSwitch(); | |
283 | 128 |
539 | 129 void speExecute(int screen_w, int screen_h); |
562 | 130 void speExecute(int screen_w, int screen_h, Application *app); |
539 | 131 |
283 | 132 /* System API */ |
133 void registSceneGraph(SceneGraphPtr sg); | |
562 | 134 void registSceneGraphList(SceneGraphPtr sg); |
135 void addSceneGraphList(TaskManager *manager, SceneGraphPtr tmp); | |
283 | 136 void addNext(SceneGraphPtr sg); |
137 void allRemove(SceneGraphPtr list); | |
565 | 138 |
575
341f1f881a9b
Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
565
diff
changeset
|
139 int getLast() ; |
565 | 140 |
283 | 141 }; |
142 | |
143 typedef SceneGraphRoot *SceneGraphRootPtr; | |
144 | |
145 | |
539 | 146 // 大域変数は無くすこと |
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
|
147 //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
|
148 //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
|
149 //extern SceneGraphRoot *sgroot_B; |
562 | 150 |
151 #endif | |
558 | 152 |
153 /* end */ |