17 SCNLOAD_STAGE_IO = 0x4000,
18 SCNLOAD_STAGE_GL = 0x8000
30 // meshes objects and nodes are owned by Scene
31 std::vector<Mesh*> meshes;
32 std::vector<Object*> objects;
43 Scene(const Scene &rhs) = delete;
44 Scene &operator =(const Scene &rhs) = delete;
47 void clear(); // clear all contents (meshes, objects, and nodes)
49 bool load(const char *fname, unsigned int flags = 0);
51 // merge scn into this scene, leaving scn empty and safe to destroy
52 bool merge(Scene *scn);
54 void add_object(Object *obj);
55 bool remove_object(Object *obj);
56 bool have_object(Object *obj) const;
58 void add_mesh(Mesh *m);
59 bool remove_mesh(Mesh *m);
60 bool have_mesh(Mesh *m) const;
62 void add_node(SceneNode *n);
63 bool remove_node(SceneNode *n);
64 bool have_node(SceneNode *n) const;
67 SceneNode *find_node(const char *name) const;
68 // match nodes with regexp and return the first that matches
69 SceneNode *match_node(const char *qstr) const;
70 // match nodes with regexp and return a list of matches
71 std::list<SceneNode*> match_nodes(const char *qstr) const;
73 /* find and remove all nodes whose names match the regexp
74 * XXX at the moment this has the effect of flattening the hierarchy in the
75 * result scene. If we ever need verbatim extraction of whole subtrees we'll
76 * need to change the algorithm.
78 Scene *extract_nodes(const char *qstr);
80 /* bake all node transformations to their respective meshes and make the
81 * node transformations identity.
82 * XXX this assumes no mesh is shared by two nodes.
86 void update(float dt);
90 //! Resource manager for Scenes
91 class SceneSet : public DataSet<Scene*> {
93 static Scene *create_scene();
94 static bool load_scene(Scene *scn, const char *fname);
95 static bool done_scene(Scene *scn);
96 static void free_scene(Scene *scn);