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

View File

@@ -15,22 +15,43 @@
#include <cstdio>
#include <string>
#include "texture.h"
#include "Image.h"
namespace OpenArena{
struct TGAHeader
{
GLubyte Header[12]; // File Header To Determine File Type
};
class TargaImage: public Image{
private:
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
{
GLubyte header[6]; // Holds The First 6 Useful Bytes Of The File
GLuint bytesPerPixel; // Number Of BYTES Per Pixel (3 Or 4)
GLuint imageSize; // Amount Of Memory Needed To Hold The Image
GLuint type; // The Type Of Image, GL_RGB Or GL_RGBA
GLuint Height; // Height Of Image
GLuint Width; // Width Of Image
GLuint Bpp; // Number Of BITS Per Pixel (24 Or 32)
struct TGA
{
GLubyte header[6]; // Holds The First 6 Useful Bytes Of The File
GLuint bytesPerPixel; // Number Of BYTES Per Pixel (3 Or 4)
GLuint imageSize; // Amount Of Memory Needed To Hold The Image
GLuint type; // The Type Of Image, GL_RGB Or GL_RGBA
GLuint Height; // Height Of Image
GLuint Width; // Width Of Image
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);