]> git.tdb.fi Git - libs/gl.git/blob - source/resources/resources.h
Redesign the way shader programs are loaded
[libs/gl.git] / source / resources / resources.h
1 #ifndef MSP_GL_RESOURCES_H_
2 #define MSP_GL_RESOURCES_H_
3
4 #include <msp/datafile/collection.h>
5 #include "texture.h"
6
7 namespace Msp {
8 namespace GL {
9
10 class Material;
11 class Mesh;
12 class Module;
13 class Program;
14 class ResourceManager;
15 class Texture2D;
16
17 /**
18 A collection class for GL resources.  Most useful as a base class for an
19 application-specific collection.
20 */
21 class Resources: virtual public DataFile::Collection
22 {
23 private:
24         TextureFilter default_tex_filter;
25         float default_tex_anisotropy;
26         bool srgb_conversion;
27         ResourceManager *resource_manager;
28
29 public:
30         Resources();
31
32         static const DataFile::CollectionSource &get_builtins();
33
34         void set_default_texture_filter(TextureFilter);
35         void set_default_texture_anisotropy(float);
36
37         /** Enables or disables sRGB conversion.  If enabled, textures and material
38         colors are converted from sRGB to linear color space when loaded. */
39         DEPRECATED void set_srgb_conversion(bool);
40
41         DEPRECATED bool get_srgb_conversion() const { return srgb_conversion; }
42
43         void set_resource_manager(ResourceManager *);
44
45 protected:
46         Material *create_material(const std::string &);
47         Mesh *create_mesh(const std::string &);
48         Texture2D *create_texture2d(const std::string &);
49         Module *create_module(const std::string &);
50         Program *create_program(const std::string &);
51 };
52
53 } // namespace GL
54 } // namespace Msp
55
56 #endif