view TaskManager/Test/test_render/SceneGraph.h @ 180:5cde66c926b4

いろいろ fix 。詳しくは TaskManager/Changelog、test_render/Changelog を
author gongo@localhost.localdomain
date Mon, 22 Dec 2008 16:09:57 +0900
parents ff3fb47c2553
children 8143bbade40d
line wrap: on
line source

#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(void);

    // 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;

    Pad *controller;

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

    void init(void);
    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);
    void set_move_collision(move_func new_move, collision_func new_collision);


    static void createFromXMLfile(const char *);

    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;