annotate Renderer/Engine/SceneGraph.h @ 930:35efda39c2d9

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