1 /* 2 3 Memonix, Viewizard Game Core ver 2.0 4 Copyright (c) 2001-2006 Michael Kurinnoy, Viewizard Games 5 All Rights Reserved. 6 7 Memonix game source codes available under "dual licensing" model. 8 The licensing options available are: 9 10 * Commercial Licensing. This is the appropriate option if you are creating proprietary 11 applications and you are not prepared to distribute and share the source code of your application. 12 Contact us for pricing at viewizard@viewizard.com 13 14 * Open Source Licensing. This is the appropriate option if you want to share the source code of 15 your application with everyone you distribute it to, and you also want to give them the right to share who uses it. 16 You should have received a copy of the GNU General Public License version 3 with this source codes. If not, see <http://www.gnu.org/licenses/>. 17 18 */ 19 20 21 #ifndef Texture_H 22 #define Texture_H 23 24 25 26 // File types (for LoadAs parametre) 27 #define AUTO_FILE 0 // Detect by file extension 28 #define BMP_FILE 1 // BMP file 29 #define TGA_FILE 2 // TGA file 30 #define JPG_FILE 4 // JPG file 31 32 // Create alpha channel by image greyscale color 33 #define TX_ALPHA_GREYSC 0x0021 34 // Create alpha channel by equal Alpha color 35 #define TX_ALPHA_EQUAL 0x0022 36 // Create alpha channel by great or equal than Alpha color 37 #define TX_ALPHA_GEQUAL 0x0023 38 // Create alpha channel by less or equal Alpha color 39 #define TX_ALPHA_LEQUAL 0x0024 40 // Create alpha channel by great than Alpha color 41 #define TX_ALPHA_GREAT 0x0025 42 // Create alpha channel by less Alpha color 43 #define TX_ALPHA_LESS 0x0026 44 45 struct eTexture 46 { 47 char* Name; // File name 48 49 int Filtering; // Texture filtering mode (near, linear, ... ) 50 int Address_Mode; // Texture address mode (wrap, clamp) 51 52 BYTE ARed; // Alpha channel red color 53 BYTE AGreen; // Alpha channel green color 54 BYTE ABlue; // Alpha channel blue color 55 56 int Width; // Texture width 57 int Height; // Texture height 58 int SrcWidth; // Source image width 59 int SrcHeight; // Source image height 60 61 int Bytes; // Bytes Per Pixel 62 63 // приоритет 64 float TexturePrior; 65 66 void* OffsetID; // Pointer to the texture data in the memory 67 68 eTexture* Prev; // Pointer to the previous loaded Texture in the memory 69 eTexture* Next; // Pointer to the next loaded Texture in the memory 70 int Num; // ID number 71 }; 72 73 74 // eTexture functions 75 // Load texture from file 76 eTexture* vw_LoadTexture(const char *TextureName, int LoadAs=AUTO_FILE, int NeedResizeW=0, int NeedResizeH=0); 77 // Load texture from memory 78 eTexture* vw_LoadTextureMem(const char *nName, BYTE *nDIB, int nWidth, int nHeight, int Colors); 79 // Release texture 80 void vw_ReleaseTexture(eTexture* Texture); 81 82 83 // Texture manager functions 84 85 // Release all textures 86 void vw_ReleaseAllTextures(); 87 // Set textures properties 88 void vw_SetTextureProp(int nFiltering, int nAddress_Mode, bool nAlpha = false, int nAFlag = TX_ALPHA_EQUAL, bool nMipMap = true); 89 // Set textures alpha color 90 void vw_SetTextureAlpha(BYTE nARed, BYTE nAGreen, BYTE nABlue); 91 92 // Find texture by name 93 eTexture* vw_FindTextureByName(const char *Name); 94 // Find texture by ID 95 eTexture* vw_FindTextureByNum(int Num); 96 97 // Set texture by eTexture pointer 98 void vw_SetTextureT(DWORD Stage, eTexture *Tex); 99 100 // проверка и установка правильного приоритета текстур 101 void vw_CheckTexturesPrior(); 102 103 104 #endif // Texture_H 105