2013-04-18 20:21:19 +00:00
|
|
|
#ifndef TGA_LOADER_H_INCLUDED
|
|
|
|
#define TGA_LOADER_H_INCLUDED
|
|
|
|
|
|
|
|
#include "include/Utils/Utils.h"
|
|
|
|
|
|
|
|
//Thanks to NeHe
|
|
|
|
|
|
|
|
namespace SE
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
const int CONST_TGA_OUTER_HEADER_SIZE = 12;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2013-05-28 15:17:21 +00:00
|
|
|
unsigned char Header[CONST_TGA_OUTER_HEADER_SIZE]; // TGA File Header
|
2013-04-18 20:21:19 +00:00
|
|
|
} TGAHeader;
|
|
|
|
|
|
|
|
const int CONST_TGA_INNER_HEADER_SIZE = 6;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2013-05-28 15:17:21 +00:00
|
|
|
unsigned char header[CONST_TGA_INNER_HEADER_SIZE]; // First 6 Useful Bytes From The Header
|
|
|
|
unsigned int bytesPerPixel; // Holds Number Of Bytes Per Pixel Used In The TGA File
|
|
|
|
unsigned int imageSize; // Used To Store The Image Size When Setting Aside Ram
|
|
|
|
unsigned int temp; // Temporary Variable
|
|
|
|
unsigned int type;
|
|
|
|
unsigned int Height; //Height of Image
|
|
|
|
unsigned int Width; //Width ofImage
|
|
|
|
unsigned int Bpp; // Bits Per Pixel
|
2013-04-18 20:21:19 +00:00
|
|
|
} TGA;
|
|
|
|
|
|
|
|
|
|
|
|
//TGAHeader tgaheader; // TGA header
|
|
|
|
//TGA tga; // TGA image data
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-28 15:17:21 +00:00
|
|
|
extern unsigned char uTGAcompare[12]; // Uncompressed TGA Header
|
|
|
|
extern unsigned char cTGAcompare[12]; // Compressed TGA Header
|
2013-04-18 20:21:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct TTextureData; // Find it in SalmonTexture.h
|
|
|
|
|
|
|
|
|
|
|
|
bool LoadTGA(const std::string& filename, TTextureData& texture);
|
|
|
|
|
|
|
|
bool LoadUncompressedTGA(TTextureData& texture, boost::shared_array<char> fTGA); // Load an Uncompressed file
|
|
|
|
bool LoadCompressedTGA(TTextureData& texture, boost::shared_array<char> fTGA); // Load a Compressed file
|
|
|
|
|
|
|
|
|
|
|
|
} //namespace SE
|
|
|
|
|
|
|
|
|
|
|
|
#endif //TGA_LOADER_H_INCLUDED
|