#ifndef GLI_MATERIAL_H
#define GLI_MATERIAL_H
 
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
struct GEO_tdstColor_;
/* For DLL using these function :*/
#include "cpa_expt.h" 
 
 
extern CPA_EXPORT void GLI_xCreateMaterial( ACP_tdxHandleOfMaterial *p_hMaterial ) ;
extern CPA_EXPORT void GLI_xDeleteMaterial( ACP_tdxHandleOfMaterial hMaterial );
extern CPA_EXPORT void GLI_xDuplicateMaterial( ACP_tdxHandleOfMaterial *p_hDest, ACP_tdxHandleOfMaterial p_hSource ) ;
 
extern CPA_EXPORT void GLI_xSetMaterialAmbientCoef( ACP_tdxHandleOfMaterial hMaterial, struct GEO_tdstColor_ *p_stColor ) ;
extern CPA_EXPORT void GLI_xGetMaterialAmbientCoef( ACP_tdxHandleOfMaterial hMaterial, struct GEO_tdstColor_ *p_stColor ) ;
 
extern CPA_EXPORT void GLI_xSetMaterialDiffuseCoef( ACP_tdxHandleOfMaterial hMaterial, struct GEO_tdstColor_ *p_stColor ) ;
extern CPA_EXPORT void GLI_xGetMaterialDiffuseCoef( ACP_tdxHandleOfMaterial hMaterial, struct GEO_tdstColor_ *p_stColor ) ;
 
extern CPA_EXPORT void GLI_xSetMaterialSpecularCoef( ACP_tdxHandleOfMaterial hMaterial, long lSpecularExponent, struct GEO_tdstColor_ *p_stColor ) ;
extern CPA_EXPORT void GLI_xGetMaterialSpecularCoef( ACP_tdxHandleOfMaterial hMaterial, long *p_lSpecularExponent, struct GEO_tdstColor_ *p_stColor ) ;
 
extern CPA_EXPORT void GLI_xGetMaterialType( ACP_tdxHandleOfMaterial  hMaterial, unsigned long *xMType );
extern CPA_EXPORT void GLI_xSetMaterialType( ACP_tdxHandleOfMaterial  hMaterial, unsigned long xMType );
 
extern CPA_EXPORT void GLI_xSetMaterialTexture( ACP_tdxHandleOfMaterial hMaterial, struct GLI_tdstTexture_ *p_stTexture );
extern CPA_EXPORT void GLI_xGetMaterialTexture( ACP_tdxHandleOfMaterial hMaterial, struct GLI_tdstTexture_ **p_stTexture );
 
extern CPA_EXPORT void GLI_xSetMaterialColor( ACP_tdxHandleOfMaterial hMaterial, struct GEO_tdstColor_ *p_stColor );
extern CPA_EXPORT void GLI_xGetMaterialColor( ACP_tdxHandleOfMaterial hMaterial, struct GEO_tdstColor_ *p_stColor );
 
extern CPA_EXPORT long GLI_xIsMaterialTransparent ( ACP_tdxHandleOfMaterial hMaterial );
extern CPA_EXPORT long GLI_bIsMaterialChromed ( ACP_tdxHandleOfMaterial hMaterial );
extern CPA_EXPORT void GLI_vSetMaterialAsChromed ( ACP_tdxHandleOfMaterial hMaterial , long lTextureNumber );
extern CPA_EXPORT long GLI_bIsMaterialBackface ( ACP_tdxHandleOfMaterial hMaterial );
 
extern CPA_EXPORT void GLI_xSetMaterialTextureScrollingOnOff( ACP_tdxHandleOfMaterial hMaterial,long bSwitch);
extern CPA_EXPORT void GLI_xSetMaterialTextureScrollingCoef( ACP_tdxHandleOfMaterial hMaterial , long lNumberOfTexture , long bSwitch , float fUSpeed , float fVSpeed ) ;
extern CPA_EXPORT void GLI_xSetMaterialTextureDecalage( ACP_tdxHandleOfMaterial hMaterial , long lNumberOfTexture , long bSwitch , float fUSpeed , float fVSpeed ) ;
extern CPA_EXPORT void GLI_xGetMaterialTextureScrollingCoef( ACP_tdxHandleOfMaterial hMaterial , long lNumberOfTexture , long *p_bSwitch , float *p_fUSpeed , float *p_fVSpeed );
 
extern CPA_EXPORT void GLI_xRefreshAnimatedTexture( ACP_tdxHandleOfMaterial hMaterial );
extern CPA_EXPORT void GLI_vAddMaterialAnimatedTexture( ACP_tdxHandleOfMaterial hMaterial, long lNumberOfAnimatedTexture, struct GLI_tdstTexture_ *p_stTexture ,float fExpositionTimeInSeconds);
extern CPA_EXPORT long GLI_lGetMaterialNumberOfAnimatedTexture( ACP_tdxHandleOfMaterial hMaterial );
extern CPA_EXPORT void GLI_vGetMaterialAnimatedTexture( ACP_tdxHandleOfMaterial hMaterial  , long lNumberOfAnimatedTexture,struct GLI_tdstTexture_ **h_stTexture ,float *p_fDisplayTime);
extern CPA_EXPORT void GLI_vModifyMaterialAnimatedTexture( ACP_tdxHandleOfMaterial hMaterial  , long lNumberOfAnimatedTexture,struct GLI_tdstTexture_ *p_stTexture ,float fDisplayTime);
 
/* Functions to lock and unlock an animated texture*/
extern CPA_EXPORT void GLI_vLockAnimatedTexture(ACP_tdxHandleOfMaterial _hMaterial);
extern CPA_EXPORT void GLI_vUnLockAnimatedTexture(ACP_tdxHandleOfMaterial _hMaterial);
extern CPA_EXPORT void GLI_vSetCurrentAnimatedTextureNumber( ACP_tdxHandleOfMaterial hMaterial, long lTextureNumber ); /* For AI*/
extern CPA_EXPORT long GLI_lGetCurrentAnimatedTextureNumber( ACP_tdxHandleOfMaterial hMaterial ); /* For AI*/
 
extern CPA_EXPORT void  GLI_vDeleteMaterialAnimatedTexture( ACP_tdxHandleOfMaterial hMaterial  , long lNumberOfAnimatedTexture);
 
/*VLMT*/
/* 
 * new functions to take care of multitexture purpose
 */
#ifdef MULTI_TEXTURE
 
void GLI_Material_fn_vInitMultiTexturePart( ACP_tdxHandleOfMaterial _hVisualMat );
long GLI_Material_fn_lSetTexture( ACP_tdxHandleOfMaterial _hVisualMat, long _lIndex, struct GLI_tdstTexture_ *_p_stTexture );
long GLI_Material_fn_lSetTextureOp( ACP_tdxHandleOfMaterial _hVisualMat, long _lIndex, long _lTextureOp );
long GLI_Material_fn_lSetUVFunction( ACP_tdxHandleOfMaterial _hVisualMat, long _lCanal, long _lFunc, float _fScaleU, float _fScaleV, float _fAlphaSpeed, float _fAlpha, float _fSpeedU, float _fSpeedV, float _fOffsetU, float _fOffsetV );
long GLI_Material_fn_lSetTextureOpWithString( ACP_tdxHandleOfMaterial _hVisualMat, long _lIndex, char *_szOpString );
long GLI_Material_fn_lSetUVFuncWithString( ACP_tdxHandleOfMaterial _hVisualMat, long _lCanal, char *_szFuncString, float _fScaleU, float _fScaleV, float _fAlphaSpeed, float _fAlpha, float _fSpeedU, float _fSpeedV, float _fOffsetU, float _fOffsetV );
 
 
#else
 
#define GLI_Material_fn_vInitMultiTexturePart( a )
#define GLI_Material_fn_lSetTexture( a, b, c )
#define GLI_Material_fn_lSetTextureOp( a, b, c )
#define GLI_Material_fn_lSetUVFunction( a, b, c, d, e, f, g, h, i, j, k )
#define GLI_Material_fn_lSetTextureOpWithString( a, b, c )
#define GLI_Material_fn_lSetUVFuncWithString( a, b, c, d, e, f, g, h, i, j, k )
 
#endif /*MULTI_TEXTURE*/
 
/* For binarisation purposes */
/*extern CPA_EXPORT void GLI_fn_vPrepareSaveMaterialBinaryBloc();*/
/*extern CPA_EXPORT void GLI_fn_vResolveMaterialBinaryBloc(unsigned long _ulStructAddress);*/
/*extern CPA_EXPORT unsigned long GLI_fn_ulWriteMaterialBinaryBloc(unsigned long _ulStructAddress, char* _p_cDestBuffer);*/
/*----------------------------------------------------------------------------
//  Description : GLI_fn_vWriteAllVisualMaterialBinaryBlocs
//----------------------------------------------------------------------------
//  Input :  _szBinaryFileName           
//  Output : 
----------------------------------------------------------------------------*/
/*extern CPA_EXPORT void GLI_fn_vWriteAllVisualMaterialBinaryBlocs(char* _szBinaryFileName);*/
/*extern CPA_EXPORT void TEX_fn_vWriteAllTextureBinaryBlocs(char* _szBinaryFileName);*/
 
#ifdef __cplusplus
};
#endif /* __cplusplus */
 
#endif /* GLI_MATERIAL_H*/
