X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Fmaterial.h;h=727c61b7303c7faa230241d875c21605b6de598c;hb=842c817bb679a5a0abc05e8149e2e6e0ae1a0412;hp=571f4cb027c4da3a41e8d317e1e4c042603a2706;hpb=7aaec9a70b8d7733429bec043f8e33e02956f266;p=libs%2Fgl.git diff --git a/source/materials/material.h b/source/materials/material.h index 571f4cb0..727c61b7 100644 --- a/source/materials/material.h +++ b/source/materials/material.h @@ -96,10 +96,9 @@ protected: public: virtual ~Material() { } - virtual Program *create_compatible_shader() const; virtual const Program *create_compatible_shader(DataFile::Collection &) const; protected: - virtual std::string create_program_source() const = 0; + virtual void fill_program_info(std::string &, std::map &) const = 0; public: /** Returns the uniforms for the material. */ @@ -127,7 +126,8 @@ template void Material::PropertyLoader::add_property(const std::string &kw, void (C::*set_value)(float), void (C::*set_texture)(const Texture *)) { add(kw, &PropertyLoader::property_value_scalar, set_value); - add(kw+"_map", &PropertyLoader::property_texture, set_texture); + if(set_texture) + add(kw+"_map", &PropertyLoader::property_texture, set_texture); } template @@ -140,7 +140,8 @@ void Material::PropertyLoader::add_property(const std::string &kw, void (C::* add(kw, &PropertyLoader::property_value_rgba, set_value); add(kw+"_srgb", &PropertyLoader::property_value_srgb_alpha, set_value); } - add(kw+"_map", &PropertyLoader::property_texture, set_texture); + if(set_texture) + add(kw+"_map", &PropertyLoader::property_texture, set_texture); } template