Main Page   Compound List   File List   Compound Members   File Members  

Texture.h

Go to the documentation of this file.
00001 #ifndef __Texture_h_
00002 #define __Texture_h_
00003 
00004 class CTexture;
00005 
00006 #include <stdio.h>
00007 #include <stdlib.h>
00008 #include <string.h>
00009 #include <windows.h>
00010 #include <GL/gl.h>
00011 #include <GL/glu.h>
00012 #include <GL/glut.h>
00013 
00014 // PCX Image File
00015 typedef struct tagPCXHEADER
00016 {
00017         char Manufacturer;  // always 0X0A
00018         char Version;  // version number
00019         char Encoding;  // always 1
00020         char BitsPerPixel;  // color bits
00021         WORD Xmin, Ymin;  // image origin
00022         WORD Xmax, Ymax;  // image dimensions
00023         WORD Hres, Vres;  // resolution values
00024         BYTE ColorMap[16][3];  // color palette
00025         char Reserved;
00026         char ColorPlanes;  // color planes
00027         WORD BytesPerLine;  // line buffer size
00028         WORD PaletteType;  // grey or color palette
00029         char Filter[58];
00030 } *LPPCXHEADER;
00031 
00032 #define PCX_MAGIC                       0X0A                    // PCX magic number
00033 #define PCX_256_COLORS          0X0C                    // magic number for 256 colors
00034 #define PCX_HDR_SIZE            128                             // size of PCX header
00035 #define PCX_MAXCOLORS           256
00036 #define PCX_MAXPLANES           4
00037 #define PCX_MAXVAL                      255
00038 
00039 #define MAX_TEXTURE_NAME_LENGTH 64
00040 
00041 class CTexture
00042 {
00043 public:
00044 
00045         CTexture();
00046         ~CTexture();
00047 
00048         // Create and load the files.
00049         bool LoadBMP (char *szFileName, bool mipmap);
00050         bool LoadBMP (char *szFileName);
00051         bool LoadPCX (BYTE *data, bool mipmap);
00052         bool LoadPCX (BYTE *data);
00053         bool LoadRAW (char *szFileName);
00054         void Free ();
00055         void Use ();
00056 
00057         int getWidth();
00058         int getHeight();
00059 
00060 private:
00061 
00062         // Generates the nesessary internal data.
00063         bool Create (bool mipmap);
00064 
00065         // PCX helper functions
00066         bool PCX_PlanesToPixels(BYTE *pixels, BYTE *bitplanes, short bytesperline, short planes, short bitsperpixel);
00067         bool PCX_UnpackPixels(BYTE *pixels, BYTE *bitplanes, short bytesperline, short planes, short bitsperpixel);
00068 
00069         // Status information.
00070         unsigned int m_nID;
00071         int m_nWidth, m_nHeight, m_nBits;
00072 };
00073 
00074 #endif

Generated on Sat Jan 26 05:53:58 2002 for Splatter by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001