]> git.tdb.fi Git - libs/gl.git/blob - source/resource.h
Update Object's bounding sphere when mesh is loaded
[libs/gl.git] / source / resource.h
1 #ifndef MSP_GL_RESOURCE_H_
2 #define MSP_GL_RESOURCE_H_
3
4 #include <msp/core/inttypes.h>
5 #include <msp/io/seekable.h>
6
7 namespace Msp {
8 namespace GL {
9
10 class ResourceManager;
11
12 class Resource
13 {
14 public:
15         class AsyncLoader
16         {
17         protected:
18                 AsyncLoader() { }
19         public:
20                 virtual ~AsyncLoader() { }
21
22                 virtual bool needs_sync() const = 0;
23                 virtual bool process() = 0;
24         };
25
26 protected:
27         ResourceManager *manager;
28         void *manager_data;
29
30         Resource();
31 public:
32         virtual ~Resource();
33
34         void set_manager(ResourceManager *);
35         ResourceManager *get_manager() const { return manager; }
36         void *get_manager_data() const { return manager_data; }
37         virtual AsyncLoader *load(IO::Seekable &) = 0;
38         virtual UInt64 get_data_size() const = 0;
39         virtual void unload() = 0;
40 };
41
42 } // namespace GL
43 } // namespace Msp
44
45 #endif