Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

tr_public.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
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 // these are the functions exported by the refresh module
00031 //
00032 typedef struct {
00033     // called before the library is unloaded
00034     // if the system is just reconfiguring, pass destroyWindow = qfalse,
00035     // which will keep the screen from flashing to the desktop.
00036     void    (*Shutdown)( qboolean destroyWindow );
00037 
00038     // All data that will be used in a level should be
00039     // registered before rendering any frames to prevent disk hits,
00040     // but they can still be registered at a later time
00041     // if necessary.
00042     //
00043     // BeginRegistration makes any existing media pointers invalid
00044     // and returns the current gl configuration, including screen width
00045     // and height, which can be used by the client to intelligently
00046     // size display elements
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     // the vis data is a large enough block of data that we go to the trouble
00055     // of sharing it with the clipmodel subsystem
00056     void    (*SetWorldVisData)( const byte *vis );
00057 
00058     // EndRegistration will draw a tiny polygon with each texture, forcing
00059     // them to be loaded into card memory
00060     void    (*EndRegistration)( void );
00061 
00062     // a scene is built up by calls to R_ClearScene and the various R_Add functions.
00063     // Nothing is drawn until R_RenderScene is called.
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 );   // NULL = 1,1,1,1
00073     void    (*DrawStretchPic) ( float x, float y, float w, float h, 
00074         float s1, float t1, float s2, float t2, qhandle_t hShader );    // 0 = white
00075 
00076     // Draw images for cinematic rendering, pass as 32 bit rgba
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     // if the pointers are not NULL, timing info will be returned
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 // these are the functions imported by the refresh module
00104 //
00105 typedef struct {
00106     // print message on the local console
00107     void    (QDECL *Printf)( int printLevel, const char *fmt, ...);
00108 
00109     // abort the game
00110     void    (QDECL *Error)( int errorLevel, const char *fmt, ...);
00111 
00112     // milliseconds should only be used for profiling, never
00113     // for anything game related.  Get time from the refdef
00114     int     (*Milliseconds)( void );
00115 
00116     // stack based memory allocation for per-level things that
00117     // won't be freed
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     // dynamic memory allocator for things that need to be freed
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     // visualization for debugging collision detection
00142     void    (*CM_DrawDebugSurface)( void (*drawPoly)(int color, int numPoints, float *points) );
00143 
00144     // a -1 return means the file does not exist
00145     // NULL can be passed for buf to just determine existance
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     // cinematic stuff
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 // this is the only function actually exported at the linker level
00163 // If the module can't init to a valid rendering state, NULL will be
00164 // returned.
00165 refexport_t*GetRefAPI( int apiVersion, refimport_t *rimp );
00166 
00167 #endif  // __TR_PUBLIC_H

Generated on Thu Aug 25 12:37:53 2005 for Quake III Arena by  doxygen 1.3.9.1