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