00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __TR_PUBLIC_H
00023 #define __TR_PUBLIC_H
00024
00025 #include "../cgame/tr_types.h"
00026
00027 #define REF_API_VERSION 8
00028
00029
00030
00031
00032 typedef struct {
00033
00034
00035
00036 void (*Shutdown)( qboolean destroyWindow );
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 void (*BeginRegistration)( glconfig_t *config );
00048 qhandle_t (*RegisterModel)( const char *name );
00049 qhandle_t (*RegisterSkin)( const char *name );
00050 qhandle_t (*RegisterShader)( const char *name );
00051 qhandle_t (*RegisterShaderNoMip)( const char *name );
00052 void (*LoadWorld)( const char *name );
00053
00054
00055
00056 void (*SetWorldVisData)( const byte *vis );
00057
00058
00059
00060 void (*EndRegistration)( void );
00061
00062
00063
00064 void (*ClearScene)( void );
00065 void (*AddRefEntityToScene)( const refEntity_t *re );
00066 void (*AddPolyToScene)( qhandle_t hShader , int numVerts, const polyVert_t *verts, int num );
00067 int (*LightForPoint)( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir );
00068 void (*AddLightToScene)( const vec3_t org, float intensity, float r, float g, float b );
00069 void (*AddAdditiveLightToScene)( const vec3_t org, float intensity, float r, float g, float b );
00070 void (*RenderScene)( const refdef_t *fd );
00071
00072 void (*SetColor)( const float *rgba );
00073 void (*DrawStretchPic) ( float x, float y, float w, float h,
00074 float s1, float t1, float s2, float t2, qhandle_t hShader );
00075
00076
00077 void (*DrawStretchRaw) (int x, int y, int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty);
00078 void (*UploadCinematic) (int w, int h, int cols, int rows, const byte *data, int client, qboolean dirty);
00079
00080 void (*BeginFrame)( stereoFrame_t stereoFrame );
00081
00082
00083 void (*EndFrame)( int *frontEndMsec, int *backEndMsec );
00084
00085
00086 int (*MarkFragments)( int numPoints, const vec3_t *points, const vec3_t projection,
00087 int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t *fragmentBuffer );
00088
00089 int (*LerpTag)( orientation_t *tag, qhandle_t model, int startFrame, int endFrame,
00090 float frac, const char *tagName );
00091 void (*ModelBounds)( qhandle_t model, vec3_t mins, vec3_t maxs );
00092
00093 #ifdef __USEA3D
00094 void (*A3D_RenderGeometry) (void *pVoidA3D, void *pVoidGeom, void *pVoidMat, void *pVoidGeomStatus);
00095 #endif
00096 void (*RegisterFont)(const char *fontName, int pointSize, fontInfo_t *font);
00097 void (*RemapShader)(const char *oldShader, const char *newShader, const char *offsetTime);
00098 qboolean (*GetEntityToken)( char *buffer, int size );
00099 qboolean (*inPVS)( const vec3_t p1, const vec3_t p2 );
00100 } refexport_t;
00101
00102
00103
00104
00105 typedef struct {
00106
00107 void (QDECL *Printf)( int printLevel, const char *fmt, ...);
00108
00109
00110 void (QDECL *Error)( int errorLevel, const char *fmt, ...);
00111
00112
00113
00114 int (*Milliseconds)( void );
00115
00116
00117
00118 #ifdef HUNK_DEBUG
00119 void *(*Hunk_AllocDebug)( int size, ha_pref pref, char *label, char *file, int line );
00120 #else
00121 void *(*Hunk_Alloc)( int size, ha_pref pref );
00122 #endif
00123 void *(*Hunk_AllocateTempMemory)( int size );
00124 void (*Hunk_FreeTempMemory)( void *block );
00125
00126
00127 void *(*Malloc)( int bytes );
00128 void (*Free)( void *buf );
00129
00130 cvar_t *(*Cvar_Get)( const char *name, const char *value, int flags );
00131 void (*Cvar_Set)( const char *name, const char *value );
00132
00133 void (*Cmd_AddCommand)( const char *name, void(*cmd)(void) );
00134 void (*Cmd_RemoveCommand)( const char *name );
00135
00136 int (*Cmd_Argc) (void);
00137 char *(*Cmd_Argv) (int i);
00138
00139 void (*Cmd_ExecuteText) (int exec_when, const char *text);
00140
00141
00142 void (*CM_DrawDebugSurface)( void (*drawPoly)(int color, int numPoints, float *points) );
00143
00144
00145
00146 int (*FS_FileIsInPAK)( const char *name, int *pCheckSum );
00147 int (*FS_ReadFile)( const char *name, void **buf );
00148 void (*FS_FreeFile)( void *buf );
00149 char ** (*FS_ListFiles)( const char *name, const char *extension, int *numfilesfound );
00150 void (*FS_FreeFileList)( char **filelist );
00151 void (*FS_WriteFile)( const char *qpath, const void *buffer, int size );
00152 qboolean (*FS_FileExists)( const char *file );
00153
00154
00155 void (*CIN_UploadCinematic)(int handle);
00156 int (*CIN_PlayCinematic)( const char *arg0, int xpos, int ypos, int width, int height, int bits);
00157 e_status (*CIN_RunCinematic) (int handle);
00158
00159 } refimport_t;
00160
00161
00162
00163
00164
00165 refexport_t*GetRefAPI( int apiVersion, refimport_t *rimp );
00166
00167 #endif // __TR_PUBLIC_H