]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/material.h
Remove collection-less constructor overloads from most loaders
[libs/gl.git] / source / materials / material.h
index ae38f2444afdadbd3fc260e142bf1c83113660bf..ea02df6b1e00dad8d0dc5275399a55104c5086d5 100644 (file)
@@ -11,7 +11,7 @@
 namespace Msp {
 namespace GL {
 
-class Texturing;
+class Sampler;
 
 class Material
 {
@@ -19,7 +19,6 @@ private:
        class Loader: public DataFile::CollectionObjectLoader<Material>
        {
        protected:
-               Loader(Material &);
                Loader(Material &, Collection &);
 
                virtual void init_actions();
@@ -42,7 +41,6 @@ protected:
        class PropertyLoader: public DataFile::DerivedObjectLoader<Material, Loader>
        {
        protected:
-               PropertyLoader(C &m): DerivedObjectLoader<Material, Loader>(m) { }
                PropertyLoader(C &m, Collection &c): DerivedObjectLoader<Material, Loader>(m, c) { }
 
                void add_property(const std::string &, void (C::*)(float), void (C::*)(const Texture *));
@@ -67,17 +65,17 @@ public:
                        void operator()(const std::string &, GenericLoader &) const;
                };
 
-               DataFile::Collection *coll;
+               DataFile::Collection &coll;
                Material *material;
                Loader *mat_loader;
 
                static ActionMap shared_actions;
 
        public:
-               GenericLoader(DataFile::Collection * = 0);
+               GenericLoader(DataFile::Collection &);
                ~GenericLoader();
 
-               Material *get_material() { Material *m = material; material = 0; return m; }
+               Material *get_object() { Material *m = material; material = 0; return m; }
        private:
                virtual void init_actions();
 
@@ -97,7 +95,7 @@ protected:
 public:
        virtual ~Material() { }
 
-       virtual const Program *create_compatible_shader(DataFile::Collection &, const std::map<std::string, int> & = std::map<std::string, int>()) const;
+       virtual const Program *create_compatible_shader(const std::map<std::string, int> & = std::map<std::string, int>()) const;
 protected:
        virtual void fill_program_info(std::string &, std::map<std::string, int> &) const = 0;
 
@@ -105,14 +103,9 @@ public:
        /** Returns the uniforms for the material. */
        const ProgramData &get_shader_data() const { return shdata; }
 
-protected:
-       DEPRECATED void attach_texture_to(const Texture *, Texturing &, ProgramData &, const std::string &) const;
-public:
-       DEPRECATED virtual void attach_textures_to(Texturing &, ProgramData &) const = 0;
-
        virtual const Tag *get_texture_tags() const = 0;
        virtual const Texture *get_texture(Tag) const = 0;
-       const Sampler *get_sampler() const { return sampler; }
+       virtual const Sampler *get_sampler(Tag) const { return sampler; }
 
        void set_debug_name(const std::string &);
 
@@ -204,10 +197,7 @@ void Material::GenericLoader::CreateMaterial<T>::operator()(const std::string &,
 
        T *mat = new T;
        ldr.material = mat;
-       if(ldr.coll)
-               ldr.mat_loader = new typename T::Loader(*mat, *ldr.coll);
-       else
-               ldr.mat_loader = new typename T::Loader(*mat);
+       ldr.mat_loader = new typename T::Loader(*mat, ldr.coll);
        ldr.add_auxiliary_loader(*ldr.mat_loader);
 }