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
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"
930
b58861019a28 GL drawing speed up
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 882
diff changeset
7 #include "texture.h"
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
8 class SceneGraph;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
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
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
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
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
17 typedef SceneGraph* SceneGraphPtr;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
18
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
19 class SceneGraph : public Polygon {
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
20 public:
1143
786e800abfb4 minor fix
Yutaka_Kinjyo
parents: 1136
diff changeset
21 SceneGraph(TaskManager *manager);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
22 SceneGraph(TaskManager *manager, xmlNodePtr surface);
1169
b93ff55ba015 free TaskArray rbuf
Yutaka_Kinjyo
parents: 1166
diff changeset
23 SceneGraph(TaskManager *manager, SceneGraphPtr orig);
1208
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents: 1169
diff changeset
24 SceneGraph(TaskManager *manager, char* string_name, int pixels, Uint32 len , char* obj_name);
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
25 ~SceneGraph(void);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
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
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
30 // Node がもつ状態変数(というべきか否か
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
31 // xyz,angle ぐらいあればおk?
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
32 float stack_xyz[3];
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
33 float stack_angle[3];
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
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
63a08f3a468a Still on the way
yutaka@localhost.localdomain
parents: 847
diff changeset
38
1033
a9581a9df440 add application main method and task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 942
diff changeset
39 // task 生成用の情報
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
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
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 869
diff changeset
42 int move_id;
1cb89ec2e796 SceneGraphRoot::set_move_task add.
tkaito
parents: 869
diff changeset
43 int coll_id;
766
3541fe06be2b add spe/univers_move
hiroki@henri.cr.ie.u-ryukyu.ac.jp
parents: 759
diff changeset
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
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
47
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
48 // xml ファイルから生成した時のオブジェクトリスト
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
49 SceneGraphPtr next;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
50 SceneGraphPtr prev;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
51 SceneGraphPtr last;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
52
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
53 // Tree Structure
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
54 SceneGraphPtr parent;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
55 SceneGraphPtr brother;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
56 SceneGraphPtr children;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
57 SceneGraphPtr lastChild;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
58
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
59 // Tree から削除されていたら 1 をセット。default = 0
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
60 int flag_remove;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
61
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
62 // SceneGraph ID (SGList.h)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
63 int sgid;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
64
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
65 // この SceneGraph は描画するものかどうか (0:しない 1:する
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
66 int flag_drawable;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
67
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
68 // anime frame num
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
69 int frame;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
70
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
71 // Group ID
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
72 int gid;
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
73
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
74 // 関数ポインタ
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
75 move_func move;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
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
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
78
1208
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents: 1169
diff changeset
79 // フォントデータ
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents: 1169
diff changeset
80 void create_font_data(TaskManager *manager,char *font, int pixels,Uint32 color, char *filename);
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents: 1169
diff changeset
81 void get_font_image(TaskManager *manager,char *font, int pixels,Uint32 color, char *name);
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents: 1169
diff changeset
82 void createFont(TaskManager *manager);
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents: 1169
diff changeset
83 void conv(char *str, int length, u_int32_t *out);
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents: 1169
diff changeset
84 SDL_Surface* load_font_image(char *font, int pixels,Uint32 color, char *string_name);
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents: 1169
diff changeset
85
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
86 // desutroctor で呼ばれる
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
87 void (SceneGraph::*finalize)(void);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
88
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
89 void init(void);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
90 void finalize_original(void);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
91 void finalize_copy(void);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
92 void move_execute(int screen_w, int screen_h);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
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
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
95 void all_execute(int screen_w, int screen_h);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
96
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
97 void add_next(SceneGraphPtr next);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
98 SceneGraphPtr addChild(SceneGraphPtr child);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
99 SceneGraphPtr addBrother(SceneGraphPtr bro);
1136
f326494ffdc7 not work ieshoot. not check Cell
Yutaka_Kinjyo
parents: 1129
diff changeset
100 SceneGraphPtr clone(TaskManager *manager);
1169
b93ff55ba015 free TaskArray rbuf
Yutaka_Kinjyo
parents: 1166
diff changeset
101 SceneGraphPtr clone(TaskManager *manager, void *buf);
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
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
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
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
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
108 void remove(void);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
109 SceneGraphPtr realRemoveFromTree(SceneGraphPtr tree);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
110 SceneGraphPtr realRemoveFromList(SceneGraphPtr list);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
111 int isRemoved(void);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
112
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
113 static SceneGraphPtr createSceneGraph(int id);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
114
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
115 void translate(float x, float y, float z);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
116 void translateX(float x);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
117 void translateY(float y);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
118 void translateZ(float z);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
119
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
120
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
121 void tree_check(void);
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
122 void print_member(void);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
123 void get_data(TaskManager *manager, xmlNodePtr cur);
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
124 void delete_data(void);
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
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
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
127 int makeTapestries(TaskManager *manager, SDL_Surface *texture_image, int id);
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
128 void get_image(TaskManager *manager, xmlNodePtr cur);
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
129 };
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
130
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
131 #endif
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
132
539
3bc98f6d31ff Reorganization..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 283
diff changeset
133 // 帯域変数を使うのは禁止なので削除すること
283
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
134 // オリジナル (Linked List)
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
135 extern SceneGraphPtr scene_graph;
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
136
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
137 // 描画用 (同じオブジェクトが複数ある) Tree
15bfacccde99 fix test_render
e065746@localhost.localdomain
parents:
diff changeset
138 extern SceneGraphPtr scene_graph_view;