]> git.tdb.fi Git - libs/gl.git/blob - source/resources.h
Cosmetic fixes
[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         static const DataFile::CollectionSource &get_builtins();
30
31         void set_default_texture_filter(TextureFilter);
32
33         /** Enables or disables sRGB conversion.  If enabled, textures and material
34         colors are converted from sRGB to linear color space when loaded. */
35         void set_srgb_conversion(bool);
36
37         bool get_srgb_conversion() const { return srgb_conversion; }
38
39         void set_resource_manager(ResourceManager *);
40
41 protected:
42         Mesh *create_mesh(const std::string &);
43         Texture2D *create_texture2d(const std::string &);
44         Program *create_program(const std::string &);
45 };
46
47 } // namespace GL
48 } // namespace Msp
49
50 #endif