1 #ifndef MSP_GL_SPLATMATERIAL_H_
2 #define MSP_GL_SPLATMATERIAL_H_
12 class SplatMaterial: public Material, public NonCopyable
18 class Loader: public DataFile::DerivedObjectLoader<SplatMaterial, PropertyLoader<SplatMaterial>>
21 static ActionMap shared_actions;
24 Loader(SplatMaterial &, Collection &);
27 virtual void init_actions();
28 virtual void finish();
30 void map_storage(MapArray SplatMaterial::*, PixelFormat, unsigned, unsigned);
37 std::string source_fn;
43 class Loader: public DataFile::ObjectLoader<SubMaterial>
46 static ActionMap shared_actions;
49 Loader(SubMaterial &);
52 virtual void init_actions();
54 void base_color(float, float, float);
55 void emission(float, float, float);
56 void map(SubMap SubMaterial::*, const std::string &);
57 void tint(float, float, float, float);
60 Color base_color = { 0.8f };
61 Color tint = { 1.0f };
62 float metalness = 0.0f;
63 float roughness = 0.5f;
64 Color emission = { 0.0f };
65 SubMap base_color_map;
75 Texture2DArray *texture = 0;
76 PixelFormat format = NO_PIXELFORMAT;
79 unsigned max_layers = 0;
84 std::vector<SubMaterial> sub_materials;
85 MapArray base_color_array;
86 MapArray normal_array;
87 MapArray metalness_array;
88 MapArray roughness_array;
89 MapArray occlusion_array;
90 MapArray emission_array;
91 const Texture2D &fresnel_lookup;
92 const Sampler &fresnel_sampler;
94 static const Tag texture_tags[];
101 virtual void fill_program_info(std::string &, std::map<std::string, int> &) const;
104 virtual const Tag *get_texture_tags() const { return texture_tags; }
105 virtual const Texture *get_texture(Tag) const;
106 virtual const Sampler *get_sampler(Tag) const;
109 void set_sub_uniforms(unsigned);
110 void upload_sub(DataFile::Collection &, unsigned);
111 void upload_sub_map(DataFile::Collection &, unsigned, SubMap SubMaterial::*, MapArray &, const char *);