X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fresources%2Fresource.h;fp=source%2Fresources%2Fresource.h;h=571d1ea56c54e61ab10c43ef0f10cce766f19bb3;hb=7aaec9a70b8d7733429bec043f8e33e02956f266;hp=0000000000000000000000000000000000000000;hpb=bec07999d95b76f4b47cffcc564d0cd0afc0435e;p=libs%2Fgl.git diff --git a/source/resources/resource.h b/source/resources/resource.h new file mode 100644 index 00000000..571d1ea5 --- /dev/null +++ b/source/resources/resource.h @@ -0,0 +1,52 @@ +#ifndef MSP_GL_RESOURCE_H_ +#define MSP_GL_RESOURCE_H_ + +#include +#include + +namespace Msp { +namespace GL { + +class ResourceManager; +class Resources; + +class Resource +{ +public: + class AsyncLoader + { + protected: + AsyncLoader() { } + public: + virtual ~AsyncLoader() { } + + virtual bool needs_sync() const = 0; + virtual bool process() = 0; + }; + +protected: + ResourceManager *manager; + void *manager_data; + + Resource(); +public: + virtual ~Resource(); + + void set_manager(ResourceManager *); + ResourceManager *get_manager() const { return manager; } + void *get_manager_data() const { return manager_data; } + virtual int get_load_priority() const { return 0; } + virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) = 0; + virtual bool is_loaded() const; + + /** Returns the amount of graphics memory used by this resource. The + returned value must not change while the resource is loaded. */ + virtual UInt64 get_data_size() const = 0; + + virtual void unload() = 0; +}; + +} // namespace GL +} // namespace Msp + +#endif