X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fscene.h;h=acabd10172c5bab23d107eb4f4d9e86f856fe38d;hp=808b3e657c5610132ccbf949628bcf20a6d9f320;hb=dbcb9345c23c5c027d808915962843e7db2d14aa;hpb=72b941af07bbf2673539ad4eea073e68d3bcbbfc diff --git a/src/scene.h b/src/scene.h index 808b3e6..acabd10 100644 --- a/src/scene.h +++ b/src/scene.h @@ -2,6 +2,7 @@ #define SCENE_H_ #include +#include #include "mesh.h" #include "snode.h" #include "texture.h" @@ -16,11 +17,14 @@ private: bool own_texset; public: + // meshes objects and nodes are owned by Scene std::vector meshes; std::vector objects; SceneNode *nodes; - TextureSet *texset; + Mesh *walk_mesh; + + TextureSet *texset; // only owned by Scene if own_texset is true explicit Scene(TextureSet *tset = 0); ~Scene(); @@ -32,6 +36,31 @@ public: bool load(const char *fname, unsigned int flags = 0); + void add_object(Object *obj); + bool remove_object(Object *obj); + bool have_object(Object *obj) const; + + void add_mesh(Mesh *m); + bool remove_mesh(Mesh *m); + bool have_mesh(Mesh *m) const; + + void add_node(SceneNode *n); + bool remove_node(SceneNode *n); + bool have_node(SceneNode *n) 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 + * need to change the algorithm. + */ + Scene *extract_nodes(const char *qstr); + + /* bake all node transformations to their respective meshes and make the + * node transformations identity. + * XXX this assumes no mesh is shared by two nodes. + */ + void apply_xform(); + void update(float dt); void draw() const; };