Mercurial > hg > Members > kono > Cerium
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Renderer/test_render/SceneGraph.h Fri Jun 05 16:49:12 2009 +0900 @@ -0,0 +1,103 @@ +#ifndef INCLUDED_SCENE_GRAPH +#define INCLUDED_SCENE_GRAPH + +#ifndef INCLUDED_POLYGON +# include "polygon.h" +#endif + +#ifndef INCLUDED_PAD +# include "Pad.h" +#endif + +class SceneGraph; + +typedef void (*move_func)(SceneGraph* node, int screen_w, int screen_h); +typedef void (*collision_func)(SceneGraph* node, int screen_w, int screen_h, + SceneGraph* tree); +typedef SceneGraph* SceneGraphPtr; + +class SceneGraph : public Polygon { +public: + SceneGraph(void); + SceneGraph(xmlNodePtr surface); + SceneGraph(SceneGraphPtr orig); + ~SceneGraph(void); + + // Node がもつ状態変数(というべきか否か + // xyz,angle ぐらいあればおk? + float stack_xyz[3]; + float stack_angle[3]; + + // xml ファイルから生成した時のオブジェクトリスト + SceneGraphPtr next; + SceneGraphPtr prev; + SceneGraphPtr last; + + // Tree Structure + SceneGraphPtr parent; + SceneGraphPtr brother; + SceneGraphPtr children; + SceneGraphPtr lastChild; + + // Tree から削除されていたら 1 をセット。default = 0 + int flag_remove; + + // SceneGraph ID (SGList.h) + int sgid; + + // この SceneGraph は描画するものかどうか (0:しない 1:する + int flag_drawable; + + // anime frame num + int frame; + + // 関数ポインタ + move_func move; + collision_func collision; + + // desutroctor で呼ばれる + void (SceneGraph::*finalize)(void); + + void init(void); + void finalize_original(void); + void finalize_copy(void); + void move_execute(int screen_w, int screen_h); + void collision_check(int screen_w, int screen_h, SceneGraphPtr tree); + void all_execute(int screen_w, int screen_h); + + void add_next(SceneGraphPtr next); + SceneGraphPtr addChild(SceneGraphPtr child); + SceneGraphPtr addBrother(SceneGraphPtr bro); + SceneGraphPtr clone(void); + SceneGraphPtr clone(void *buf); + SceneGraphPtr searchSceneGraph(const char *name); + void set_move_collision(SceneGraphPtr node, + move_func new_move, collision_func new_collision); + void set_move_collision(move_func new_move, collision_func new_collision); + void remove(void); + SceneGraphPtr realRemoveFromTree(SceneGraphPtr tree); + SceneGraphPtr realRemoveFromList(SceneGraphPtr list); + int isRemoved(void); + + static void createFromXMLfile(const char *); + static SceneGraphPtr createSceneGraph(int id); + + void translate(float x, float y, float z); + void translateX(float x); + void translateY(float y); + void translateZ(float z); + + + void tree_check(void); + void print_member(void); + void get_data(xmlNodePtr cur); + void delete_data(void); +}; + +#endif + +// オリジナル (Linked List) +extern SceneGraphPtr scene_graph; + +// 描画用 (同じオブジェクトが複数ある) Tree +extern SceneGraphPtr scene_graph_view;