summaryrefslogtreecommitdiffstats
path: root/src/TextureAtlas.hpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-04 16:57:19 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-08-05 01:36:50 +0200
commitd311a65e0c86aaec94f6d9a61d5f9b374f90aa5c (patch)
treebaf9e5bfad75047e639eede1603216b2c8bf8b47 /src/TextureAtlas.hpp
parentLoading texture data in AssetTree (diff)
downloadAltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar
AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar.gz
AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar.bz2
AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar.lz
AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar.xz
AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.tar.zst
AltCraft-d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c.zip
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