diff options
Diffstat (limited to 'gfx/models')
-rw-r--r-- | gfx/models/texture.cpp | 1 | ||||
-rw-r--r-- | gfx/models/texture.h | 5 | ||||
-rw-r--r-- | gfx/models/tga.h | 3 | ||||
-rw-r--r-- | gfx/models/vertex.h | 12 |
4 files changed, 12 insertions, 9 deletions
diff --git a/gfx/models/texture.cpp b/gfx/models/texture.cpp index b7f1bee..f60d158 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> diff --git a/gfx/models/texture.h b/gfx/models/texture.h index 1b66c64..5e1b440 100644 --- a/gfx/models/texture.h +++ b/gfx/models/texture.h @@ -1,5 +1,6 @@ #pragma once +#include "config/types.h" #include <cache.h> #include <filesystem> #include <glArrays.h> @@ -42,7 +43,7 @@ public: protected: static void save(const glTexture &, GLenum, GLenum, uint8_t channels, const char * path, uint8_t tgaFormat); - static glm::ivec2 getSize(const glTexture &); + static TextureAbsCoord getSize(const glTexture &); glTexture m_texture; GLenum type; @@ -53,7 +54,7 @@ public: TextureAtlas(GLsizei width, GLsizei height, GLuint count); void bind(GLenum unit = GL_TEXTURE0) const override; - GLuint add(glm::ivec2 position, glm::ivec2 size, void * data, TextureOptions = {}); + GLuint add(TextureAbsCoord position, TextureAbsCoord size, void * data, TextureOptions = {}); private: glTexture m_atlas; diff --git a/gfx/models/tga.h b/gfx/models/tga.h index 52db220..3d072fb 100644 --- a/gfx/models/tga.h +++ b/gfx/models/tga.h @@ -4,10 +4,11 @@ #include <glm/vec2.hpp> struct TGAHead { + using XY = glm::vec<2, uint16_t>; uint8_t idLength {}, colorMapType {}, format {}; uint16_t __attribute__((packed)) colorMapFirst {}, colorMapLength {}; uint8_t colorMapEntrySize {}; - glm::vec<2, uint16_t> origin {}, size {}; + XY origin {}, size {}; uint8_t pixelDepth {}; uint8_t descriptor {}; }; diff --git a/gfx/models/vertex.h b/gfx/models/vertex.h index 0464ea7..5635fa1 100644 --- a/gfx/models/vertex.h +++ b/gfx/models/vertex.h @@ -1,12 +1,12 @@ #pragma once +#include "config/types.h" #include <glad/gl.h> -#include <glm/glm.hpp> class Vertex { public: #ifndef __cpp_aggregate_paren_init - constexpr Vertex(glm::vec3 pos, glm::vec2 texCoord, glm::vec3 normal, glm::vec4 colour = {}, GLuint material = 0) : + constexpr Vertex(Position3D pos, TextureRelCoord texCoord, Normal3D normal, RGBA colour = {}, GLuint material = 0) : pos {std::move(pos)}, texCoord {std::move(texCoord)}, normal {std::move(normal)}, colour {std::move(colour)}, material {material} { @@ -15,9 +15,9 @@ public: bool operator==(const Vertex &) const = default; - glm::vec3 pos; - glm::vec2 texCoord; - glm::vec3 normal; - glm::vec4 colour {}; + Position3D pos {}; + TextureRelCoord texCoord {}; + Normal3D normal {}; + RGBA colour {}; GLuint material {}; }; |