]> git.lizzy.rs Git - shadowclad.git/blob - src/engine/tga.h
Add copyright and license notices in source code
[shadowclad.git] / src / engine / tga.h
1 /**
2  * Copyright 2018-2020 Iwo 'Outfrost' Bujkiewicz
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8
9 #ifndef ENGINE_TGA_H_
10 #define ENGINE_TGA_H_
11
12 #include <GL/gl.h>
13
14 typedef struct TgaHeader TgaHeader;
15 typedef struct TgaImage TgaImage;
16
17 #pragma pack(push, 1)
18 struct TgaHeader {
19         GLubyte idLength;
20         GLbyte colorMapType;
21         GLbyte imageType;
22         GLushort colorMapStart;
23         GLushort colorMapLength;
24         GLubyte colorMapBpp;
25         GLushort originX;
26         GLushort originY;
27         GLushort imageWidth;
28         GLushort imageHeight;
29         GLubyte imageBpp;
30         GLbyte imageDescriptor;
31 };
32 #pragma pack(pop)
33
34 struct TgaImage {
35         TgaHeader header;
36         GLenum imageFormat;
37         GLint imageComponents;
38         GLbyte* bytes;
39 };
40
41 TgaImage* readTga(const char* path);
42
43 #endif // ENGINE_TGA_H_