/*
 =======================================================================================
  Name        : DLLInter.h
 
  Author      : vincent lhullier            Date :14/09/98
 
  Description : initialize Specific driver DLL
 =======================================================================================
 */
 
#ifndef __DLLINTER_H__
#define __DLLINTER_H__
 
#include "GLD.h"
#include "PvObj_st.h"

/*
 =======================================================================================
    DLL Function prototypes  
 =======================================================================================
 */
 
/* General */
extern long    (*GLI_DRV_lSendDataToDll)(char *, void *);
 
/* DOMATxxx.C */
extern void     (* GLI_DRV_vDoOpaqueTextureSelection)( GLI_tdstInternalGlobalValuesFor3dEngine * );
extern void     (* GLI_DRV_vWrite16bBitmapToBackBuffer) ( void *,long ,long ,long ,long, long, long );
extern void     (* GLI_DRV_vAddBlackPolygon)( long , long , long , long );
extern void     (* GLI_DRV_vNoBlackPolygon)( void );
extern void     (* GLI_DRV_vComputeFogEffect)(GLI_tdstInternalGlobalValuesFor3dEngine *);
extern BOOL    (* GLI_DRV_bBeginScene)(void);
extern BOOL    (* GLI_DRV_bEndScene)(void);
    
/* ACCES_XXXX.C */
extern void     (* GLI_DRV_vSendSpriteToClip)(GLI_tdstAligned2DVector *,MTH_tdxReal ,GLI_tdstInternalGlobalValuesFor3dEngine *);
extern void     (* GLI_DRV_vSendSpriteToClipWithUV)( GLI_tdstAligned2DVector *, MTH_tdxReal *, MTH_tdxReal , GLI_tdstInternalGlobalValuesFor3dEngine *);
 
/* ACCES_ALL.C */
extern void     (* GLI_DRV_vSendSingleLineToClip)( GLD_tdstViewportAttributes *, GLI_tdstAligned3DVector *, GLI_tdstAligned2DVector *, GLI_tdstAligned3DVector *, GLI_tdstAligned2DVector *, GLI_tdstInternalGlobalValuesFor3dEngine *, long , GEO_tdstColor *);
 
 
/* HDWTex_xxx.C */
extern void    (* GLI_DRV_vDownLoadTextures)(long, long, BOOL);
extern void    (* GLI_DRV_vUnLoadTextures)(void);
extern long    (* GLI_DRV_lGetTextureSize)( GLI_tdstTexture *);
 
/* init_XXX.c */
extern void    (* GLI_DRV_vFlipDevice)(long );
extern void    (* GLI_DRV_vFlipDeviceWithSyncro)(void);
extern void    (* GLI_DRV_vClearDevice)(BOOL, BOOL , unsigned long );
extern void    (* GLI_DRV_xInitDriver) ( HWND, BOOL, long, long, long );
extern void    (* GLI_DRV_vCloseDriver) (void);
extern void    (* GLI_DRV_vClearZBufferRegion)(long ,long ,long ,long );
//extern long    (* GLI_DRV_fn_lEnumerateDisplayMode)(void);
extern long    (* GLI_DRV_fnl_EnumModes)(char *, char *);
extern HRESULT (* GLI_DRV_hChangeMode)( BOOL, long, long, long );
extern BOOL    (* GLI_DRV_bLockDevice)( void **, long *);
extern BOOL    (* GLI_DRV_bUnlockDevice)( void );
extern BOOL    (* GLI_DRV_bPrepareForGliWindowed)(HWND);
extern void    (* GLI_DRV_vPrepareForGliFullScreen)(HWND);
extern void    (* GLI_DRV_vActivateGli)(HWND, BOOL); 
extern void    (* GLI_DRV_vReadaptDisplay)(void);
 
extern BOOL    (* GLI_DRV_bWindowedModeIsOptimized)( void );
extern void    (* GLI_DRV_vOptimizedWindowedMode)( void );
extern void    (* GLI_DRV_vNonOptimizedWindowedMode)( void );
extern void    (* GLI_DRV_vSetMainWindowForRender)(HWND);
extern void    (* GLI_DRV_vRecomputeViewportToMaximizeDisplay)(int);
 
/* ClipTriangles */
extern void    (* GLI_DRV_xClearViewingList)( void );
extern void    (* GLI_DRV_xSendListToViewport)( GLD_tdstViewportAttributes * );
extern void    (* GLI_DRV_vSetZClip)(float ,GLI_tdstInternalGlobalValuesFor3dEngine *);
extern void    (* GLI_DRV_vSetClipWindow)(float ,float ,float ,float ,GLI_tdstInternalGlobalValuesFor3dEngine *);
extern void    (* GLI_DRV_xSendElementTIToClip_TRIANGLES)( GEO_tdstElementIndexedTriangles *, GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobaleMT);
extern void    (* GLI_DRV_xSendSingleTriangleToClip_TRIANGLES)( GLI_tdstAligned2DVector *a3_st2DVertex, ACP_tdst2DUVValues *a3_stUV, GLI_tdstInternalGlobalValuesFor3dEngine *p_stGlobaleMT);
 
/* misc request (see request type n dllcaps.h file) */
extern long    (* GLI_DRV_lRequest)( long, long, long );
 
extern void GLI_fn_vDrawMirror(BOOL);
#ifndef RETAIL
 
extern void (*GLI_DRV_vGetStats)(unsigned long *, unsigned long *);
 
#else
 
#define GLI_DRV_vGetStats( a, b)
 
#endif
extern void (*GLI_DRV_vWaitRetrace)(void);



/*
 =======================================================================================
    Structures 
 =======================================================================================
 */
typedef struct GLI_tdst_DllInfos_
{
    HINSTANCE       h_Module;
    char            sz_Name[64];
    char            sz_Desc[256];
    char            sz_Version[16];
    unsigned long   ul_Code;
    char            sz_FileName[ _MAX_PATH ];
    char            sz_DriverName[ 32 ];
    char            sz_DeviceName[ 32 ];
    long            l_InitWidth;
    long            l_InitHeight;
    long            l_InitFullScreen;
    long            l_InitBpp;

	long			l_RealWidth;
	long			l_RealHeight;

	float			f_WidthRatio;
	float			f_HeightRatio;
} GLI_tdst_DllInfos;

/*
 =======================================================================================
    globals
 =======================================================================================
 */

extern  GLI_tdst_DllInfos   GLI_gst_DllInfo;

/*
 =======================================================================================
    Functions  
 =======================================================================================
 */
long GLI_fnl_InitDll( void );
long GLI_fn_lCloseGliDriver( void );

void GLI_fnv_SetDllFileName( char *_sz_Name );
void GLI_fnv_SetDllName( char *_sz_Name );
void GLI_fnv_SetDriverName( char *_sz_Name );
void GLI_fnv_SetDeviceName( char *_sz_Name );
void GLI_fnv_SetMode( long _l_FullScreen, long _l_Width, long _l_Height, long _l_Bpp );
void GLI_fnv_SetModeByString( char *_sz_Line );

 
 
#endif /* __DLLINTER_H__ */
