Texture.h
上传用户:hkb425
上传日期:2007-06-16
资源大小:34191k
文件大小:2k
源码类别:

游戏引擎

开发平台:

Visual C++

  1. // Texture.h: interface for the CTexture class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_TEXTURE_H__D9335E64_D6A4_45E9_A6FA_FF8A3BCEB330__INCLUDED_)
  5. #define AFX_TEXTURE_H__D9335E64_D6A4_45E9_A6FA_FF8A3BCEB330__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include <stdio.h>
  10. typedef struct
  11. {
  12. GLubyte Header[12]; // TGA File Header
  13. } TGAHeader;
  14. typedef struct
  15. {
  16. GLubyte header[6]; // First 6 Useful Bytes From The Header
  17. GLuint bytesPerPixel; // Holds Number Of Bytes Per Pixel Used In The TGA File
  18. GLuint imageSize; // Used To Store The Image Size When Setting Aside Ram
  19. GLuint temp; // Temporary Variable
  20. GLuint type;
  21. GLuint Height; //Height of Image
  22. GLuint Width; //Width ofImage
  23. GLuint Bpp; // Bits Per Pixel
  24. } TGA;
  25. typedef struct
  26. {
  27. GLubyte * imageData; // Image Data (Up To 32 Bits)
  28. GLuint bpp; // Image Color Depth In Bits Per Pixel
  29. GLuint width; // Image Width
  30. GLuint height; // Image Height
  31. GLuint type; // Image Type (GL_RGB, GL_RGBA)
  32. } Texture;
  33. class CTexture  
  34. {
  35. public:
  36. CTexture();
  37.     bool  MakeTextureBind(char* TextureFileName,unsigned int* TextureID,
  38.                            bool bLinear=true,bool bMip=true);
  39.     bool  MakeSkinTextureBind(char* TextureFileName,unsigned int* TextureID,
  40.                            bool bLinear=true,bool bMip=true);
  41.     bool  MakeAlphaTextureBind(char* TextureFileName,unsigned int* TextureID);
  42.     bool  MakeAlphaTextureBind(char* TextureFileName,char *AlphaFileName,unsigned int* TextureID);
  43.     bool  MakeTGAAlphaBind(char* TextureFileName,unsigned int* TextureID);
  44. virtual ~CTexture();
  45. protected:
  46.     bool LoadUncompressedTGA(Texture * texture, char * filename, FILE * fTGA);
  47.     bool LoadCompressedTGA(Texture * texture, char * filename, FILE * fTGA) ;
  48. };
  49. #endif // !defined(AFX_TEXTURE_H__D9335E64_D6A4_45E9_A6FA_FF8A3BCEB330__INCLUDED_)