Mercurial > hg > Game > Cerium
annotate Renderer/Engine/SceneGraph.h @ 1208:de5d434044e3 draft
merge
author | Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 21 Jul 2011 23:01:42 +0900 |
parents | b93ff55ba015 |
children | 0ee23180d301 |
rev | line source |
---|---|
283 | 1 #ifndef INCLUDED_SCENE_GRAPH |
2 #define INCLUDED_SCENE_GRAPH | |
3 | |
539 | 4 #include "polygon.h" |
5 #include "Pad.h" | |
6 #include "TaskManager.h" | |
930 | 7 #include "texture.h" |
283 | 8 class SceneGraph; |
9 | |
653
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
593
diff
changeset
|
10 //typedef void (*move_func)(SceneGraph* node, int screen_w, int screen_h); |
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
593
diff
changeset
|
11 typedef void (*move_func)(SceneGraph* node, void *sgroot, int screen_w, int screen_h); |
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
593
diff
changeset
|
12 //typedef void (*collision_func)(SceneGraph* node, int screen_w, int screen_h, |
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
593
diff
changeset
|
13 // SceneGraph* tree); |
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
593
diff
changeset
|
14 typedef void (*collision_func)(SceneGraph* node, void *sgroot, int screen_w, int screen_h, |
539 | 15 SceneGraph* tree); |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
724
diff
changeset
|
16 typedef void (*create_sg_func)(void *sgroot, void *property, void *update_property); |
283 | 17 typedef SceneGraph* SceneGraphPtr; |
18 | |
19 class SceneGraph : public Polygon { | |
20 public: | |
1143 | 21 SceneGraph(TaskManager *manager); |
539 | 22 SceneGraph(TaskManager *manager, xmlNodePtr surface); |
1169 | 23 SceneGraph(TaskManager *manager, SceneGraphPtr orig); |
1208 | 24 SceneGraph(TaskManager *manager, char* string_name, int pixels, Uint32 len , char* obj_name); |
283 | 25 ~SceneGraph(void); |
26 | |
653
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
593
diff
changeset
|
27 // add |
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
593
diff
changeset
|
28 void *sgroot; |
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
593
diff
changeset
|
29 |
283 | 30 // Node がもつ状態変数(というべきか否か |
31 // xyz,angle ぐらいあればおk? | |
32 float stack_xyz[3]; | |
33 float stack_angle[3]; | |
539 | 34 int id; |
593
75c78f8fba24
sending and moving of multi xml work (linda)
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents:
539
diff
changeset
|
35 // Objectのシーケンス番号(Linda) |
75c78f8fba24
sending and moving of multi xml work (linda)
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents:
539
diff
changeset
|
36 // とりあえず動かしたいので追加 |
847
4482720bbba7
replace rd() to wait_rd(). and if reply of wait_rd() is NULL, client request one more rd(). for wait_rd() cannot get last changed tuple.
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
843
diff
changeset
|
37 int seq, seq_rd, resend_flag; |
860 | 38 |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
942
diff
changeset
|
39 // task 生成用の情報 |
539 | 40 int property_size; |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
724
diff
changeset
|
41 void *propertyptr; |
882 | 42 int move_id; |
43 int coll_id; | |
766 | 44 memaddr property; |
768
06302c1dc87d
add add spe/chain_move Test/property_chain, not workd
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
766
diff
changeset
|
45 memaddr update_property; |
06302c1dc87d
add add spe/chain_move Test/property_chain, not workd
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
766
diff
changeset
|
46 |
283 | 47 |
48 // xml ファイルから生成した時のオブジェクトリスト | |
49 SceneGraphPtr next; | |
50 SceneGraphPtr prev; | |
51 SceneGraphPtr last; | |
52 | |
53 // Tree Structure | |
54 SceneGraphPtr parent; | |
55 SceneGraphPtr brother; | |
56 SceneGraphPtr children; | |
57 SceneGraphPtr lastChild; | |
58 | |
59 // Tree から削除されていたら 1 をセット。default = 0 | |
60 int flag_remove; | |
61 | |
62 // SceneGraph ID (SGList.h) | |
63 int sgid; | |
64 | |
65 // この SceneGraph は描画するものかどうか (0:しない 1:する | |
66 int flag_drawable; | |
67 | |
68 // anime frame num | |
69 int frame; | |
70 | |
539 | 71 // Group ID |
72 int gid; | |
73 | |
283 | 74 // 関数ポインタ |
75 move_func move; | |
76 collision_func collision; | |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
724
diff
changeset
|
77 create_sg_func create_sg; |
283 | 78 |
1208 | 79 // フォントデータ |
80 void create_font_data(TaskManager *manager,char *font, int pixels,Uint32 color, char *filename); | |
81 void get_font_image(TaskManager *manager,char *font, int pixels,Uint32 color, char *name); | |
82 void createFont(TaskManager *manager); | |
83 void conv(char *str, int length, u_int32_t *out); | |
84 SDL_Surface* load_font_image(char *font, int pixels,Uint32 color, char *string_name); | |
85 | |
283 | 86 // desutroctor で呼ばれる |
87 void (SceneGraph::*finalize)(void); | |
88 | |
89 void init(void); | |
90 void finalize_original(void); | |
91 void finalize_copy(void); | |
92 void move_execute(int screen_w, int screen_h); | |
93 void collision_check(int screen_w, int screen_h, SceneGraphPtr tree); | |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
724
diff
changeset
|
94 void create_sg_execute(); |
283 | 95 void all_execute(int screen_w, int screen_h); |
96 | |
97 void add_next(SceneGraphPtr next); | |
98 SceneGraphPtr addChild(SceneGraphPtr child); | |
99 SceneGraphPtr addBrother(SceneGraphPtr bro); | |
1136 | 100 SceneGraphPtr clone(TaskManager *manager); |
1169 | 101 SceneGraphPtr clone(TaskManager *manager, void *buf); |
283 | 102 SceneGraphPtr searchSceneGraph(const char *name); |
1033
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
942
diff
changeset
|
103 void set_move_collision(move_func new_move); |
a9581a9df440
add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
942
diff
changeset
|
104 void set_move_collision(collision_func new_collision); |
283 | 105 void set_move_collision(move_func new_move, collision_func new_collision); |
653
7a311860a76e
remove global variable "sgroot" , add SgChange.{cc, h} SgMain.cc SgRootChange.{cc, h}
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents:
593
diff
changeset
|
106 void set_move_collision(move_func new_move, collision_func new_collision, void *sgroot); |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
724
diff
changeset
|
107 void set_move_collision(move_func new_move, collision_func new_collision, create_sg_func new_create_sg); |
283 | 108 void remove(void); |
109 SceneGraphPtr realRemoveFromTree(SceneGraphPtr tree); | |
110 SceneGraphPtr realRemoveFromList(SceneGraphPtr list); | |
111 int isRemoved(void); | |
112 | |
113 static SceneGraphPtr createSceneGraph(int id); | |
114 | |
115 void translate(float x, float y, float z); | |
116 void translateX(float x); | |
117 void translateY(float y); | |
118 void translateZ(float z); | |
119 | |
120 | |
121 void tree_check(void); | |
122 void print_member(void); | |
539 | 123 void get_data(TaskManager *manager, xmlNodePtr cur); |
283 | 124 void delete_data(void); |
539 | 125 |
1166
38111db531e0
bmp's black has 0 alpha value for compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
1143
diff
changeset
|
126 SDL_Surface* load_decode_image(char *filename, char *image_name, xmlNodePtr cur); |
539 | 127 int makeTapestries(TaskManager *manager, SDL_Surface *texture_image, int id); |
128 void get_image(TaskManager *manager, xmlNodePtr cur); | |
283 | 129 }; |
130 | |
131 #endif | |
132 | |
539 | 133 // 帯域変数を使うのは禁止なので削除すること |
283 | 134 // オリジナル (Linked List) |
135 extern SceneGraphPtr scene_graph; | |
136 | |
137 // 描画用 (同じオブジェクトが複数ある) Tree | |
138 extern SceneGraphPtr scene_graph_view; |