1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-03 06:24:32 +00:00

remove zlib, libpng, glpng and related code; add some stb libs; rework texture loading

This commit is contained in:
fgenesis 2022-03-31 21:03:40 +02:00
parent da2385d6c6
commit 96216503c4
86 changed files with 21936 additions and 57875 deletions

View file

@ -31,13 +31,7 @@ enum TextureLoadResult
TEX_SUCCESS
};
struct ImageTGA
{
int channels; // The channels in the image (3 = RGB : 4 = RGBA)
int sizeX; // The width of the image in pixels
int sizeY; // The height of the image in pixels
unsigned char *data; // The image pixel data
};
struct ImageData;
class Texture : public Refcounted
{
@ -45,7 +39,7 @@ public:
Texture();
~Texture();
bool load(std::string file);
bool load(std::string file, bool mipmap);
void apply(bool repeatOverride=false);
void unbind();
void unload();
@ -55,12 +49,8 @@ public:
void destroy();
int width, height;
static ImageTGA *TGAload(const char* filename);
static ImageTGA *TGAloadMem(void *mem, int size);
bool repeat, repeating;
unsigned textures[1];
@ -79,15 +69,11 @@ public:
protected:
std::string loadName;
// internal load functions
bool loadPNG(const std::string &file);
bool loadTGA(const std::string &file);
bool loadZGA(const std::string &file);
bool loadTGA(ImageTGA *tga);
bool loadInternal(const ImageData& img, bool mipmap);
int ow, oh;
TextureLoadResult loadResult;
bool _mipmap;
};
#define UNREFTEX(x) if (x) {x = NULL;}