1 #ifndef MSP_GL_RESOURCE_H_
2 #define MSP_GL_RESOURCE_H_
5 #include <msp/core/noncopyable.h>
6 #include <msp/io/seekable.h>
11 class ResourceManager;
14 class Resource: public NonCopyable
22 virtual ~AsyncLoader() { }
24 virtual bool needs_sync() const = 0;
25 virtual bool process() = 0;
29 ResourceManager *manager = 0;
30 void *manager_data = 0;
33 Resource(Resource &&);
37 void set_manager(ResourceManager *);
38 ResourceManager *get_manager() const { return manager; }
39 void *get_manager_data() const { return manager_data; }
40 virtual int get_load_priority() const { return 0; }
41 virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) = 0;
42 virtual bool is_loaded() const;
44 /** Returns the amount of graphics memory used by this resource. The
45 returned value must not change while the resource is loaded. */
46 virtual std::size_t get_data_size() const = 0;
48 virtual void unload() = 0;