From d311a65e0c86aaec94f6d9a61d5f9b374f90aa5c Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Sat, 4 Aug 2018 19:57:19 +0500 Subject: Implemented texture atlas --- src/TextureAtlas.hpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/TextureAtlas.hpp (limited to 'src/TextureAtlas.hpp') 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 + +#include + +struct TextureData { + std::vector 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 textureCoords; +public: + TextureAtlas(std::vector &textures); + + TextureAtlas(const TextureAtlas &) = delete; + + ~TextureAtlas(); + + inline GLuint GetRawTextureId() { + return texture; + } + + TextureCoord GetTexture(int id) { + return textureCoords[id]; + } +}; \ No newline at end of file -- cgit v1.2.3