namespace Msp {
namespace GL {
-BasicMaterial::BasicMaterial()
+BasicMaterial::BasicMaterial():
+ receive_shadows(false)
{
set_diffuse(Color(1.0f));
set_specular(Color(0.0f));
if (reflectivity.texture)
source += "const bool use_reflectivity_map = true;\n";
}
+ if(receive_shadows)
+ source += "const bool use_shadow_map = true;\n";
return source;
}
reflectivity.texture = tex;
}
+void BasicMaterial::set_receive_shadows(bool s)
+{
+ receive_shadows = s;
+}
+
DataFile::Loader::ActionMap BasicMaterial::Loader::shared_actions;
BasicMaterial::Loader::Loader(BasicMaterial &m):
- DerivedObjectLoader<BasicMaterial, Material::LoaderBase<BasicMaterial> >(m)
+ DerivedObjectLoader<BasicMaterial, Material::PropertyLoader<BasicMaterial> >(m)
{
set_actions(shared_actions);
}
BasicMaterial::Loader::Loader(BasicMaterial &m, Collection &c):
- DerivedObjectLoader<BasicMaterial, Material::LoaderBase<BasicMaterial> >(m, c)
+ DerivedObjectLoader<BasicMaterial, Material::PropertyLoader<BasicMaterial> >(m, c)
{
set_actions(shared_actions);
}
void BasicMaterial::Loader::init_actions()
{
+ Material::PropertyLoader<BasicMaterial>::init_actions();
add_property("diffuse", &BasicMaterial::set_diffuse, &BasicMaterial::set_diffuse_map, true);
add_property("specular", &BasicMaterial::set_specular, &BasicMaterial::set_specular_map, false);
add_property("normal", &BasicMaterial::set_normal_map);
add_property("emission", &BasicMaterial::set_emission, &BasicMaterial::set_emission_map, false);
add_property("shininess", &BasicMaterial::set_shininess, &BasicMaterial::set_shininess_map);
add_property("reflectivity", &BasicMaterial::set_reflectivity, &BasicMaterial::set_reflectivity_map);
+ add("receive_shadows", &BasicMaterial::receive_shadows);
}
} // namespace GL