annotate Renderer/Engine/SceneGraph.h @ 869:bcc81531a672

set_game_task add to SceneGraphRoot.
author tkaito
date Sun, 27 Jun 2010 23:01:44 +0900
parents 649e4cb84683
children f525427ae30f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
1 #ifndef INCLUDED_SCENE_GRAPH
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
2 #define INCLUDED_SCENE_GRAPH
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
3
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
4 #include "polygon.h"
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
5 #include "Pad.h"
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
6 #include "TaskManager.h"
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
7 class SceneGraph;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
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
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
14 SceneGraph* tree);
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 724
diff changeset
15 typedef void (*create_sg_func)(void *sgroot, void *property, void *update_property);
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
16 typedef SceneGraph* SceneGraphPtr;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
17
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
18 class SceneGraph : public Polygon {
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
19 public:
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20 SceneGraph(void);
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
21 SceneGraph(TaskManager *manager, xmlNodePtr surface);
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
22 SceneGraph(SceneGraphPtr orig);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
23 ~SceneGraph(void);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
24
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
25 // 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
26 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
27
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
28 // Node がもつ状態変数(というべきか否か
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
29 // xyz,angle ぐらいあればおk?
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
30 float stack_xyz[3];
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
31 float stack_angle[3];
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
32 int id;
593
6f741ab60749 sending and moving of multi xml work (linda)
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents: 507
diff changeset
33 // Objectのシーケンス番号(Linda)
6f741ab60749 sending and moving of multi xml work (linda)
kazz@kazzone.st.ie.u-ryukyu.ac.jp
parents: 507
diff changeset
34 // とりあえず動かしたいので追加
847
8c78d15ea999 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
35 int seq, seq_rd, resend_flag;
860
649e4cb84683 Still on the way
yutaka@localhost.localdomain
parents: 847
diff changeset
36
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
37 int property_size;
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 724
diff changeset
38 void *propertyptr;
767
e4d635b1f018 add spe/univers_move
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 760
diff changeset
39 //void *property;
769
2a00c1f470b7 add add spe/chain_move Test/property_chain, not workd
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 767
diff changeset
40 //void *update_property;
767
e4d635b1f018 add spe/univers_move
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 760
diff changeset
41 memaddr property;
769
2a00c1f470b7 add add spe/chain_move Test/property_chain, not workd
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 767
diff changeset
42 memaddr update_property;
2a00c1f470b7 add add spe/chain_move Test/property_chain, not workd
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 767
diff changeset
43
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
44
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
45 // xml ファイルから生成した時のオブジェクトリスト
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
46 SceneGraphPtr next;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
47 SceneGraphPtr prev;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
48 SceneGraphPtr last;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
49
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
50 // Tree Structure
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
51 SceneGraphPtr parent;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
52 SceneGraphPtr brother;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
53 SceneGraphPtr children;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
54 SceneGraphPtr lastChild;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
55
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
56 // Tree から削除されていたら 1 をセット。default = 0
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
57 int flag_remove;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
58
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
59 // SceneGraph ID (SGList.h)
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
60 int sgid;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
61
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
62 // この SceneGraph は描画するものかどうか (0:しない 1:する
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
63 int flag_drawable;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
64
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
65 // anime frame num
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
66 int frame;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
67
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
68 // Group ID
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
69 int gid;
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
70
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
71 // 関数ポインタ
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
72 move_func move;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
73 collision_func collision;
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 724
diff changeset
74 create_sg_func create_sg;
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
75
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
76 // desutroctor で呼ばれる
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
77 void (SceneGraph::*finalize)(void);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
78
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
79 void init(void);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
80 void finalize_original(void);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
81 void finalize_copy(void);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
82 void move_execute(int screen_w, int screen_h);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
83 void collision_check(int screen_w, int screen_h, SceneGraphPtr tree);
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 724
diff changeset
84 void create_sg_execute();
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
85 void all_execute(int screen_w, int screen_h);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
86
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
87 void add_next(SceneGraphPtr next);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
88 SceneGraphPtr addChild(SceneGraphPtr child);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
89 SceneGraphPtr addBrother(SceneGraphPtr bro);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
90 SceneGraphPtr clone(void);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
91 SceneGraphPtr clone(void *buf);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
92 SceneGraphPtr searchSceneGraph(const char *name);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
93 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
94 void set_move_collision(move_func new_move, collision_func new_collision, void *sgroot);
760
24a37fe8419a first of all commit, not work Rendering/Test/create_task
hiroki
parents: 724
diff changeset
95 void set_move_collision(move_func new_move, collision_func new_collision, create_sg_func new_create_sg);
869
bcc81531a672 set_game_task add to SceneGraphRoot.
tkaito
parents: 860
diff changeset
96 void set_game_task(void *sgroot_, int id, void *property, int size, PostFunction post_func);
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
97 void remove(void);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
98 SceneGraphPtr realRemoveFromTree(SceneGraphPtr tree);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
99 SceneGraphPtr realRemoveFromList(SceneGraphPtr list);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
100 int isRemoved(void);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
101
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
102 static SceneGraphPtr createSceneGraph(int id);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
103
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
104 void translate(float x, float y, float z);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
105 void translateX(float x);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
106 void translateY(float y);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
107 void translateZ(float z);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
108
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
109
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
110 void tree_check(void);
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
111 void print_member(void);
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
112 void get_data(TaskManager *manager, xmlNodePtr cur);
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
113 void delete_data(void);
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
114
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
115 SDL_Surface* load_decode_image(char *image_name, xmlNodePtr cur);
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
116 int makeTapestries(TaskManager *manager, SDL_Surface *texture_image, int id);
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
117 void get_image(TaskManager *manager, xmlNodePtr cur);
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
118 };
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
119
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
120 #endif
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
121
507
735f76483bb2 Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
122 // 帯域変数を使うのは禁止なので削除すること
283
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
123 // オリジナル (Linked List)
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
124 extern SceneGraphPtr scene_graph;
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
125
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
126 // 描画用 (同じオブジェクトが複数ある) Tree
55ea4465b1a2 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
127 extern SceneGraphPtr scene_graph_view;