summaryrefslogtreecommitdiff
path: root/gfx/models
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-14 16:39:27 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-14 16:39:27 +0100
commitbe9a796e68a25f7567b7c16e00d9b42f5e0d9528 (patch)
tree446436e4e442b29b2e09a8d4a37dfdc45c9caaf8 /gfx/models
parentPass texture fragment mapmode to texture atlas (diff)
downloadilt-be9a796e68a25f7567b7c16e00d9b42f5e0d9528.tar.bz2
ilt-be9a796e68a25f7567b7c16e00d9b42f5e0d9528.tar.xz
ilt-be9a796e68a25f7567b7c16e00d9b42f5e0d9528.zip
Write applicable Texture Options into texture atlas texture data
Diffstat (limited to 'gfx/models')
-rw-r--r--gfx/models/texture.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/gfx/models/texture.cpp b/gfx/models/texture.cpp
index e29fd6c..e014f80 100644
--- a/gfx/models/texture.cpp
+++ b/gfx/models/texture.cpp
@@ -136,12 +136,15 @@ TextureAtlas::bind(GLenum unit) const
}
GLuint
-TextureAtlas::add(glm::ivec2 position, glm::ivec2 size, void * data, TextureOptions)
+TextureAtlas::add(glm::ivec2 position, glm::ivec2 size, void * data, TextureOptions to)
{
glTextureSubImage2D(m_texture, 0, position.x, position.y, size.x, size.y, GL_RGBA, GL_UNSIGNED_BYTE, data);
struct Material {
- glm::vec<2, uint16_t> position, size, unused1 {}, unused2 {};
- } material {position, size};
+ glm::vec<2, uint16_t> position, size;
+ TextureOptions::MapMode wrapU;
+ TextureOptions::MapMode wrapV;
+ } material {position, size, to.wrapU, to.wrapV};
+ static_assert(sizeof(Material) <= 32);
glTextureSubImage2D(m_atlas, 0, 0, static_cast<GLsizei>(used), 2, 1, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, &material);
return ++used;
}