diff options
| author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2026-03-09 12:17:41 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2026-03-09 12:18:59 +0000 |
| commit | 57b27dada7e6968a6081207d9b466bf7e842039b (patch) | |
| tree | 0acfb043f44c789fc5ee9696ac34ea9ed7fed767 /gfx/models | |
| parent | Remove identifier naming lint comments, gl* is fine (diff) | |
| download | ilt-57b27dada7e6968a6081207d9b466bf7e842039b.tar.bz2 ilt-57b27dada7e6968a6081207d9b466bf7e842039b.tar.xz ilt-57b27dada7e6968a6081207d9b466bf7e842039b.zip | |
Specialise glTexture::savePosition
Normalises the range of position information into the range 0-255 so the
resulting image is remotely useful.
Diffstat (limited to 'gfx/models')
| -rw-r--r-- | gfx/models/tga.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gfx/models/tga.h b/gfx/models/tga.h index 3d072fb..955e5e1 100644 --- a/gfx/models/tga.h +++ b/gfx/models/tga.h @@ -3,14 +3,15 @@ #include <cstdint> #include <glm/vec2.hpp> -struct TGAHead { +template<glm::length_t Channels> struct TGAHead { using XY = glm::vec<2, uint16_t>; + using PixelType = glm::vec<Channels, uint8_t>; + uint8_t idLength {}, colorMapType {}, format {}; uint16_t __attribute__((packed)) colorMapFirst {}, colorMapLength {}; uint8_t colorMapEntrySize {}; XY origin {}, size {}; - uint8_t pixelDepth {}; + uint8_t pixelDepth {8 * Channels}; uint8_t descriptor {}; + PixelType data[1] {}; }; - -static_assert(sizeof(TGAHead) == 18); |
