]> git.tdb.fi Git - libs/gl.git/blobdiff - source/materials/basicmaterial.h
Rearrange soucre files into subdirectories
[libs/gl.git] / source / materials / basicmaterial.h
diff --git a/source/materials/basicmaterial.h b/source/materials/basicmaterial.h
new file mode 100644 (file)
index 0000000..95259f4
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef MSP_GL_BASICMATERIAL_H_
+#define MSP_GL_BASICMATERIAL_H_
+
+#include "material.h"
+
+namespace Msp {
+namespace GL {
+
+class BasicMaterial: public Material
+{
+public:
+       class Loader: public DataFile::DerivedObjectLoader<BasicMaterial, Material::PropertyLoader<BasicMaterial> >
+       {
+       private:
+               static ActionMap shared_actions;
+
+       public:
+               Loader(BasicMaterial &);
+               Loader(BasicMaterial &, Collection &);
+
+       private:
+               virtual void init_actions();
+       };
+
+private:
+       Property<Color> diffuse;
+       Property<Color> specular;
+       Property<float> shininess;
+       Property<Vector3> normal;
+       Property<Color> emission;
+       Property<float> reflectivity;
+       bool receive_shadows;
+
+public:
+       BasicMaterial();
+
+protected:
+       virtual std::string create_program_source() const;
+
+public:
+       virtual void attach_textures_to(Texturing &, ProgramData &) const;
+
+       void set_diffuse(const Color &);
+       void set_diffuse_map(const Texture *);
+       void set_specular(const Color &);
+       void set_specular_map(const Texture *);
+       void set_normal_map(const Texture *);
+       void set_emission(const Color &);
+       void set_emission_map(const Texture *);
+       void set_shininess(float);
+       void set_shininess_map(const Texture *);
+       void set_reflectivity(float);
+       void set_reflectivity_map(const Texture *);
+       void set_receive_shadows(bool);
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif