summaryrefslogtreecommitdiffstats
path: root/src/TextureAtlas.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/TextureAtlas.hpp')
-rw-r--r--src/TextureAtlas.hpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/TextureAtlas.hpp b/src/TextureAtlas.hpp
new file mode 100644
index 0000000..76a6c49
--- /dev/null
+++ b/src/TextureAtlas.hpp
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <vector>
+
+#include <gl/glew.h>
+
+struct TextureData {
+ std::vector<unsigned char> data; //expected format RGBA8888
+ int width, height;
+};
+
+struct TextureCoord {
+ double x, y, w, h;
+ int pixelX, pixelY, pixelW, pixelH;
+ size_t layer;
+};
+
+class TextureAtlas {
+ GLuint texture;
+ std::vector<TextureCoord> textureCoords;
+public:
+ TextureAtlas(std::vector<TextureData> &textures);
+
+ TextureAtlas(const TextureAtlas &) = delete;
+
+ ~TextureAtlas();
+
+ inline GLuint GetRawTextureId() {
+ return texture;
+ }
+
+ TextureCoord GetTexture(int id) {
+ return textureCoords[id];
+ }
+}; \ No newline at end of file