]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/scene.h
Unify the loader wrappers for Material and Scene
[libs/gl.git] / source / render / scene.h
index 33678b7998900fac18f25cb113f181f5d654e9f3..6fb45d6102b9fc422f71ba360da33b2e5a87c926 100644 (file)
@@ -1,12 +1,11 @@
 #ifndef MSP_GL_SCENE_H_
 #define MSP_GL_SCENE_H_
 
-#include <vector>
+#include <map>
 #include <msp/core/typeregistry.h>
 #include <msp/datafile/objectloader.h>
 #include "matrix.h"
 #include "renderable.h"
-#include "vector.h"
 
 namespace Msp {
 namespace GL {
@@ -26,12 +25,13 @@ protected:
 
        private:
                ContentMap *content;
+               unsigned inst_counter;
 
        public:
-               Loader(Scene &, Collection &);
-               Loader(Scene &, Collection &, ContentMap &);
+               Loader(Scene &s, Collection &c): Loader(s, c, 0) { }
+               Loader(Scene &s, Collection &c, ContentMap &m) : Loader(s, c, &m) { }
        private:
-               void init();
+               Loader(Scene &, Collection &, ContentMap *);
 
                void object(const std::string &);
                void object_tagged(const std::string &, const std::string &);
@@ -58,7 +58,7 @@ public:
                GenericLoader(DataFile::Collection &);
                ~GenericLoader();
 
-               Scene *get_scene() { Scene *s = scene; scene = 0; return s; }
+               Scene *get_object() { Scene *s = scene; scene = 0; return s; }
        private:
                virtual void init_actions();
 
@@ -71,8 +71,6 @@ private:
        typedef TypeRegistry<GenericLoader::CreateScene, GenericLoader &> SceneRegistry;
 
 protected:
-       // XXX If a loaded renderable is removed from the scene it needs to be removed from here as well
-       std::vector<Renderable *> owned_data;
        mutable Matrix culling_matrix;
        mutable Vector4 frustum_edges[6];
 
@@ -81,7 +79,7 @@ private:
        Scene(const Scene &);
        Scene &operator=(const Scene &);
 public:
-       virtual ~Scene();
+       virtual ~Scene() { }
 
        virtual void add(Renderable &) = 0;
        virtual void remove(Renderable &) = 0;