44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
#pragma once
|
|
#include <glad.h>
|
|
#include <string>
|
|
|
|
class SimpleTextureLoader {
|
|
public:
|
|
static GLuint LoadBMP(const std::string& filepath);
|
|
static GLuint LoadTGA(const std::string& filepath);
|
|
|
|
private:
|
|
struct BMPHeader {
|
|
char signature[2];
|
|
uint32_t fileSize;
|
|
uint32_t reserved;
|
|
uint32_t dataOffset;
|
|
uint32_t headerSize;
|
|
uint32_t width;
|
|
uint32_t height;
|
|
uint16_t planes;
|
|
uint16_t bitsPerPixel;
|
|
uint32_t compression;
|
|
uint32_t imageSize;
|
|
uint32_t xPixelsPerMeter;
|
|
uint32_t yPixelsPerMeter;
|
|
uint32_t colorsUsed;
|
|
uint32_t colorsImportant;
|
|
};
|
|
|
|
struct TGAHeader {
|
|
uint8_t idLength;
|
|
uint8_t colorMapType;
|
|
uint8_t imageType;
|
|
uint16_t colorMapStart;
|
|
uint16_t colorMapLength;
|
|
uint8_t colorMapDepth;
|
|
uint16_t xOffset;
|
|
uint16_t yOffset;
|
|
uint16_t width;
|
|
uint16_t height;
|
|
uint8_t bitsPerPixel;
|
|
uint8_t imageDescriptor;
|
|
};
|
|
};
|