]> git.tdb.fi Git - libs/gl.git/blob - source/materials/pbrmaterial.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / materials / 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 Texture2D;
10
11 class PbrMaterial: public Material
12 {
13 public:
14         class Loader: public DataFile::DerivedObjectLoader<PbrMaterial, Material::PropertyLoader<PbrMaterial> >
15         {
16         private:
17                 static ActionMap shared_actions;
18
19         public:
20                 Loader(PbrMaterial &);
21                 Loader(PbrMaterial &, Collection &);
22
23         private:
24                 virtual void init_actions();
25         };
26         
27 private:
28         Property<Color> base_color;
29         Property<Vector3> normal;
30         Property<float> metalness;
31         Property<float> roughness;
32         Property<float> occlusion;
33         Property<Color> emission;
34         const Texture2D &fresnel_lookup;
35         const Sampler &fresnel_sampler;
36
37         static const Tag texture_tags[];
38
39 public:
40         PbrMaterial();
41
42 private:
43         static const Texture2D &get_or_create_fresnel_lookup();
44
45 protected:
46         virtual void fill_program_info(std::string &, std::map<std::string, int> &) const;
47
48 public:
49         virtual const Tag *get_texture_tags() const { return texture_tags; }
50         virtual const Texture *get_texture(Tag) const;
51         virtual const Sampler *get_sampler(Tag) const;
52
53         void set_base_color(const Color &);
54         void set_base_color_map(const Texture *);
55         void set_normal_map(const Texture *);
56         void set_metalness(float);
57         void set_metalness_map(const Texture *);
58         void set_roughness(float);
59         void set_roughness_map(const Texture *);
60         void set_occlusion_map(const Texture *);
61         void set_emission(const Color &);
62         void set_emission_map(const Texture *);
63 };
64
65 } // namespace GL
66 } // namespace Msp
67
68 #endif