1 #include "basicmaterial.h"
12 void Material::attach_texture_to(const Texture *tex, Texturing &texturing, ProgramData &tex_shdata, const string &name) const
19 if(const Uniform *uni = tex_shdata.find_uniform(name))
20 if(const Uniform1i *uni_int = dynamic_cast<const Uniform1i *>(uni))
21 unit = uni_int->get();
24 unit = texturing.find_free_unit(name);
26 throw runtime_error("no free texunit");
28 texturing.attach(unit, *tex);
29 tex_shdata.uniform(name, unit);
32 Material::MaterialRegistry &Material::get_material_registry()
34 static MaterialRegistry registry;
35 static bool initialized = false;
38 registry.register_type<BasicMaterial>("basic");
44 DataFile::Loader::ActionMap Material::GenericLoader::shared_actions;
46 Material::GenericLoader::GenericLoader(DataFile::Collection *c):
49 set_actions(shared_actions);
52 void Material::GenericLoader::init_actions()
54 get_material_registry().add_all(*this);