Mercurial > hg > Members > kono > Cerium
annotate Renderer/Engine/SceneGraph.h @ 751:8b45afad160f
add task/DataLoad task/DataUpdate
author | hiroki |
---|---|
date | Mon, 25 Jan 2010 19:25:40 +0900 |
parents | b7376415fa5f |
children | 24a37fe8419a |
rev | line source |
---|---|
283 | 1 #ifndef INCLUDED_SCENE_GRAPH |
2 #define INCLUDED_SCENE_GRAPH | |
3 | |
507 | 4 #include "polygon.h" |
5 #include "Pad.h" | |
6 #include "TaskManager.h" | |
283 | 7 class SceneGraph; |
8 | |
656
d0b8860c17f8
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
|
9 //typedef void (*move_func)(SceneGraph* node, int screen_w, int screen_h); |
d0b8860c17f8
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, void *sgroot, int screen_w, int screen_h); |
d0b8860c17f8
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 (*collision_func)(SceneGraph* node, int screen_w, int screen_h, |
d0b8860c17f8
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 // SceneGraph* tree); |
d0b8860c17f8
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 typedef void (*collision_func)(SceneGraph* node, void *sgroot, int screen_w, int screen_h, |
507 | 14 SceneGraph* tree); |
283 | 15 typedef SceneGraph* SceneGraphPtr; |
16 | |
17 class SceneGraph : public Polygon { | |
18 public: | |
19 SceneGraph(void); | |
507 | 20 SceneGraph(TaskManager *manager, xmlNodePtr surface); |
283 | 21 SceneGraph(SceneGraphPtr orig); |
22 ~SceneGraph(void); | |
23 | |
656
d0b8860c17f8
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
|
24 // add |
d0b8860c17f8
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
|
25 void *sgroot; |
d0b8860c17f8
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
|
26 |
283 | 27 // Node がもつ状態変数(というべきか否か |
28 // xyz,angle ぐらいあればおk? | |
29 float stack_xyz[3]; | |
30 float stack_angle[3]; | |
507 | 31 int id; |
593
6f741ab60749
sending and moving of multi xml work (linda)
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents:
507
diff
changeset
|
32 // Objectのシーケンス番号(Linda) |
6f741ab60749
sending and moving of multi xml work (linda)
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents:
507
diff
changeset
|
33 // とりあえず動かしたいので追加 |
6f741ab60749
sending and moving of multi xml work (linda)
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents:
507
diff
changeset
|
34 int seq; |
6f741ab60749
sending and moving of multi xml work (linda)
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents:
507
diff
changeset
|
35 |
507 | 36 int property_size; |
37 void* propertyptr; | |
283 | 38 |
39 // xml ファイルから生成した時のオブジェクトリスト | |
40 SceneGraphPtr next; | |
41 SceneGraphPtr prev; | |
42 SceneGraphPtr last; | |
43 | |
44 // Tree Structure | |
45 SceneGraphPtr parent; | |
46 SceneGraphPtr brother; | |
47 SceneGraphPtr children; | |
48 SceneGraphPtr lastChild; | |
49 | |
50 // Tree から削除されていたら 1 をセット。default = 0 | |
51 int flag_remove; | |
52 | |
53 // SceneGraph ID (SGList.h) | |
54 int sgid; | |
55 | |
56 // この SceneGraph は描画するものかどうか (0:しない 1:する | |
57 int flag_drawable; | |
58 | |
59 // anime frame num | |
60 int frame; | |
61 | |
507 | 62 // Group ID |
63 int gid; | |
64 | |
283 | 65 // 関数ポインタ |
66 move_func move; | |
67 collision_func collision; | |
68 | |
69 // desutroctor で呼ばれる | |
70 void (SceneGraph::*finalize)(void); | |
71 | |
72 void init(void); | |
73 void finalize_original(void); | |
74 void finalize_copy(void); | |
75 void move_execute(int screen_w, int screen_h); | |
76 void collision_check(int screen_w, int screen_h, SceneGraphPtr tree); | |
77 void all_execute(int screen_w, int screen_h); | |
78 | |
79 void add_next(SceneGraphPtr next); | |
80 SceneGraphPtr addChild(SceneGraphPtr child); | |
81 SceneGraphPtr addBrother(SceneGraphPtr bro); | |
82 SceneGraphPtr clone(void); | |
83 SceneGraphPtr clone(void *buf); | |
84 SceneGraphPtr searchSceneGraph(const char *name); | |
85 void set_move_collision(move_func new_move, collision_func new_collision); | |
656
d0b8860c17f8
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
|
86 void set_move_collision(move_func new_move, collision_func new_collision, void *sgroot); |
283 | 87 void remove(void); |
88 SceneGraphPtr realRemoveFromTree(SceneGraphPtr tree); | |
89 SceneGraphPtr realRemoveFromList(SceneGraphPtr list); | |
90 int isRemoved(void); | |
91 | |
92 static SceneGraphPtr createSceneGraph(int id); | |
93 | |
94 void translate(float x, float y, float z); | |
95 void translateX(float x); | |
96 void translateY(float y); | |
97 void translateZ(float z); | |
98 | |
99 | |
100 void tree_check(void); | |
101 void print_member(void); | |
507 | 102 void get_data(TaskManager *manager, xmlNodePtr cur); |
283 | 103 void delete_data(void); |
507 | 104 |
105 SDL_Surface* load_decode_image(char *image_name, xmlNodePtr cur); | |
106 int makeTapestries(TaskManager *manager, SDL_Surface *texture_image, int id); | |
107 void get_image(TaskManager *manager, xmlNodePtr cur); | |
283 | 108 }; |
109 | |
110 #endif | |
111 | |
507 | 112 // 帯域変数を使うのは禁止なので削除すること |
283 | 113 // オリジナル (Linked List) |
114 extern SceneGraphPtr scene_graph; | |
115 | |
116 // 描画用 (同じオブジェクトが複数ある) Tree | |
117 extern SceneGraphPtr scene_graph_view; |