X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fmaterials%2Fmaterial.cpp;h=6d9c0571f429f37e8c2ce265ca8c88e92bfaf70c;hp=328d89a462ccd4db069499ab45ed5fe2d98d7c35;hb=9813f8711628a0fbe786406e974dc33546dc9cee;hpb=1b23728908f5ec9beb08b2b70737c3903745fddc diff --git a/source/materials/material.cpp b/source/materials/material.cpp index 328d89a4..6d9c0571 100644 --- a/source/materials/material.cpp +++ b/source/materials/material.cpp @@ -1,11 +1,9 @@ #include #include #include "basicmaterial.h" -#include "gl.h" #include "pbrmaterial.h" #include "program.h" #include "resources.h" -#include "uniform.h" #include "unlitmaterial.h" using namespace std; @@ -56,9 +54,9 @@ void Material::set_debug_name(const string &name) #endif } -Material::MaterialRegistry &Material::get_material_registry() +Material::GenericLoader::TypeRegistry &Material::get_material_registry() { - static MaterialRegistry registry; + static GenericLoader::TypeRegistry registry; static bool initialized = false; if(!initialized) { @@ -71,10 +69,6 @@ Material::MaterialRegistry &Material::get_material_registry() } -Material::Loader::Loader(Material &m): - CollectionObjectLoader(m, 0) -{ } - Material::Loader::Loader(Material &m, Collection &c): CollectionObjectLoader(m, &c) { } @@ -89,32 +83,5 @@ void Material::Loader::sampler(const string &name) obj.sampler = &get_collection().get(name); } - -DataFile::Loader::ActionMap Material::GenericLoader::shared_actions; - -Material::GenericLoader::GenericLoader(DataFile::Collection *c): - coll(c), - material(0), - mat_loader(0) -{ - set_actions(shared_actions); -} - -Material::GenericLoader::~GenericLoader() -{ - delete material; - delete mat_loader; -} - -void Material::GenericLoader::init_actions() -{ - add("type", &GenericLoader::type); -} - -void Material::GenericLoader::type(const DataFile::Symbol &sym) -{ - get_material_registry().invoke(sym.name, *this); -} - } // namespace GL } // namespace Msp