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