#include <msp/strings/format.h>
#include "basicmaterial.h"
#include "gl.h"
+#include "pbrmaterial.h"
#include "resources.h"
#include "texturing.h"
#include "uniform.h"
if(unit<0)
throw runtime_error("no free texunit");
- texturing.attach(unit, *tex);
+ texturing.attach(unit, *tex, sampler);
tex_shdata.uniform(name, unit);
}
static bool initialized = false;
if(!initialized)
{
+ initialized = true;
registry.register_type<BasicMaterial>("basic");
+ registry.register_type<PbrMaterial>("pbr");
}
return registry;
}
+Material::Loader::Loader(Material &m):
+ CollectionObjectLoader(m, 0)
+{ }
+
+Material::Loader::Loader(Material &m, Collection &c):
+ CollectionObjectLoader(m, &c)
+{ }
+
+void Material::Loader::init_actions()
+{
+ add("sampler", &Loader::sampler);
+}
+
+void Material::Loader::sampler(const std::string &name)
+{
+ obj.sampler = &get_collection().get<Sampler>(name);
+}
+
+
DataFile::Loader::ActionMap Material::GenericLoader::shared_actions;
Material::GenericLoader::GenericLoader(DataFile::Collection *c):