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