comparison Renderer/test_render/SceneGraph.h @ 283:55ea4465b1a2

fix test_render
author e065746@localhost.localdomain
date Fri, 05 Jun 2009 16:49:12 +0900
parents
children
comparison
equal deleted inserted replaced
282:ef061be0baff 283:55ea4465b1a2
1 #ifndef INCLUDED_SCENE_GRAPH
2 #define INCLUDED_SCENE_GRAPH
3
4 #ifndef INCLUDED_POLYGON
5 # include "polygon.h"
6 #endif
7
8 #ifndef INCLUDED_PAD
9 # include "Pad.h"
10 #endif
11
12 class SceneGraph;
13
14 typedef void (*move_func)(SceneGraph* node, int screen_w, int screen_h);
15 typedef void (*collision_func)(SceneGraph* node, int screen_w, int screen_h,
16 SceneGraph* tree);
17 typedef SceneGraph* SceneGraphPtr;
18
19 class SceneGraph : public Polygon {
20 public:
21 SceneGraph(void);
22 SceneGraph(xmlNodePtr surface);
23 SceneGraph(SceneGraphPtr orig);
24 ~SceneGraph(void);
25
26 // Node がもつ状態変数(というべきか否か
27 // xyz,angle ぐらいあればおk?
28 float stack_xyz[3];
29 float stack_angle[3];
30
31 // xml ファイルから生成した時のオブジェクトリスト
32 SceneGraphPtr next;
33 SceneGraphPtr prev;
34 SceneGraphPtr last;
35
36 // Tree Structure
37 SceneGraphPtr parent;
38 SceneGraphPtr brother;
39 SceneGraphPtr children;
40 SceneGraphPtr lastChild;
41
42 // Tree から削除されていたら 1 をセット。default = 0
43 int flag_remove;
44
45 // SceneGraph ID (SGList.h)
46 int sgid;
47
48 // この SceneGraph は描画するものかどうか (0:しない 1:する
49 int flag_drawable;
50
51 // anime frame num
52 int frame;
53
54 // 関数ポインタ
55 move_func move;
56 collision_func collision;
57
58 // desutroctor で呼ばれる
59 void (SceneGraph::*finalize)(void);
60
61 void init(void);
62 void finalize_original(void);
63 void finalize_copy(void);
64 void move_execute(int screen_w, int screen_h);
65 void collision_check(int screen_w, int screen_h, SceneGraphPtr tree);
66 void all_execute(int screen_w, int screen_h);
67
68 void add_next(SceneGraphPtr next);
69 SceneGraphPtr addChild(SceneGraphPtr child);
70 SceneGraphPtr addBrother(SceneGraphPtr bro);
71 SceneGraphPtr clone(void);
72 SceneGraphPtr clone(void *buf);
73 SceneGraphPtr searchSceneGraph(const char *name);
74 void set_move_collision(SceneGraphPtr node,
75 move_func new_move, collision_func new_collision);
76 void set_move_collision(move_func new_move, collision_func new_collision);
77 void remove(void);
78 SceneGraphPtr realRemoveFromTree(SceneGraphPtr tree);
79 SceneGraphPtr realRemoveFromList(SceneGraphPtr list);
80 int isRemoved(void);
81
82 static void createFromXMLfile(const char *);
83 static SceneGraphPtr createSceneGraph(int id);
84
85 void translate(float x, float y, float z);
86 void translateX(float x);
87 void translateY(float y);
88 void translateZ(float z);
89
90
91 void tree_check(void);
92 void print_member(void);
93 void get_data(xmlNodePtr cur);
94 void delete_data(void);
95 };
96
97 #endif
98
99 // オリジナル (Linked List)
100 extern SceneGraphPtr scene_graph;
101
102 // 描画用 (同じオブジェクトが複数ある) Tree
103 extern SceneGraphPtr scene_graph_view;