]> git.tdb.fi Git - libs/gl.git/blob - source/resources.h
Integrate ProgramCompiler with Program and Resources
[libs/gl.git] / source / 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 Mesh;
11 class Program;
12 class ResourceManager;
13 class Texture2D;
14
15 /**
16 A collection class for GL resources.  Most useful as a base class for an
17 application-specific collection.
18 */
19 class Resources: virtual public DataFile::Collection
20 {
21 private:
22         TextureFilter default_tex_filter;
23         bool srgb_conversion;
24         ResourceManager *resource_manager;
25
26 public:
27         Resources();
28
29         void set_default_texture_filter(TextureFilter);
30
31         /** Enables or disables sRGB conversion.  If enabled, textures and material
32         colors are converted from sRGB to linear color space when loaded. */
33         void set_srgb_conversion(bool);
34
35         bool get_srgb_conversion() const { return srgb_conversion; }
36
37         void set_resource_manager(ResourceManager *);
38
39 protected:
40         Mesh *create_mesh(const std::string &);
41         Texture2D *create_texture2d(const std::string &);
42         Program *create_program(const std::string &);
43 };
44
45 } // namespace GL
46 } // namespace Msp
47
48 #endif