annotate Renderer/Engine/SceneGraph.h @ 801:eb6add789a24 draft

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