view TaskManager/Test/test_render/SceneGraph.h @ 139:bacb6dde2d17 draft

fix
author gongo@charles.cr.ie.u-ryukyu.ac.jp
date Fri, 28 Nov 2008 13:51:54 +0900
parents f35504025f73
children 67a5469dfef2
line wrap: on
line source

#ifndef INCLUDED_SCENE_GRAPH
#define INCLUDED_SCENE_GRAPH

#ifndef INCLUDED_POLYGON
#  include "polygon.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);

    // Node がもつ状態変数(というべきか否か
    // xyz,angle ぐらいあればおk?
    float stack_xyz[3];
    float stack_angle[3];

    // xml ファイルから生成した時のオブジェクトリスト
    SceneGraph* next;
    SceneGraph* last;

    // Tree Structure
    SceneGraph *parent;
    SceneGraph *brother;
    SceneGraph *children;
    SceneGraph *lastChild;

    // 関数ポインタ
    move_func move;
    collision_func collision;

    void move_execute(int screen_w, int screen_h);
    void collision_check(int screen_w, int screen_h, SceneGraph *tree);
    void all_execute(int screen_w, int screen_h);

    void add_next(SceneGraph *next);
    SceneGraph* addChild(SceneGraph *child);
    SceneGraph* addBrother(SceneGraph *bro);
    SceneGraph* clone(void);
    SceneGraph* searchSceneGraph(char *name);
    void set_move_collision(SceneGraph *node,
			    move_func new_move, collision_func new_collision);


    static SceneGraph* createFromXMLfile(char *);

    void tree_check(void);
    void print_member(void);
    void get_data(xmlNodePtr cur);
    void delete_data(void);
};

#endif

extern SceneGraphPtr scene_graph;