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