]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture2darray.h
Implement 2D array textures
[libs/gl.git] / source / texture2darray.h
diff --git a/source/texture2darray.h b/source/texture2darray.h
new file mode 100644 (file)
index 0000000..5e0969a
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef MSP_GL_TEXTURE2DARRAY_H_
+#define MSP_GL_TEXTURE2DARRAY_H_
+
+#include "texture3d.h"
+
+namespace Msp {
+namespace GL {
+
+/**
+An array of two-dimensional textures.  It's very much like a 3D texture, with
+two important differences: there's no filtering nor mipmapping along the third
+dimension.
+*/
+class Texture2DArray: public Texture3D
+{
+public:
+       class Loader: public Msp::DataFile::DerivedObjectLoader<Texture2DArray, Texture3D::Loader>
+       {
+       public:
+               Loader(Texture2DArray &);
+               Loader(Texture2DArray &, Collection &);
+       private:
+               void init();
+
+               void external_image(unsigned, const std::string &);
+       };
+
+       Texture2DArray();
+
+       void layer_image(unsigned, unsigned, PixelFormat, DataType, const void *);
+       void layer_image(unsigned, unsigned, const Graphics::Image &);
+
+       unsigned get_layers() const { return get_depth(); }
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif