Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.5 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: texture.hxx
  3. *
  4. * texture
  5. *
  6. * Copyright (c) 1997 Microsoft Corporation
  7. *
  8. \**************************************************************************/
  9. #ifndef __texture_h__
  10. #define __texture_h__
  11. #include "mtk.h"
  12. class TEXTURE {
  13. public:
  14. TEXTURE() { Init(); }
  15. TEXTURE( TEXFILE *pTexFile ); // probably won't need this one...
  16. TEXTURE( LPTSTR pszBmpFile );
  17. TEXTURE( TEX_RES *pTexRes, HINSTANCE hInst );
  18. TEXTURE( HBITMAP hBitmap );
  19. ~TEXTURE();
  20. void MakeCurrent();
  21. void SetPaletteRotation( int index );
  22. void IncrementPaletteRotation();
  23. BOOL SetTransparency( float fTransp, BOOL bSet );
  24. BOOL IsValid() { return data != 0; }
  25. BOOL HasPalette() { return pal != 0; }
  26. float GetAspectRatio() { return origAspectRatio; }
  27. void GetSize( ISIZE *size ) { size->width = width; size->height = height;}
  28. private:
  29. void Init();
  30. BOOL LoadBitmapResource( LPTSTR pRes, HINSTANCE hInst );
  31. BOOL LoadOtherResource( TEX_RES *pTexRes, HINSTANCE hInst );
  32. BOOL LoadFromBitmap( HBITMAP hBitmap );
  33. BOOL ValidateSize();
  34. void SetDefaultParams();
  35. int ProcessTkTexture( TK_RGBImageRec *image );
  36. int Process();
  37. void SetAlpha( float fAlpha );
  38. BOOL ConvertToRGBA( float fAlpha );
  39. int GetTexFileType( TEXFILE *pTexFile );
  40. BOOL A8ImageLoad( void *pvResource );
  41. BOOL RGBImageLoad( void *pvResource );
  42. BOOL DIBImageLoad( HBITMAP hBitmap );
  43. void SetPalette();
  44. // mf: This set of parameters constitutes gl texture data, and could be stored
  45. // on disk or as a resource. It would load faster, since no preprocessing
  46. // would be required. Could write simple utilities to read and write this
  47. // format
  48. // ****************
  49. int width;
  50. int height;
  51. GLenum format;
  52. GLsizei components;
  53. unsigned char *data;
  54. int pal_size;
  55. RGBQUAD *pal;
  56. float origAspectRatio; // original width/height aspect ratio
  57. // ****************
  58. GLuint texObj; // texture object
  59. BOOL bMipmap;
  60. int iPalRot;
  61. int iNewPalRot;
  62. };
  63. extern BOOL bVerifyDIB(LPTSTR pszFileName, ISIZE *pSize );
  64. extern BOOL bVerifyRGB(LPTSTR pszFileName, ISIZE *pSize );
  65. extern BOOL ss_VerifyTextureFile( TEXFILE *ptf );
  66. extern int VerifyTextureFile( TEXFILE *pTexFile );
  67. #endif // __texture_h__