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