]> git.tdb.fi Git - libs/gl.git/blob - source/core/texture1d.h
1871a17caaa4d282ae1fee19fb656c3686808029
[libs/gl.git] / source / core / texture1d.h
1 #ifndef MSP_GL_TEXTURE1D_H_
2 #define MSP_GL_TEXTURE1D_H_
3
4 #include <string>
5 #include "texture1d_backend.h"
6
7 namespace Msp {
8 namespace GL {
9
10 class Texture1D: public Texture1DBackend
11 {
12         friend Texture1DBackend;
13
14 public:
15         class Loader: public DataFile::DerivedObjectLoader<Texture1D, Texture::Loader>
16         {
17         public:
18                 Loader(Texture1D &);
19                 Loader(Texture1D &, Collection &);
20         private:
21                 void init();
22
23                 void raw_data(const std::string &);
24                 void storage(PixelFormat, unsigned);
25                 void storage_levels(PixelFormat, unsigned, unsigned);
26         };
27
28 private:
29         unsigned width;
30         unsigned levels;
31
32 public:
33         Texture1D();
34
35         void storage(PixelFormat, unsigned, unsigned = 0);
36
37         void image(unsigned, const void *);
38         void sub_image(unsigned, int, unsigned, const void *);
39         virtual void image(const Graphics::Image &, unsigned = 0);
40         using Texture::image;
41         unsigned get_width() const { return width; }
42
43 private:
44         unsigned get_n_levels() const;
45         unsigned get_level_size(unsigned) const;
46
47 public:
48         virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
49         virtual std::uint64_t get_data_size() const;
50         virtual void unload() { }
51 };
52
53 } // namespace GL
54 } // namespace Msp
55
56 #endif