Mercurial > hg > Game > Cerium
annotate Renderer/Engine/SceneGraph.h @ 930:b58861019a28 draft
GL drawing speed up
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 30 Jul 2010 21:46:04 +0900 |
parents | 1cb89ec2e796 |
children | 27df980045b5 |
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: | |
21 SceneGraph(void); | |
539 | 22 SceneGraph(TaskManager *manager, xmlNodePtr surface); |
283 | 23 SceneGraph(SceneGraphPtr orig); |
24 ~SceneGraph(void); | |
25 | |
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
|
26 // 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
|
27 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
|
28 |
283 | 29 // Node がもつ状態変数(というべきか否か |
30 // xyz,angle ぐらいあればおk? | |
31 float stack_xyz[3]; | |
32 float stack_angle[3]; | |
539 | 33 int id; |
593
75c78f8fba24
sending and moving of multi xml work (linda)
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents:
539
diff
changeset
|
34 // Objectのシーケンス番号(Linda) |
75c78f8fba24
sending and moving of multi xml work (linda)
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents:
539
diff
changeset
|
35 // とりあえず動かしたいので追加 |
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
|
36 int seq, seq_rd, resend_flag; |
860 | 37 |
539 | 38 int property_size; |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
724
diff
changeset
|
39 void *propertyptr; |
882 | 40 int move_id; |
41 int coll_id; | |
42 PostFunction post_func; | |
766 | 43 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
|
44 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
|
45 |
283 | 46 |
47 // xml ファイルから生成した時のオブジェクトリスト | |
48 SceneGraphPtr next; | |
49 SceneGraphPtr prev; | |
50 SceneGraphPtr last; | |
51 | |
52 // Tree Structure | |
53 SceneGraphPtr parent; | |
54 SceneGraphPtr brother; | |
55 SceneGraphPtr children; | |
56 SceneGraphPtr lastChild; | |
57 | |
58 // Tree から削除されていたら 1 をセット。default = 0 | |
59 int flag_remove; | |
60 | |
61 // SceneGraph ID (SGList.h) | |
62 int sgid; | |
63 | |
64 // この SceneGraph は描画するものかどうか (0:しない 1:する | |
65 int flag_drawable; | |
66 | |
67 // anime frame num | |
68 int frame; | |
69 | |
539 | 70 // Group ID |
71 int gid; | |
72 | |
930 | 73 // GL ID |
74 GLuint gl_tex; | |
75 | |
283 | 76 // 関数ポインタ |
77 move_func move; | |
78 collision_func collision; | |
759
45f7ab7101ea
first of all commit, not work Rendering/Test/create_task
hiroki
parents:
724
diff
changeset
|
79 create_sg_func create_sg; |
283 | 80 |
81 // desutroctor で呼ばれる | |
82 void (SceneGraph::*finalize)(void); | |
83 | |
84 void init(void); | |
85 void finalize_original(void); | |
86 void finalize_copy(void); | |
87 void move_execute(int screen_w, int screen_h); | |
88 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
|
89 void create_sg_execute(); |
283 | 90 void all_execute(int screen_w, int screen_h); |
91 | |
92 void add_next(SceneGraphPtr next); | |
93 SceneGraphPtr addChild(SceneGraphPtr child); | |
94 SceneGraphPtr addBrother(SceneGraphPtr bro); | |
95 SceneGraphPtr clone(void); | |
96 SceneGraphPtr clone(void *buf); | |
97 SceneGraphPtr searchSceneGraph(const char *name); | |
98 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
|
99 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
|
100 void set_move_collision(move_func new_move, collision_func new_collision, create_sg_func new_create_sg); |
283 | 101 void remove(void); |
102 SceneGraphPtr realRemoveFromTree(SceneGraphPtr tree); | |
103 SceneGraphPtr realRemoveFromList(SceneGraphPtr list); | |
104 int isRemoved(void); | |
105 | |
106 static SceneGraphPtr createSceneGraph(int id); | |
107 | |
108 void translate(float x, float y, float z); | |
109 void translateX(float x); | |
110 void translateY(float y); | |
111 void translateZ(float z); | |
112 | |
113 | |
114 void tree_check(void); | |
115 void print_member(void); | |
539 | 116 void get_data(TaskManager *manager, xmlNodePtr cur); |
283 | 117 void delete_data(void); |
539 | 118 |
119 SDL_Surface* load_decode_image(char *image_name, xmlNodePtr cur); | |
120 int makeTapestries(TaskManager *manager, SDL_Surface *texture_image, int id); | |
121 void get_image(TaskManager *manager, xmlNodePtr cur); | |
283 | 122 }; |
123 | |
124 #endif | |
125 | |
539 | 126 // 帯域変数を使うのは禁止なので削除すること |
283 | 127 // オリジナル (Linked List) |
128 extern SceneGraphPtr scene_graph; | |
129 | |
130 // 描画用 (同じオブジェクトが複数ある) Tree | |
131 extern SceneGraphPtr scene_graph_view; |