X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fscene.h;h=dd421d9f430c9b6570738ca7d2093e913822bef7;hp=7489261003d15c8f2f526546792dfd43744b4bb0;hb=e12a327cc0b4f1e59f4a66a80b170ec41ce97be6;hpb=21f74bf587d9b7a76bc1ee83db02cb8c243dc567 diff --git a/src/scene.h b/src/scene.h index 7489261..dd421d9 100644 --- a/src/scene.h +++ b/src/scene.h @@ -3,10 +3,12 @@ #include #include +#include #include "mesh.h" #include "snode.h" #include "texture.h" #include "dataset.h" +#include "datamap.h" enum { SCNLOAD_FLIPYZ = 1, @@ -19,11 +21,11 @@ enum { class MetaScene; class Scene { -private: - bool own_texset; - public: + std::string name; + MetaScene *metascn; + DataMap datamap; // meshes objects and nodes are owned by Scene std::vector meshes; @@ -32,16 +34,17 @@ public: Mesh *walk_mesh; - TextureSet *texset; // only owned by Scene if own_texset is true + TextureSet *texset; void *loader_data; - explicit Scene(TextureSet *tset = 0); + explicit Scene(); ~Scene(); Scene(const Scene &rhs) = delete; Scene &operator =(const Scene &rhs) = delete; void destroy(); + void clear(); // clear all contents (meshes, objects, and nodes) bool load(const char *fname, unsigned int flags = 0); @@ -60,6 +63,13 @@ public: bool remove_node(SceneNode *n); bool have_node(SceneNode *n) const; + // find node by name + SceneNode *find_node(const char *name) const; + // match nodes with regexp and return the first that matches + SceneNode *match_node(const char *qstr) const; + // match nodes with regexp and return a list of matches + std::list match_nodes(const char *qstr) const; + /* find and remove all nodes whose names match the regexp * XXX at the moment this has the effect of flattening the hierarchy in the * result scene. If we ever need verbatim extraction of whole subtrees we'll @@ -77,6 +87,7 @@ public: void draw() const; }; +//! Resource manager for Scenes class SceneSet : public DataSet { private: static Scene *create_scene();