summaryrefslogtreecommitdiff
path: root/gfx/models/texture.h
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/models/texture.h')
-rw-r--r--gfx/models/texture.h25
1 files changed, 8 insertions, 17 deletions
diff --git a/gfx/models/texture.h b/gfx/models/texture.h
index d8c3b29..9c67ae1 100644
--- a/gfx/models/texture.h
+++ b/gfx/models/texture.h
@@ -1,7 +1,7 @@
#pragma once
#include "config/types.h"
-#include "glArrays.h"
+#include "gfx/gl/glTexture.h"
#include "stdTypeDefs.h"
#include <filesystem>
#include <glm/fwd.hpp>
@@ -17,7 +17,6 @@ struct TextureOptions {
};
MapMode wrapU {MapMode::Repeat}, wrapV {MapMode::Repeat};
GLint minFilter {GL_LINEAR}, magFilter {GL_LINEAR};
- GLenum type {GL_TEXTURE_2D};
static GLint glMapMode(MapMode);
};
@@ -29,32 +28,24 @@ public:
explicit Texture(const std::filesystem::path & fileName, TextureOptions = {});
explicit Texture(const Image & image, TextureOptions = {});
explicit Texture(GLsizei width, GLsizei height, TextureOptions = {});
- explicit Texture(GLsizei width, GLsizei height, const void * data, TextureOptions = {});
+ explicit Texture(GLsizei width, GLsizei height, GLenum pixelFormat, GLenum PixelType, const void * pixels,
+ TextureOptions = {});
- virtual void bind(GLenum unit = GL_TEXTURE0) const;
-
- void save(const char * path) const;
- static void save(const glTexture &, const char * path);
- static void saveDepth(const glTexture &, const char * path);
- static void saveNormal(const glTexture &, const char * path);
- static void savePosition(const glTexture &, const char * path);
- static TextureDimensions getSize(const glTexture &);
+ virtual void bind(GLuint unit) const;
protected:
- static void save(const glTexture &, GLenum, GLenum, uint8_t channels, const char * path, uint8_t tgaFormat);
-
- glTexture m_texture;
- GLenum type;
+ glTexture<GL_TEXTURE_2D> m_texture;
};
class TextureAtlas : public Texture {
public:
TextureAtlas(GLsizei width, GLsizei height, GLuint count);
- void bind(GLenum unit = GL_TEXTURE0) const override;
+ void bind(GLuint unit) const override;
GLuint add(TextureAbsCoord position, TextureAbsCoord size, void * data, TextureOptions = {});
+ void complete();
private:
- glTexture m_atlas;
+ glTexture<GL_TEXTURE_RECTANGLE> m_atlas;
GLuint used {};
};