#if !defined __GLI_TEX_H__
#define __GLI_TEX_H__
 
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
 
#define TEX_C_QNORMAL       20
#define TEX_C_QHIGH         30
#define TEX_C_QLOW          10
 
#define TEX_C_NO_MIPMAPPING 1
#define TEX_C_BILINEAR      2
#define TEX_C_TRILINEAR     3
 
/*
 * Cycling mode (clamp and mirror)
 */
#define GLI_C_lCylingU                   1
#define GLI_C_lCylingV                   2
#define GLI_C_lCylingUV                  3
 
#define GLI_C_lMirrorU	                 4
#define GLI_C_lMirrorV	                 8
#define GLI_C_lMirrorUV	                12
#define GLI_C_lSpecialMirrorForShadow   16
 
 
#define TEX_C_M8INT   1
#define TEX_C_M16ARGB 2
#define TEX_C_M16RGB  3
#define TEX_C_M8P     4
 
#define TEX_C_NZFILTERING_ON    1
#define TEX_C_NZFILTERING_OFF   2
 
#define TEX_C_VRAM    0
#define TEX_C_VRAMAGP 1
#define TEX_C_VRAM4   2
#define TEX_C_VRAM8   3
#define TEX_C_AGP4    4
#define TEX_C_AGP8    5
#define TEX_C_AGP     6
 
 
typedef struct TEX_tdstPalette_
{
  unsigned char a1024_uccolors[1024];
} TEX_tdstPalette;
 
/*#################
    Define
###################*/
#define C_lMaxNumberOfTexture 1024
#define GLI_TEXIsUnallocated 0xC0DE0005
 
/*
 * Access function (in Texture.c)
 */
extern CPA_EXPORT void              TEX_vGetTextureSize             (struct GLI_tdstTexture_ *p_stTexture ,long *p_lSizeX, long *p_lSizeY);
extern CPA_EXPORT void              TEX_vSetTextureTilingMode       (struct GLI_tdstTexture_ *p_stTexture, BOOL bTilingX , BOOL bTilingY );
extern CPA_EXPORT void              TEX_vGetTextureTilingMode       (struct GLI_tdstTexture_ *p_stTexture, BOOL *p_bTilingX , BOOL *p_bTilingY );
extern CPA_EXPORT void              TEX_vSetTextureCyclingMode      (struct GLI_tdstTexture_ *_p_stTexture, unsigned char _ucNewCyclingMode );
extern CPA_EXPORT unsigned char     TEX_ucGetTextureCyclingMode     (struct GLI_tdstTexture_ *_p_stTexture );
extern CPA_EXPORT void              TEX_vGetTextureBilinearMode     (struct GLI_tdstTexture_ *p_stTexture, BOOL *p_bFilteringX , BOOL *p_bFilteringY );
extern CPA_EXPORT void              TEX_vSetTextureBilinearMode     (struct GLI_tdstTexture_ *p_stTexture, BOOL bFilteringX , BOOL bFilteringY );
extern CPA_EXPORT void              TEX_vSetTextureZWriteMode       (struct GLI_tdstTexture_ *p_Texture , long ON_OFF);
extern CPA_EXPORT long              TEX_vGetTextureZWriteMode       (struct GLI_tdstTexture_ *p_Texture );
extern CPA_EXPORT void              TEX_vSetTextureQualityLevel     (struct GLI_tdstTexture_ *p_stTexture , char ucTextQuality);
extern CPA_EXPORT unsigned char     TEX_ucGetTextureQualityLevel    (struct GLI_tdstTexture_ *p_stTexture);
extern CPA_EXPORT long              TEX_bIsTextureNZ                (struct GLI_tdstTexture_ *p_stTexture);
extern CPA_EXPORT void              TEX_vSetTextureChromakey        (struct GLI_tdstTexture_ *p_stTexture , BOOL bSwitchOnOff , BOOL bFilteringOnOff , unsigned char R , unsigned char G , unsigned char B , unsigned char A);
extern CPA_EXPORT void              TEX_vGetTextureChromakey        (struct GLI_tdstTexture_ *p_stTexture , BOOL *bSwitchOnOff, BOOL *bFilteringOnOff, unsigned char *ucR   , unsigned char *ucG , unsigned char *ucB , unsigned char *ucA);
extern CPA_EXPORT void              TEX_vSetPaletteOfTexture        (struct GLI_tdstTexture_ *p_stTexture,TEX_tdstPalette *p_Palette);
extern CPA_EXPORT TEX_tdstPalette * TEX_vGetPaletteOfTexture        (struct GLI_tdstTexture_ *p_stTexture);
extern CPA_EXPORT void              TEX_vSetTextureCompressionMode  (struct GLI_tdstTexture_ *p_stTexture,long typeOfCompression);
extern CPA_EXPORT long              TEX_vGetTextureCompressionMode  (struct GLI_tdstTexture_ *p_stTexture);
extern CPA_EXPORT void              TEX_vSetTextureMipMappingMode   (struct GLI_tdstTexture_ *p_stTexture, long lTypeOfMipMapping);
extern CPA_EXPORT long              TEX_lGetTextureMipMappingMode   (struct GLI_tdstTexture_ *p_stTexture);
extern CPA_EXPORT void              GLI_vSetTextureName             (struct GLI_tdstTexture_ *p_stTexture , char *p_cName );
extern CPA_EXPORT void              GLI_vGetTextureName             (struct GLI_tdstTexture_ *p_stTexture , char *p_cName );
extern CPA_EXPORT void              TEX_vSetSupplyTexture           (struct GLI_tdstTexture_ *p_stTexture, struct GLI_tdstTexture_ *p_stSupplyTexture);
extern CPA_EXPORT struct GLI_tdstTexture_ *TEX_p_tdstGetSupplyTexture(struct GLI_tdstTexture_ *p_stTexture);
 
                  long              GLI_lGetSizeOfTexture           (struct GLI_tdstTexture_ *p_stTexture );
 
/*
 * function from tex.c
 */
void GLI_vSetTextureMode(char *sMode);
long GLI_lGetTextureMode();
void GLI_xCreateTexture ( struct GLI_tdstTexture_ **h_stTexture );
void GLI_xLoadTextureHeader(struct GLI_tdstTexture_ **h_stTexture, GLD_tdstDeviceAttributes *p_stDev,char *d_ucFileName, long  lTextureCaps, long  lTextureQuality);
void GLI_vIniTextRead( void );
void GLI_vComputeTextures( void );
void GLI_TEX_vSignalCurrentMemoryChannel(unsigned char ucCurrentChannel);
void GLI_TEX_vKillMemoryChannel(unsigned char ucCurrentChannel);
 
void GLI_vLoadLodAndAddItToTexture(struct GLI_tdstTexture_ *p_stTexture, GLD_tdstDeviceAttributes *p_stDev,char *d_ucFileName, long  lTextureCaps, long  lTextureQuality);
void GLI_vComputeLod(struct GLI_tdstTexture_ *p_stTexture);
 
void GLI_vReloadTexture(void);
void GLI_vUnloadTexture(void);
 
 
 
/*
 * fonction from texsna.c
 */
void TEX_SetNameOfBinaryFile(unsigned char *p_ucBinaryFile);
 
 
#ifdef __cplusplus
}
#endif /* __cplusplus */
 
#endif /* __GLI_TEX_H__ */
