/*
 =======================================================================================
  Name        : Mater_st.h
  Description : structure for material
 =======================================================================================
 */
 
#ifndef GLI_MATERIAL_ST_H
#define GLI_MATERIAL_ST_H 
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
#include "GEO.h"
#include "textu_st.h"
 
/*
 =======================================================================================
    Multi texture material structure 
 =======================================================================================
 */
 
#ifdef MULTI_TEXTURE
 
#define C_MTMF_cUVStaticTransEnable     0x01
#define C_MTMF_cUVDynamicTransEnable    0x02
#define C_MTMF_cUVStaticMatEnable       0x04
#define C_MTMF_cUVDynamicMatEnable      0x08
#define C_MTMF_cIsNotLastTexture        0x10
 
#define C_MTMCO_cDisable            0
#define C_MTMCO_cSpecular           1
#define C_MTMCO_cDiffuse            2
#define C_MTMCO_cConstant           3
#define C_MTMCO_cSpecularAlpha      4
#define C_MTMCO_cDiffuseAlpha       5
#define C_MTMCO_cConstantAlpha      6
#define C_MTMCO_cSpecularColor      7
#define C_MTMCO_cDiffuseColor       8
#define C_MTMCO_cConstantColor      9
 
#define C_MTMOP_cMul                0
#define C_MTMOP_cAdd                1
#define C_MTMOP_cCopy               2
#define C_MTMOP_cAlphaTrans         3
#define C_MTMOP_cAlphaPremult       4
#define C_MTMOP_cMul2X              5
#define C_MTMOP_cInvert             6
#define C_MTMOP_cAddSmooth          7
 
#define C_MTMUV_cNoSource           0
#define C_MTMUV_cObject1            1
#define C_MTMUV_cObject2            2
#define C_MTMUV_cChrome             3
#define C_MTMUV_cScreen             4
#define C_MTMUV_cCartoon            5
#define C_MTMUV_cSolarPhong         6
 
typedef struct 
{
    float   stMat[2][2];
    float   stTrans[2];
} GLI_tdstUVTransformation;
 
typedef struct
{
    GLI_tdstTexture             *pst_Texture;
    char                        c_Operator;
    char                        c_ColorOperator;
    char                        c_UVSource;
    char                        c_Flags;
 
    GLI_tdstUVTransformation    st_UVStaticPos;
    GLI_tdstUVTransformation    st_UVDynamicPos;
 
} GLI_tdstMultiTextureMaterial;
 
#endif /*MULTI_TEXTURE*/
 
 
/*
 =======================================================================================
    Standard structure 
 =======================================================================================
 */
 
 
/*
 * Animated texture node
 */
typedef struct GLI_tdstAnimatedTextureNode_
{
    GLI_tdstTexture                     *p_stTexture;
    MTH_tdxReal                         xDisplayTime;
    struct GLI_tdstAnimatedTextureNode_ *p_stNextDisplayNode;
} GLI_tdstAnimatedTextureNode;
 
 
/*
 * Material structure
 */
typedef struct GLI_tdstMaterial_
{
    unsigned long               xMaterialType;
    GEO_tdstColor               stAmbient;
    GEO_tdstColor               stDiffuse;
    GEO_tdstColor               stSpecular;
    GEO_tdstColor               stColor;
    long                        lSpecularExponent;
    GLI_tdstTexture             *p_stTexture;
    
    /*
     * scrolling material
     */
    float                       fAddU;
    float                       fAddV;
    float                       fConstantAddU;
    float                       fConstantAddV;
    long                        lIncrementIsEnable;
 
    /*
     * for Animated textures.
     */
    unsigned long               lActualRefreshNumber;
    GLI_tdstAnimatedTextureNode *p_stFistAnimatedTExtureNode;
    GLI_tdstAnimatedTextureNode *p_stActualAnimatedTExtureNode;
    long                        lNumberOfDisplayNode;
    MTH_tdxReal                 xActualDisplayTimeSinceStartOfLastTexture;
    ACP_tdxBool                 xIsLocked;
 
#ifdef MULTI_TEXTURE
    GLI_tdstMultiTextureMaterial    a_stMultiMaterial[8];
#endif /*MULTI_TEXTURE*/
} GLI_tdstMaterial ;
 
 
#ifdef __cplusplus
};
#endif /* __cplusplus */
 
#endif /*  GLI_MATERIAL_H*/
