#ifndef GLI_UTIL_H
#define GLI_UTIL_H
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
#include <math.h>
#include "MTH.h"
 
/*typedef long GLI_tdxErr ;*/
typedef MTH_tdxReal  GLI_tdxValue ;
/*typedef float GLI_tdxReal;*/
/*typedef MTH_tdxReal GLI_tdxAngle ;*/
 
#ifndef __GEO_FMD_H
typedef float GLI_tdxUVValue ;
#endif
 
/*
 * Constant for error
 */
#define C_GLIBASE               4096
#define C_GLINOERROR            (0)
#define C_GLINOTENOUGHTMEMORY   (C_GLIBASE + 1)
 
#define GLI_M_FloatToValue(A)   MTH_M_xFloatToReal((float)A)
/*#define GLI_M_1616ToValue(A)    MTH_M_xFixed16_16ToReal(A)*/
#define GLI_M_ValueToFloat(A)   MTH_M_xRealToFloat(A)
/*#define GLI_M_ValueTo1616(A)    MTH_M_xRealToFixed16_16(A)*/
/*#define GLI_M_ValueToLong(A)    MTH_M_xRealToLong( A )*/
#define GLI_M_LongToValue(A)    MTH_M_xLongToReal( A )
#define GLI_M_Mul(A,B)          MTH_M_xMul(A, B)
#define GLI_M_Sub(A,B)          MTH_M_xSub(A, B)
#define GLI_M_Add(A,B)          MTH_M_xAdd(A, B)
#define GLI_M_Div(A,B)          MTH_M_xDiv(A, B)
#define GLI_M_Neg(A)            MTH_M_xNeg(A)
#define GLI_M_Sgn(A)            MTH_M_xSign(A)                                  
 
#define GLI_M_Inv(A)            MTH_M_xInv(A)
#define GLI_M_Abs(A)            MTH_M_xAbs(A)
#define GLI_M_Sqrt(A)           MTH_M_xSqrt(A)
 
 
/*#define GLI_M_DegToAng(A)     MTH_M_xDegToRad(A)*/
/*#define GLI_M_AngToRad(A)     (MTH_tdxReal)( ( A ) )*/
#define GLI_M_Cos(A)          MTH_M_xCos(A)     
#define GLI_M_Sin(A)          MTH_M_xSin(A)     
#define GLI_M_Tan(A)          MTH_M_xTan(A)     
#define GLI_M_Atan(A)         MTH_M_xATan(A)
#define GLI_M_Cotan(A)        MTH_M_xCoTan(A)
#define GLI_M_PI              MTH_C_Pi
#define GLI_M_2PI             MTH_C_2Pi
#define GLI_M_PIO2            MTH_C_PiBy2
#define GLI_M_PIO4            MTH_C_PiBy4
 
/*
#ifdef EXTERN_GLI
#undef EXTERN_GLI
#endif
#ifdef MAIN_GLI
#define EXTERN_GLI
#else
#define EXTERN_GLI extern
#endif
*/
 
/*EXTERN_GLI long g_b_lBackFaceOn ;*/
/*EXTERN_GLI long g_b_lSurfacesOn ;*/
 
/*#ifndef _FIRE_DEADCODE_U64_*/
/*EXTERN_GLI long g_b_lLinesOn ;*/
/*EXTERN_GLI long g_lRenderCount;*/
/*#endif /* _FIRE_DEADCODE_U64_   */
 
/*typedef struct
GLI_tdstSurfaceDescriptor_
{
        void *p_vSurfacePtr;
        long lPitch;
        long lBytesPerPixel ;
}
GLI_tdstSurfaceDescriptor;
*/
 
#ifdef __cplusplus
};
#endif /* __cplusplus */
 
#endif /* GLI_UTIL_H*/
