]> git.tdb.fi Git - libs/gl.git/blob - source/pbrmaterial.h
Refactor material property handling in the Blender exporter
[libs/gl.git] / source / pbrmaterial.h
1 #ifndef MSP_GL_PBRMATERIAL_H_
2 #define MSP_GL_PBRMATERIAL_H_
3
4 #include "material.h"
5
6 namespace Msp {
7 namespace GL {
8
9 class PbrMaterial: public Material
10 {
11 public:
12         class Loader: public DataFile::DerivedObjectLoader<PbrMaterial, Material::PropertyLoader<PbrMaterial> >
13         {
14         private:
15                 static ActionMap shared_actions;
16
17         public:
18                 Loader(PbrMaterial &);
19                 Loader(PbrMaterial &, Collection &);
20
21         private:
22                 virtual void init_actions();
23         };
24         
25 private:
26         Property<Color> base_color;
27         Property<Vector3> normal;
28         Property<float> metalness;
29         Property<float> roughness;
30         Property<float> occlusion;
31         Property<Color> emission;
32         bool receive_shadows;
33
34 public:
35         PbrMaterial();
36
37 protected:
38         virtual std::string create_program_source() const;
39
40 public:
41         virtual void attach_textures_to(Texturing &, ProgramData &) const;
42
43         void set_base_color(const Color &);
44         void set_base_color_map(const Texture *);
45         void set_normal_map(const Texture *);
46         void set_metalness(float);
47         void set_metalness_map(const Texture *);
48         void set_roughness(float);
49         void set_roughness_map(const Texture *);
50         void set_occlusion_map(const Texture *);
51         void set_emission(const Color &);
52         void set_emission_map(const Texture *);
53         void set_receive_shadows(bool);
54 };
55
56 } // namespace GL
57 } // namespace Msp
58
59 #endif