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