summaryrefslogtreecommitdiff
path: root/gfx/models/texture.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-01 17:56:26 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-01 17:56:26 +0000
commitd5cdbbf38380239524e351cb69aec94090884ca5 (patch)
tree5d7dff2f2775701069806eceb4eaef23b22eba3f /gfx/models/texture.cpp
parentReformat with new clang-format (diff)
parentRemove more use of legacy types (diff)
downloadilt-d5cdbbf38380239524e351cb69aec94090884ca5.tar.bz2
ilt-d5cdbbf38380239524e351cb69aec94090884ca5.tar.xz
ilt-d5cdbbf38380239524e351cb69aec94090884ca5.zip
Merge remote-tracking branch 'origin/terrain'
Diffstat (limited to 'gfx/models/texture.cpp')
-rw-r--r--gfx/models/texture.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/gfx/models/texture.cpp b/gfx/models/texture.cpp
index b7f1bee..35f8d35 100644
--- a/gfx/models/texture.cpp
+++ b/gfx/models/texture.cpp
@@ -1,4 +1,5 @@
#include "texture.h"
+#include "config/types.h"
#include "glArrays.h"
#include "tga.h"
#include <cache.h>
@@ -60,10 +61,10 @@ Texture::bind(GLenum unit) const
glBindTexture(type, m_texture);
}
-glm::ivec2
+TextureAbsCoord
Texture::getSize(const glTexture & texture)
{
- glm::ivec2 size;
+ TextureAbsCoord size;
glGetTextureLevelParameteriv(texture, 0, GL_TEXTURE_WIDTH, &size.x);
glGetTextureLevelParameteriv(texture, 0, GL_TEXTURE_HEIGHT, &size.y);
return size;
@@ -103,6 +104,12 @@ Texture::save(const glTexture & texture, const char * path)
}
void
+Texture::savePosition(const glTexture & texture, const char * path)
+{
+ save(texture, GL_BGR_INTEGER, GL_UNSIGNED_BYTE, 3, path, 2);
+}
+
+void
Texture::saveDepth(const glTexture & texture, const char * path)
{
save(texture, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 1, path, 3);
@@ -136,7 +143,7 @@ TextureAtlas::bind(GLenum unit) const
}
GLuint
-TextureAtlas::add(glm::ivec2 position, glm::ivec2 size, void * data, TextureOptions to)
+TextureAtlas::add(TextureAbsCoord position, TextureAbsCoord size, void * data, TextureOptions to)
{
glTextureSubImage2D(m_texture, 0, position.x, position.y, size.x, size.y, GL_RGBA, GL_UNSIGNED_BYTE, data);