X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Fmaterial.h;h=ea02df6b1e00dad8d0dc5275399a55104c5086d5;hb=ae45c0397e2cb8f0a01f2f31d01c95ff3870271e;hp=23f4085760c412dcf01b4dc5e7fd13a062cd6f69;hpb=a482029babea3210840d8c62e9df9ece4342b2b9;p=libs%2Fgl.git diff --git a/source/materials/material.h b/source/materials/material.h index 23f40857..ea02df6b 100644 --- a/source/materials/material.h +++ b/source/materials/material.h @@ -11,13 +11,14 @@ namespace Msp { namespace GL { +class Sampler; + class Material { private: class Loader: public DataFile::CollectionObjectLoader { protected: - Loader(Material &); Loader(Material &, Collection &); virtual void init_actions(); @@ -40,7 +41,6 @@ protected: class PropertyLoader: public DataFile::DerivedObjectLoader { protected: - PropertyLoader(C &m): DerivedObjectLoader(m) { } PropertyLoader(C &m, Collection &c): DerivedObjectLoader(m, c) { } void add_property(const std::string &, void (C::*)(float), void (C::*)(const Texture *)); @@ -65,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(); @@ -197,10 +197,7 @@ void Material::GenericLoader::CreateMaterial::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); }