]> git.tdb.fi Git - libs/gl.git/blob - source/texture1d.h
Implement loading functionality for texture classes that were missing it
[libs/gl.git] / source / texture1d.h
1 #ifndef MSP_GL_TEXTURE1D_H_
2 #define MSP_GL_TEXTURE1D_H_
3
4 #include "texture.h"
5
6 namespace Msp {
7 namespace GL {
8
9 class Texture1D: public Texture
10 {
11 public:
12         class Loader: public DataFile::DerivedObjectLoader<Texture1D, Texture::Loader>
13         {
14         public:
15                 Loader(Texture1D &);
16                 Loader(Texture1D &, Collection &);
17         private:
18                 void init();
19
20                 void raw_data(const std::string &);
21                 void storage(PixelFormat, unsigned);
22         };
23
24 private:
25         PixelFormat ifmt;
26         unsigned width;
27         unsigned allocated;
28
29 public:
30         Texture1D();
31
32         void storage(PixelFormat, unsigned);
33         void allocate(unsigned);
34         void image(unsigned, PixelFormat, DataType, const void *);
35         virtual void image(const Graphics::Image &, bool = false);
36         unsigned get_width() const { return width; }
37
38 private:
39         unsigned get_level_size(unsigned);
40
41 public:
42         virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
43         virtual UInt64 get_data_size() const;
44         virtual void unload() { }
45 };
46
47 } // namespace GL
48 } // namespace Msp
49
50 #endif