Added class TargaImage

~G2k
This commit is contained in:
2006-07-01 23:09:54 -04:00
parent 1dd65057a8
commit 966442e566
2 changed files with 563 additions and 483 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -15,22 +15,43 @@
#include <cstdio> #include <cstdio>
#include <string> #include <string>
#include "texture.h" #include "texture.h"
#include "Image.h"
namespace OpenArena{ namespace OpenArena{
struct TGAHeader class TargaImage: public Image{
{ private:
GLubyte Header[12]; // File Header To Determine File Type TargaImage();
}; TargaImage(uint32 width, uint32 height, uint32 bpp = 24, Image::Type type = Image::Type_RGB);
uint32 _width;
uint32 _height;
uint32 _bpp;
Image::Type _type;
uint8 * _data;
public:
struct TGAHeader
{
GLubyte Header[12]; // File Header To Determine File Type
};
struct TGA struct TGA
{ {
GLubyte header[6]; // Holds The First 6 Useful Bytes Of The File GLubyte header[6]; // Holds The First 6 Useful Bytes Of The File
GLuint bytesPerPixel; // Number Of BYTES Per Pixel (3 Or 4) GLuint bytesPerPixel; // Number Of BYTES Per Pixel (3 Or 4)
GLuint imageSize; // Amount Of Memory Needed To Hold The Image GLuint imageSize; // Amount Of Memory Needed To Hold The Image
GLuint type; // The Type Of Image, GL_RGB Or GL_RGBA GLuint type; // The Type Of Image, GL_RGB Or GL_RGBA
GLuint Height; // Height Of Image GLuint Height; // Height Of Image
GLuint Width; // Width Of Image GLuint Width; // Width Of Image
GLuint Bpp; // Number Of BITS Per Pixel (24 Or 32) GLuint Bpp; // Number Of BITS Per Pixel (24 Or 32)
};
virtual uint8 * GetImageData() const;
virtual uint32 GetBitsPerPixel() const;
virtual uint32 GetBytesPerPixel() const;
virtual uint32 GetWidth() const;
virtual uint32 GetHeight() const;
virtual Image::Type GetType() const;
virtual ~TargaImage(void);
static TargaImage* CreateFromFile(const char* filename);
}; };
TextureImage* LoadTGA(const char *filename); TextureImage* LoadTGA(const char *filename);