mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-25 22:34:24 +00:00
ref:Fix some clgame, world and renderapi usages, import renderapi funcs from engine
This commit is contained in:
parent
574f03c139
commit
437ba6d7a2
@ -26,7 +26,6 @@ GNU General Public License for more details.
|
|||||||
#include "com_model.h"
|
#include "com_model.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
#include "r_efx.h"
|
#include "r_efx.h"
|
||||||
#include "cvar.h"
|
|
||||||
|
|
||||||
#define REF_API_VERSION 1
|
#define REF_API_VERSION 1
|
||||||
|
|
||||||
@ -59,6 +58,12 @@ GNU General Public License for more details.
|
|||||||
#define FWORLD_WATERALPHA BIT( 2 )
|
#define FWORLD_WATERALPHA BIT( 2 )
|
||||||
#define FWORLD_HAS_DELUXEMAP BIT( 3 )
|
#define FWORLD_HAS_DELUXEMAP BIT( 3 )
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
msurface_t *surf;
|
||||||
|
int cull;
|
||||||
|
} sortedface_t;
|
||||||
|
|
||||||
typedef struct ref_globals_s
|
typedef struct ref_globals_s
|
||||||
{
|
{
|
||||||
qboolean developer;
|
qboolean developer;
|
||||||
@ -80,6 +85,14 @@ typedef struct ref_globals_s
|
|||||||
model_t *currentmodel;
|
model_t *currentmodel;
|
||||||
|
|
||||||
float fov_x, fov_y;
|
float fov_x, fov_y;
|
||||||
|
|
||||||
|
// todo: fill this without engine help
|
||||||
|
// move to local
|
||||||
|
|
||||||
|
// translucent sorted array
|
||||||
|
sortedface_t *draw_surfaces; // used for sorting translucent surfaces
|
||||||
|
int max_surfaces; // max surfaces per submodel (for all models)
|
||||||
|
size_t visbytes; // cluster size
|
||||||
} ref_globals_t;
|
} ref_globals_t;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -118,8 +131,8 @@ typedef struct ref_api_s
|
|||||||
int (*GetViewEntIndex)( void ); // cl.viewentity
|
int (*GetViewEntIndex)( void ); // cl.viewentity
|
||||||
|
|
||||||
// cvar handlers
|
// cvar handlers
|
||||||
convar_t *(*pfnRegisterVariable)( const char *szName, const char *szValue, int flags, const char *description );
|
cvar_t *(*pfnRegisterVariable)( const char *szName, const char *szValue, int flags, const char *description );
|
||||||
convar_t *(*pfnGetCvarPointer)( const char *name );
|
cvar_t *(*pfnGetCvarPointer)( const char *name );
|
||||||
float (*pfnGetCvarFloat)( const char *szName );
|
float (*pfnGetCvarFloat)( const char *szName );
|
||||||
const char *(*pfnGetCvarString)( const char *szName );
|
const char *(*pfnGetCvarString)( const char *szName );
|
||||||
|
|
||||||
@ -208,6 +221,39 @@ typedef struct ref_api_s
|
|||||||
void (*GL_DestroyContext)( );
|
void (*GL_DestroyContext)( );
|
||||||
void *(*GL_GetProcAddress)( const char *name );
|
void *(*GL_GetProcAddress)( const char *name );
|
||||||
|
|
||||||
|
// renderapi
|
||||||
|
lightstyle_t* (*GetLightStyle)( int number );
|
||||||
|
dlight_t* (*GetDynamicLight)( int number );
|
||||||
|
dlight_t* (*GetEntityLight)( int number );
|
||||||
|
byte (*LightToTexGamma)( byte color ); // software gamma support
|
||||||
|
int (*R_FatPVS)( const float *org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
|
||||||
|
void *(*AVI_LoadVideo)( const char *filename, qboolean load_audio );
|
||||||
|
int (*AVI_GetVideoInfo)( void *Avi, long *xres, long *yres, float *duration );
|
||||||
|
long (*AVI_GetVideoFrameNumber)( void *Avi, float time );
|
||||||
|
byte *(*AVI_GetVideoFrame)( void *Avi, long frame );
|
||||||
|
void (*AVI_FreeVideo)( void *Avi );
|
||||||
|
int (*AVI_IsActive)( void *Avi );
|
||||||
|
void (*AVI_StreamSound)( void *Avi, int entnum, float fvol, float attn, float synctime );
|
||||||
|
int (*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load
|
||||||
|
const struct ref_overview_s *( *GetOverviewParms )( void );
|
||||||
|
const char *( *GetFileByIndex )( int fileindex );
|
||||||
|
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
||||||
|
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||||
|
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );
|
||||||
|
unsigned int (*pfnFileBufferCRC32)( const void *buffer, const int length );
|
||||||
|
int (*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare );
|
||||||
|
void* ( *pfnGetModel )( int modelindex );
|
||||||
|
float (*pfnTime)( void ); // Sys_DoubleTime
|
||||||
|
void (*Cvar_Set)( const char *name, const char *value );
|
||||||
|
void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents)
|
||||||
|
void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
|
||||||
|
|
||||||
|
// client exports
|
||||||
|
void (*pfnDrawNormalTriangles)( void );
|
||||||
|
void (*pfnDrawTransparentTriangles)( void );
|
||||||
|
int (*pfnGetRenderInterface)( int version, render_api_t *renderfuncs, render_interface_t *callback );
|
||||||
|
int (*CL_GetRenderParm)( int parm, int arg ); // generic
|
||||||
|
|
||||||
} ref_api_t;
|
} ref_api_t;
|
||||||
|
|
||||||
struct mip_s;
|
struct mip_s;
|
||||||
|
@ -61,6 +61,37 @@ static void R_UnloadProgs( void )
|
|||||||
Cmd_Unlink( CMD_REFDLL );
|
Cmd_Unlink( CMD_REFDLL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int CL_RenderGetParm( int parm, int arg )
|
||||||
|
{
|
||||||
|
switch( parm )
|
||||||
|
{
|
||||||
|
case PARM_BSP2_SUPPORTED:
|
||||||
|
#ifdef SUPPORT_BSP2_FORMAT
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
case PARM_SKY_SPHERE:
|
||||||
|
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
|
||||||
|
case PARAM_GAMEPAUSED:
|
||||||
|
return cl.paused;
|
||||||
|
case PARM_CLIENT_INGAME:
|
||||||
|
return CL_IsInGame();
|
||||||
|
case PARM_MAX_ENTITIES:
|
||||||
|
return clgame.maxEntities;
|
||||||
|
case PARM_FEATURES:
|
||||||
|
return host.features;
|
||||||
|
case PARM_MAP_HAS_DELUXE:
|
||||||
|
return FBitSet( world.flags, FWORLD_HAS_DELUXEMAP );
|
||||||
|
case PARM_CLIENT_ACTIVE:
|
||||||
|
return (cls.state == ca_active);
|
||||||
|
case PARM_DEDICATED_SERVER:
|
||||||
|
return (host.type == HOST_DEDICATED);
|
||||||
|
case PARM_WATER_ALPHA:
|
||||||
|
return FBitSet( world.flags, FWORLD_WATERALPHA );
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void CL_FillTriAPIFromRef( triangleapi_t *dst, const ref_interface_t *src )
|
static void CL_FillTriAPIFromRef( triangleapi_t *dst, const ref_interface_t *src )
|
||||||
{
|
{
|
||||||
dst->version = TRI_API_VERSION;
|
dst->version = TRI_API_VERSION;
|
||||||
|
@ -23,7 +23,7 @@ GNU General Public License for more details.
|
|||||||
#include "enginefeatures.h"
|
#include "enginefeatures.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "server.h" // LUMP_ error codes
|
#include "server.h" // LUMP_ error codes
|
||||||
|
#include "ref_common.h"
|
||||||
typedef struct wadlist_s
|
typedef struct wadlist_s
|
||||||
{
|
{
|
||||||
char wadnames[MAX_MAP_WADS][32];
|
char wadnames[MAX_MAP_WADS][32];
|
||||||
@ -1472,8 +1472,8 @@ static void Mod_LoadSubmodels( dbspmodel_t *bmod )
|
|||||||
in = bmod->submodels;
|
in = bmod->submodels;
|
||||||
|
|
||||||
if( bmod->isworld )
|
if( bmod->isworld )
|
||||||
world.max_surfaces = 0;
|
refState.max_surfaces = 0;
|
||||||
oldmaxfaces = world.max_surfaces;
|
oldmaxfaces = refState.max_surfaces;
|
||||||
|
|
||||||
for( i = 0; i < bmod->numsubmodels; i++, in++, out++ )
|
for( i = 0; i < bmod->numsubmodels; i++, in++, out++ )
|
||||||
{
|
{
|
||||||
@ -1504,10 +1504,10 @@ static void Mod_LoadSubmodels( dbspmodel_t *bmod )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// these array used to sort translucent faces in bmodels
|
// these array used to sort translucent faces in bmodels
|
||||||
if( oldmaxfaces > world.max_surfaces )
|
if( oldmaxfaces > refState.max_surfaces )
|
||||||
{
|
{
|
||||||
world.draw_surfaces = (sortedface_t *)Z_Realloc( world.draw_surfaces, oldmaxfaces * sizeof( sortedface_t ));
|
refState.draw_surfaces = (sortedface_t *)Z_Realloc( refState.draw_surfaces, oldmaxfaces * sizeof( sortedface_t ));
|
||||||
world.max_surfaces = oldmaxfaces;
|
refState.max_surfaces = oldmaxfaces;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2352,6 +2352,7 @@ static void Mod_LoadLeafs( dbspmodel_t *bmod )
|
|||||||
visclusters = loadmodel->submodels[0].visleafs;
|
visclusters = loadmodel->submodels[0].visleafs;
|
||||||
world.visbytes = (visclusters + 7) >> 3;
|
world.visbytes = (visclusters + 7) >> 3;
|
||||||
world.fatbytes = (visclusters + 31) >> 3;
|
world.fatbytes = (visclusters + 31) >> 3;
|
||||||
|
refState.visbytes = world.visbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < bmod->numleafs; i++, out++ )
|
for( i = 0; i < bmod->numleafs; i++, out++ )
|
||||||
|
@ -82,11 +82,6 @@ typedef struct
|
|||||||
uint num_polys;
|
uint num_polys;
|
||||||
} hull_model_t;
|
} hull_model_t;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
msurface_t *surf;
|
|
||||||
int cull;
|
|
||||||
} sortedface_t;
|
|
||||||
|
|
||||||
typedef struct world_static_s
|
typedef struct world_static_s
|
||||||
{
|
{
|
||||||
@ -98,10 +93,6 @@ typedef struct world_static_s
|
|||||||
char compiler[256]; // map compiler
|
char compiler[256]; // map compiler
|
||||||
char generator[256]; // map editor
|
char generator[256]; // map editor
|
||||||
|
|
||||||
// translucent sorted array
|
|
||||||
sortedface_t *draw_surfaces; // used for sorting translucent surfaces
|
|
||||||
int max_surfaces; // max surfaces per submodel (for all models)
|
|
||||||
|
|
||||||
hull_model_t *hull_models;
|
hull_model_t *hull_models;
|
||||||
int num_hull_models;
|
int num_hull_models;
|
||||||
|
|
||||||
|
@ -27,9 +27,9 @@ R_SpeedsMessage
|
|||||||
*/
|
*/
|
||||||
qboolean R_SpeedsMessage( char *out, size_t size )
|
qboolean R_SpeedsMessage( char *out, size_t size )
|
||||||
{
|
{
|
||||||
if( clgame.drawFuncs.R_SpeedsMessage != NULL )
|
if( gRenderIface.R_SpeedsMessage != NULL )
|
||||||
{
|
{
|
||||||
if( clgame.drawFuncs.R_SpeedsMessage( out, size ))
|
if( gRenderIface.R_SpeedsMessage( out, size ))
|
||||||
return true;
|
return true;
|
||||||
// otherwise pass to default handler
|
// otherwise pass to default handler
|
||||||
}
|
}
|
||||||
@ -461,7 +461,7 @@ Create overview script file
|
|||||||
*/
|
*/
|
||||||
void VID_WriteOverviewScript( void )
|
void VID_WriteOverviewScript( void )
|
||||||
{
|
{
|
||||||
ref_overview_t *ov = &clgame.overView;
|
ref_overview_t *ov = &gEngfuncs.GetOverviewParms();
|
||||||
string filename;
|
string filename;
|
||||||
file_t *f;
|
file_t *f;
|
||||||
|
|
||||||
@ -491,8 +491,8 @@ qboolean VID_ScreenShot( const char *filename, int shot_type )
|
|||||||
qboolean result;
|
qboolean result;
|
||||||
|
|
||||||
r_shot = Mem_Calloc( r_temppool, sizeof( rgbdata_t ));
|
r_shot = Mem_Calloc( r_temppool, sizeof( rgbdata_t ));
|
||||||
r_shot->width = (glState.width + 3) & ~3;
|
r_shot->width = (gpGlobals->width + 3) & ~3;
|
||||||
r_shot->height = (glState.height + 3) & ~3;
|
r_shot->height = (gpGlobals->height + 3) & ~3;
|
||||||
r_shot->flags = IMAGE_HAS_COLOR;
|
r_shot->flags = IMAGE_HAS_COLOR;
|
||||||
r_shot->type = PF_RGB_24;
|
r_shot->type = PF_RGB_24;
|
||||||
r_shot->size = r_shot->width * r_shot->height * PFDesc[r_shot->type].bpp;
|
r_shot->size = r_shot->width * r_shot->height * PFDesc[r_shot->type].bpp;
|
||||||
@ -566,7 +566,7 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
|
|||||||
while( i < size ) i<<=1;
|
while( i < size ) i<<=1;
|
||||||
|
|
||||||
if( i != size ) return false;
|
if( i != size ) return false;
|
||||||
if( size > glState.width || size > glState.height )
|
if( size > gpGlobals->width || size > gpGlobals->height )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// setup refdef
|
// setup refdef
|
||||||
@ -675,8 +675,8 @@ rebuild_page:
|
|||||||
end = total * gl_showtextures->value;
|
end = total * gl_showtextures->value;
|
||||||
if( end > MAX_TEXTURES ) end = MAX_TEXTURES;
|
if( end > MAX_TEXTURES ) end = MAX_TEXTURES;
|
||||||
|
|
||||||
w = glState.width / base_w;
|
w = gpGlobals->width / base_w;
|
||||||
h = glState.height / base_h;
|
h = gpGlobals->height / base_h;
|
||||||
|
|
||||||
Con_DrawStringLen( NULL, NULL, &charHeight );
|
Con_DrawStringLen( NULL, NULL, &charHeight );
|
||||||
|
|
||||||
@ -815,7 +815,7 @@ void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes )
|
|||||||
|
|
||||||
void R_ShowTree( void )
|
void R_ShowTree( void )
|
||||||
{
|
{
|
||||||
float x = (float)((glState.width - (int)POINT_SIZE) >> 1);
|
float x = (float)((gpGlobals->width - (int)POINT_SIZE) >> 1);
|
||||||
float y = NODE_INTERVAL_Y(1.0);
|
float y = NODE_INTERVAL_Y(1.0);
|
||||||
|
|
||||||
if( !WORLDMODEL || !CVAR_TO_BOOL( r_showtree ))
|
if( !WORLDMODEL || !CVAR_TO_BOOL( r_showtree ))
|
||||||
|
@ -13,7 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "r_efx.h"
|
#include "r_efx.h"
|
||||||
#include "event_flags.h"
|
#include "event_flags.h"
|
||||||
@ -165,7 +164,7 @@ void CL_AddCustomBeam( cl_entity_t *pEnvBeam )
|
|||||||
{
|
{
|
||||||
if( tr.draw_list->num_beam_entities >= MAX_VISIBLE_PACKET )
|
if( tr.draw_list->num_beam_entities >= MAX_VISIBLE_PACKET )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "Too many beams %d!\n", tr.draw_list->num_beam_entities );
|
gEngfuncs.Con_Printf( S_ERROR "Too many beams %d!\n", tr.draw_list->num_beam_entities );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -865,7 +864,7 @@ static qboolean R_BeamComputePoint( int beamEnt, vec3_t pt )
|
|||||||
|
|
||||||
if( !ent )
|
if( !ent )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "R_BeamComputePoint: invalid entity %i\n", BEAMENT_ENTITY( beamEnt ));
|
gEngfuncs.Con_DPrintf( S_ERROR "R_BeamComputePoint: invalid entity %i\n", BEAMENT_ENTITY( beamEnt ));
|
||||||
VectorClear( pt );
|
VectorClear( pt );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "gl_export.h"
|
#include "gl_export.h"
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "mod_local.h"
|
|
||||||
|
|
||||||
#define list_entry( ptr, type, member ) \
|
#define list_entry( ptr, type, member ) \
|
||||||
((type *)((char *)(ptr) - (size_t)(&((type *)0)->member)))
|
((type *)((char *)(ptr) - (size_t)(&((type *)0)->member)))
|
||||||
|
@ -1193,9 +1193,9 @@ int R_CreateDecalList( decallist_t *pList )
|
|||||||
total = DecalListAdd( pList, total );
|
total = DecalListAdd( pList, total );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( clgame.drawFuncs.R_CreateStudioDecalList )
|
if( gRenderIface.R_CreateStudioDecalList )
|
||||||
{
|
{
|
||||||
total += clgame.drawFuncs.R_CreateStudioDecalList( pList, total );
|
total += gRenderIface.R_CreateStudioDecalList( pList, total );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1277,8 +1277,8 @@ void R_ClearAllDecals( void )
|
|||||||
R_DecalUnlink( pdecal );
|
R_DecalUnlink( pdecal );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( clgame.drawFuncs.R_ClearStudioDecals )
|
if( gRenderIface.R_ClearStudioDecals )
|
||||||
{
|
{
|
||||||
clgame.drawFuncs.R_ClearStudioDecals();
|
gRenderIface.R_ClearStudioDecals();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,10 +246,10 @@ void R_Set2DMode( qboolean enable )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// set 2D virtual screen size
|
// set 2D virtual screen size
|
||||||
pglViewport( 0, 0, glState.width, glState.height );
|
pglViewport( 0, 0, gpGlobals->width, gpGlobals->height );
|
||||||
pglMatrixMode( GL_PROJECTION );
|
pglMatrixMode( GL_PROJECTION );
|
||||||
pglLoadIdentity();
|
pglLoadIdentity();
|
||||||
pglOrtho( 0, glState.width, glState.height, 0, -99999, 99999 );
|
pglOrtho( 0, gpGlobals->width, gpGlobals->height, 0, -99999, 99999 );
|
||||||
pglMatrixMode( GL_MODELVIEW );
|
pglMatrixMode( GL_MODELVIEW );
|
||||||
pglLoadIdentity();
|
pglLoadIdentity();
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
|
|
||||||
#define TEXTURES_HASH_SIZE (MAX_TEXTURES >> 2)
|
#define TEXTURES_HASH_SIZE (MAX_TEXTURES >> 2)
|
||||||
|
@ -32,7 +32,9 @@ GNU General Public License for more details.
|
|||||||
#include "enginefeatures.h"
|
#include "enginefeatures.h"
|
||||||
#include "com_strings.h"
|
#include "com_strings.h"
|
||||||
#include "pm_movevars.h"
|
#include "pm_movevars.h"
|
||||||
|
#define offsetof(s,m) (size_t)&(((s *)0)->m)
|
||||||
|
|
||||||
|
typedef cvar_t convar_t;
|
||||||
void CL_DrawEFX(double, double);
|
void CL_DrawEFX(double, double);
|
||||||
void *CL_ModelHandle(int);
|
void *CL_ModelHandle(int);
|
||||||
void *GL_GetProcAddress(char *);
|
void *GL_GetProcAddress(char *);
|
||||||
@ -46,6 +48,11 @@ extern convar_t cvstub;
|
|||||||
#define Cmd_RemoveCommand(...)
|
#define Cmd_RemoveCommand(...)
|
||||||
#define FS_FreeImage(...)
|
#define FS_FreeImage(...)
|
||||||
#define Host_Error(...)
|
#define Host_Error(...)
|
||||||
|
#define ASSERT(x)
|
||||||
|
#define Assert(x)
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#define Con_Reportf gEngfuncs.Con_DPrintf
|
||||||
|
|
||||||
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) convar_t cv = { cvname, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
|
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) convar_t cv = { cvname, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
|
||||||
#define CVAR_DEFINE_AUTO( cv, cvstr, cvflags, cvdesc ) convar_t cv = { #cv, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
|
#define CVAR_DEFINE_AUTO( cv, cvstr, cvflags, cvdesc ) convar_t cv = { #cv, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
|
||||||
@ -54,6 +61,10 @@ extern convar_t cvstub;
|
|||||||
#define WORLD (gEngfuncs.GetWorld())
|
#define WORLD (gEngfuncs.GetWorld())
|
||||||
#define WORLDMODEL (gEngfuncs.pfnGetModelByIndex( 1 ))
|
#define WORLDMODEL (gEngfuncs.pfnGetModelByIndex( 1 ))
|
||||||
#define MOVEVARS (gEngfuncs.pfnGetMoveVars())
|
#define MOVEVARS (gEngfuncs.pfnGetMoveVars())
|
||||||
|
extern render_interface_t gRenderIface;
|
||||||
|
|
||||||
|
// make mod_ref.h?
|
||||||
|
#define LM_SAMPLE_SIZE 16
|
||||||
|
|
||||||
|
|
||||||
extern byte *r_temppool;
|
extern byte *r_temppool;
|
||||||
@ -245,6 +256,8 @@ typedef struct
|
|||||||
|
|
||||||
// cull info
|
// cull info
|
||||||
vec3_t modelorg; // relative to viewpoint
|
vec3_t modelorg; // relative to viewpoint
|
||||||
|
|
||||||
|
qboolean fCustomSkybox;
|
||||||
} gl_globals_t;
|
} gl_globals_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -14,7 +14,6 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "mod_local.h"
|
|
||||||
#include "entity_types.h"
|
#include "entity_types.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ R_SetupFrustum
|
|||||||
*/
|
*/
|
||||||
void R_SetupFrustum( void )
|
void R_SetupFrustum( void )
|
||||||
{
|
{
|
||||||
ref_overview_t *ov = &clgame.overView;
|
ref_overview_t *ov = gEngfuncs.GetOverviewParms();
|
||||||
|
|
||||||
if( RP_NORMALPASS() && ( cl.local.waterlevel >= 3 ))
|
if( RP_NORMALPASS() && ( cl.local.waterlevel >= 3 ))
|
||||||
{
|
{
|
||||||
@ -362,7 +362,7 @@ static void R_SetupProjectionMatrix( matrix4x4 m )
|
|||||||
|
|
||||||
if( RI.drawOrtho )
|
if( RI.drawOrtho )
|
||||||
{
|
{
|
||||||
ref_overview_t *ov = &clgame.overView;
|
ref_overview_t *ov = gEngfuncs.GetOverviewParms();
|
||||||
Matrix4x4_CreateOrtho( m, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar );
|
Matrix4x4_CreateOrtho( m, ov->xLeft, ov->xRight, ov->yTop, ov->yBottom, ov->zNear, ov->zFar );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -518,10 +518,10 @@ void R_SetupGL( qboolean set_gl_state )
|
|||||||
int x, x2, y, y2;
|
int x, x2, y, y2;
|
||||||
|
|
||||||
// set up viewport (main, playersetup)
|
// set up viewport (main, playersetup)
|
||||||
x = floor( RI.viewport[0] * glState.width / glState.width );
|
x = floor( RI.viewport[0] * gpGlobals->width / gpGlobals->width );
|
||||||
x2 = ceil(( RI.viewport[0] + RI.viewport[2] ) * glState.width / glState.width );
|
x2 = ceil(( RI.viewport[0] + RI.viewport[2] ) * gpGlobals->width / gpGlobals->width );
|
||||||
y = floor( glState.height - RI.viewport[1] * glState.height / glState.height );
|
y = floor( gpGlobals->height - RI.viewport[1] * gpGlobals->height / gpGlobals->height );
|
||||||
y2 = ceil( glState.height - ( RI.viewport[1] + RI.viewport[3] ) * glState.height / glState.height );
|
y2 = ceil( gpGlobals->height - ( RI.viewport[1] + RI.viewport[3] ) * gpGlobals->height / gpGlobals->height );
|
||||||
|
|
||||||
pglViewport( x, y2, x2 - x, y - y2 );
|
pglViewport( x, y2, x2 - x, y - y2 );
|
||||||
}
|
}
|
||||||
@ -858,7 +858,7 @@ void R_DrawEntitiesOnList( void )
|
|||||||
GL_CheckForErrors();
|
GL_CheckForErrors();
|
||||||
|
|
||||||
if( RI.drawWorld )
|
if( RI.drawWorld )
|
||||||
clgame.dllFuncs.pfnDrawNormalTriangles();
|
gEngfuncs.pfnDrawNormalTriangles();
|
||||||
|
|
||||||
GL_CheckForErrors();
|
GL_CheckForErrors();
|
||||||
|
|
||||||
@ -902,7 +902,7 @@ void R_DrawEntitiesOnList( void )
|
|||||||
if( RI.drawWorld )
|
if( RI.drawWorld )
|
||||||
{
|
{
|
||||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||||
clgame.dllFuncs.pfnDrawTransparentTriangles ();
|
gEngfuncs.pfnDrawTransparentTriangles ();
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_CheckForErrors();
|
GL_CheckForErrors();
|
||||||
@ -1109,11 +1109,11 @@ void R_RenderFrame( const ref_viewpass_t *rvp )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// completely override rendering
|
// completely override rendering
|
||||||
if( clgame.drawFuncs.GL_RenderFrame != NULL )
|
if( gRenderIface.GL_RenderFrame != NULL )
|
||||||
{
|
{
|
||||||
tr.fCustomRendering = true;
|
tr.fCustomRendering = true;
|
||||||
|
|
||||||
if( clgame.drawFuncs.GL_RenderFrame( rvp ))
|
if( gRenderIface.GL_RenderFrame( rvp ))
|
||||||
{
|
{
|
||||||
R_GatherPlayerLight();
|
R_GatherPlayerLight();
|
||||||
tr.realframecount++;
|
tr.realframecount++;
|
||||||
@ -1204,11 +1204,6 @@ static int GL_RenderGetParm( int parm, int arg )
|
|||||||
case PARM_TEX_DEPTH:
|
case PARM_TEX_DEPTH:
|
||||||
glt = R_GetTexture( arg );
|
glt = R_GetTexture( arg );
|
||||||
return glt->depth;
|
return glt->depth;
|
||||||
case PARM_BSP2_SUPPORTED:
|
|
||||||
#ifdef SUPPORT_BSP2_FORMAT
|
|
||||||
return 1;
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
case PARM_TEX_SKYBOX:
|
case PARM_TEX_SKYBOX:
|
||||||
Assert( arg >= 0 && arg < 6 );
|
Assert( arg >= 0 && arg < 6 );
|
||||||
return tr.skyboxTextures[arg];
|
return tr.skyboxTextures[arg];
|
||||||
@ -1217,22 +1212,14 @@ static int GL_RenderGetParm( int parm, int arg )
|
|||||||
case PARM_TEX_LIGHTMAP:
|
case PARM_TEX_LIGHTMAP:
|
||||||
arg = bound( 0, arg, MAX_LIGHTMAPS - 1 );
|
arg = bound( 0, arg, MAX_LIGHTMAPS - 1 );
|
||||||
return tr.lightmapTextures[arg];
|
return tr.lightmapTextures[arg];
|
||||||
case PARM_SKY_SPHERE:
|
|
||||||
return FBitSet( WORLDMODEL->flags, FWORLD_SKYSPHERE ) && !FBitSet( WORLDMODEL->flags, FWORLD_CUSTOM_SKYBOX );
|
|
||||||
case PARAM_GAMEPAUSED:
|
|
||||||
return cl.paused;
|
|
||||||
case PARM_WIDESCREEN:
|
case PARM_WIDESCREEN:
|
||||||
return glState.wideScreen;
|
return gpGlobals->wideScreen;
|
||||||
case PARM_FULLSCREEN:
|
case PARM_FULLSCREEN:
|
||||||
return glState.fullScreen;
|
return gpGlobals->fullScreen;
|
||||||
case PARM_SCREEN_WIDTH:
|
case PARM_SCREEN_WIDTH:
|
||||||
return glState.width;
|
return gpGlobals->width;
|
||||||
case PARM_SCREEN_HEIGHT:
|
case PARM_SCREEN_HEIGHT:
|
||||||
return glState.height;
|
return gpGlobals->height;
|
||||||
case PARM_CLIENT_INGAME:
|
|
||||||
return CL_IsInGame();
|
|
||||||
case PARM_MAX_ENTITIES:
|
|
||||||
return clgame.maxEntities;
|
|
||||||
case PARM_TEX_TARGET:
|
case PARM_TEX_TARGET:
|
||||||
glt = R_GetTexture( arg );
|
glt = R_GetTexture( arg );
|
||||||
return glt->target;
|
return glt->target;
|
||||||
@ -1249,16 +1236,10 @@ static int GL_RenderGetParm( int parm, int arg )
|
|||||||
case PARM_LIGHTSTYLEVALUE:
|
case PARM_LIGHTSTYLEVALUE:
|
||||||
arg = bound( 0, arg, MAX_LIGHTSTYLES - 1 );
|
arg = bound( 0, arg, MAX_LIGHTSTYLES - 1 );
|
||||||
return tr.lightstylevalue[arg];
|
return tr.lightstylevalue[arg];
|
||||||
case PARM_MAP_HAS_DELUXE:
|
|
||||||
return FBitSet( WORLDMODEL->flags, FWORLD_HAS_DELUXEMAP );
|
|
||||||
case PARM_MAX_IMAGE_UNITS:
|
case PARM_MAX_IMAGE_UNITS:
|
||||||
return GL_MaxTextureUnits();
|
return GL_MaxTextureUnits();
|
||||||
case PARM_CLIENT_ACTIVE:
|
|
||||||
return (cls.state == ca_active);
|
|
||||||
case PARM_REBUILD_GAMMA:
|
case PARM_REBUILD_GAMMA:
|
||||||
return glConfig.softwareGammaUpdate;
|
return glConfig.softwareGammaUpdate;
|
||||||
case PARM_DEDICATED_SERVER:
|
|
||||||
return (host.type == HOST_DEDICATED);
|
|
||||||
case PARM_SURF_SAMPLESIZE:
|
case PARM_SURF_SAMPLESIZE:
|
||||||
if( arg >= 0 && arg < WORLDMODEL->numsurfaces )
|
if( arg >= 0 && arg < WORLDMODEL->numsurfaces )
|
||||||
return gEngfuncs.Mod_SampleSizeForFace( &WORLDMODEL->surfaces[arg] );
|
return gEngfuncs.Mod_SampleSizeForFace( &WORLDMODEL->surfaces[arg] );
|
||||||
@ -1269,8 +1250,10 @@ static int GL_RenderGetParm( int parm, int arg )
|
|||||||
return glConfig.wrapper;
|
return glConfig.wrapper;
|
||||||
case PARM_STENCIL_ACTIVE:
|
case PARM_STENCIL_ACTIVE:
|
||||||
return glState.stencilEnabled;
|
return glState.stencilEnabled;
|
||||||
case PARM_WATER_ALPHA:
|
case PARM_SKY_SPHERE:
|
||||||
return FBitSet( WORLDMODEL->flags, FWORLD_WATERALPHA );
|
return gEngfuncs.CL_GetRenderParm( parm, arg ) && !tr.fCustomSkybox;
|
||||||
|
default:
|
||||||
|
return gEngfuncs.CL_GetRenderParm( parm, arg );
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1358,22 +1341,16 @@ Initialize client external rendering
|
|||||||
qboolean R_InitRenderAPI( void )
|
qboolean R_InitRenderAPI( void )
|
||||||
{
|
{
|
||||||
// make sure what render functions is cleared
|
// make sure what render functions is cleared
|
||||||
memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
|
memset( &gRenderIface, 0, sizeof( gRenderIface ));
|
||||||
|
|
||||||
if( clgame.dllFuncs.pfnGetRenderInterface )
|
if( gEngfuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &gRenderIface ))
|
||||||
{
|
{
|
||||||
if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs ))
|
Con_Reportf( "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION );
|
||||||
{
|
return true;
|
||||||
Con_Reportf( "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure what render functions is cleared
|
|
||||||
memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
|
|
||||||
|
|
||||||
return false; // just tell user about problems
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// render interface is missed
|
// make sure what render functions is cleared
|
||||||
return true;
|
memset( &gRenderIface, 0, sizeof( gRenderIface ));
|
||||||
|
|
||||||
|
return false; // just tell user about problems
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "mod_local.h"
|
|
||||||
#include "shake.h"
|
#include "shake.h"
|
||||||
#include "screenfade.h"
|
#include "screenfade.h"
|
||||||
#include "cdll_int.h"
|
#include "cdll_int.h"
|
||||||
|
@ -346,7 +346,7 @@ void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean trans_pass, f
|
|||||||
R_SetupGL( false ); // don't touch GL-states
|
R_SetupGL( false ); // don't touch GL-states
|
||||||
|
|
||||||
// setup PVS for frame
|
// setup PVS for frame
|
||||||
memcpy( RI.visbytes, tr.visbytes, WORLDMODEL->visbytes );
|
memcpy( RI.visbytes, tr.visbytes, gpGlobals->visbytes );
|
||||||
tr.frametime = frametime;
|
tr.frametime = frametime;
|
||||||
|
|
||||||
CL_DrawEFX( frametime, trans_pass );
|
CL_DrawEFX( frametime, trans_pass );
|
||||||
|
@ -14,7 +14,6 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "mod_local.h"
|
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -45,16 +44,16 @@ static void R_DrawVBO( qboolean drawlightmaps, qboolean drawtextures );
|
|||||||
|
|
||||||
byte *Mod_GetCurrentVis( void )
|
byte *Mod_GetCurrentVis( void )
|
||||||
{
|
{
|
||||||
if( clgame.drawFuncs.Mod_GetCurrentVis && tr.fCustomRendering )
|
if( gRenderIface.Mod_GetCurrentVis && tr.fCustomRendering )
|
||||||
return clgame.drawFuncs.Mod_GetCurrentVis();
|
return gRenderIface.Mod_GetCurrentVis();
|
||||||
return RI.visbytes;
|
return RI.visbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mod_SetOrthoBounds( float *mins, float *maxs )
|
void Mod_SetOrthoBounds( float *mins, float *maxs )
|
||||||
{
|
{
|
||||||
if( clgame.drawFuncs.GL_OrthoBounds )
|
if( gRenderIface.GL_OrthoBounds )
|
||||||
{
|
{
|
||||||
clgame.drawFuncs.GL_OrthoBounds( mins, maxs );
|
gRenderIface.GL_OrthoBounds( mins, maxs );
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2Average( maxs, mins, world_orthocenter );
|
Vector2Average( maxs, mins, world_orthocenter );
|
||||||
@ -1270,7 +1269,7 @@ void R_DrawTextureChains( void )
|
|||||||
RI.currententity = gEngfuncs.GetEntityByIndex( 0 );
|
RI.currententity = gEngfuncs.GetEntityByIndex( 0 );
|
||||||
RI.currentmodel = RI.currententity->model;
|
RI.currentmodel = RI.currententity->model;
|
||||||
|
|
||||||
if( FBitSet( WORLDMODEL->flags, FWORLD_SKYSPHERE ) && !FBitSet( WORLDMODEL->flags, FWORLD_CUSTOM_SKYBOX ))
|
if( gEngfuncs.CL)
|
||||||
{
|
{
|
||||||
pglDisable( GL_TEXTURE_2D );
|
pglDisable( GL_TEXTURE_2D );
|
||||||
pglColor3f( 1.0f, 1.0f, 1.0f );
|
pglColor3f( 1.0f, 1.0f, 1.0f );
|
||||||
@ -1280,7 +1279,7 @@ void R_DrawTextureChains( void )
|
|||||||
for( s = skychain; s != NULL; s = s->texturechain )
|
for( s = skychain; s != NULL; s = s->texturechain )
|
||||||
R_AddSkyBoxSurface( s );
|
R_AddSkyBoxSurface( s );
|
||||||
|
|
||||||
if( FBitSet( WORLDMODEL->flags, FWORLD_SKYSPHERE ) && !FBitSet( WORLDMODEL->flags, FWORLD_CUSTOM_SKYBOX ))
|
if( FBitSet( WORLDMODEL->flags, FWORLD_SKYSPHERE ) && !tr.fCustomSkybox )
|
||||||
{
|
{
|
||||||
pglEnable( GL_TEXTURE_2D );
|
pglEnable( GL_TEXTURE_2D );
|
||||||
if( skychain )
|
if( skychain )
|
||||||
@ -1608,22 +1607,22 @@ void R_DrawBrushModel( cl_entity_t *e )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( num_sorted < WORLDMODEL->max_surfaces )
|
if( num_sorted < gpGlobals->max_surfaces )
|
||||||
{
|
{
|
||||||
WORLDMODEL->draw_surfaces[num_sorted].surf = psurf;
|
gpGlobals->draw_surfaces[num_sorted].surf = psurf;
|
||||||
WORLDMODEL->draw_surfaces[num_sorted].cull = cull_type;
|
gpGlobals->draw_surfaces[num_sorted].cull = cull_type;
|
||||||
num_sorted++;
|
num_sorted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort faces if needs
|
// sort faces if needs
|
||||||
if( !FBitSet( clmodel->flags, MODEL_LIQUID ) && e->curstate.rendermode == kRenderTransTexture && !CVAR_TO_BOOL( gl_nosort ))
|
if( !FBitSet( clmodel->flags, MODEL_LIQUID ) && e->curstate.rendermode == kRenderTransTexture && !CVAR_TO_BOOL( gl_nosort ))
|
||||||
qsort( WORLDMODEL->draw_surfaces, num_sorted, sizeof( sortedface_t ), R_SurfaceCompare );
|
qsort( gpGlobals->draw_surfaces, num_sorted, sizeof( sortedface_t ), R_SurfaceCompare );
|
||||||
|
|
||||||
// draw sorted translucent surfaces
|
// draw sorted translucent surfaces
|
||||||
for( i = 0; i < num_sorted; i++ )
|
for( i = 0; i < num_sorted; i++ )
|
||||||
if( !allow_vbo || !R_AddSurfToVBO( WORLDMODEL->draw_surfaces[i].surf, true ) )
|
if( !allow_vbo || !R_AddSurfToVBO( gpGlobals->draw_surfaces[i].surf, true ) )
|
||||||
R_RenderBrushPoly( WORLDMODEL->draw_surfaces[i].surf, WORLDMODEL->draw_surfaces[i].cull );
|
R_RenderBrushPoly( gpGlobals->draw_surfaces[i].surf, gpGlobals->draw_surfaces[i].cull );
|
||||||
R_DrawVBO( R_HasLightmap(), true );
|
R_DrawVBO( R_HasLightmap(), true );
|
||||||
|
|
||||||
if( e->curstate.rendermode == kRenderTransColor )
|
if( e->curstate.rendermode == kRenderTransColor )
|
||||||
@ -3415,8 +3414,8 @@ void R_MarkLeaves( void )
|
|||||||
if( r_novis->value || RI.drawOrtho || !RI.viewleaf || !WORLDMODEL->visdata )
|
if( r_novis->value || RI.drawOrtho || !RI.viewleaf || !WORLDMODEL->visdata )
|
||||||
novis = true;
|
novis = true;
|
||||||
|
|
||||||
Mod_FatPVS( RI.pvsorigin, REFPVS_RADIUS, RI.visbytes, WORLDMODEL->visbytes, FBitSet( RI.params, RP_OLDVIEWLEAF ), novis );
|
Mod_FatPVS( RI.pvsorigin, REFPVS_RADIUS, RI.visbytes, gpGlobals->visbytes, FBitSet( RI.params, RP_OLDVIEWLEAF ), novis );
|
||||||
if( force && !novis ) Mod_FatPVS( test, REFPVS_RADIUS, RI.visbytes, WORLDMODEL->visbytes, true, novis );
|
if( force && !novis ) Mod_FatPVS( test, REFPVS_RADIUS, RI.visbytes, gpGlobals->visbytes, true, novis );
|
||||||
|
|
||||||
for( i = 0; i < WORLDMODEL->numleafs; i++ )
|
for( i = 0; i < WORLDMODEL->numleafs; i++ )
|
||||||
{
|
{
|
||||||
@ -3523,10 +3522,10 @@ void GL_RebuildLightmaps( void )
|
|||||||
}
|
}
|
||||||
LM_UploadBlock( false );
|
LM_UploadBlock( false );
|
||||||
|
|
||||||
if( clgame.drawFuncs.GL_BuildLightmaps )
|
if( gRenderIface.GL_BuildLightmaps )
|
||||||
{
|
{
|
||||||
// build lightmaps on the client-side
|
// build lightmaps on the client-side
|
||||||
clgame.drawFuncs.GL_BuildLightmaps( );
|
gRenderIface.GL_BuildLightmaps( );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3606,10 +3605,10 @@ void GL_BuildLightmaps( void )
|
|||||||
|
|
||||||
LM_UploadBlock( false );
|
LM_UploadBlock( false );
|
||||||
|
|
||||||
if( clgame.drawFuncs.GL_BuildLightmaps )
|
if( gRenderIface.GL_BuildLightmaps )
|
||||||
{
|
{
|
||||||
// build lightmaps on the client-side
|
// build lightmaps on the client-side
|
||||||
clgame.drawFuncs.GL_BuildLightmaps( );
|
gRenderIface.GL_BuildLightmaps( );
|
||||||
}
|
}
|
||||||
|
|
||||||
// now gamma and brightness are valid
|
// now gamma and brightness are valid
|
||||||
|
@ -13,7 +13,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "pm_local.h"
|
#include "pm_local.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
@ -181,10 +181,10 @@ int TriWorldToScreen( float *world, float *screen )
|
|||||||
|
|
||||||
retval = R_WorldToScreen( world, screen );
|
retval = R_WorldToScreen( world, screen );
|
||||||
|
|
||||||
screen[0] = 0.5f * screen[0] * (float)clgame.viewport[2];
|
screen[0] = 0.5f * screen[0] * (float)RI.viewport[2];
|
||||||
screen[1] = -0.5f * screen[1] * (float)clgame.viewport[3];
|
screen[1] = -0.5f * screen[1] * (float)RI.viewport[3];
|
||||||
screen[0] += 0.5f * (float)clgame.viewport[2];
|
screen[0] += 0.5f * (float)RI.viewport[2];
|
||||||
screen[1] += 0.5f * (float)clgame.viewport[3];
|
screen[1] += 0.5f * (float)RI.viewport[3];
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -221,8 +221,8 @@ generic method to fill rectangle
|
|||||||
*/
|
*/
|
||||||
void GAME_EXPORT VGUI_DrawQuad( const vpoint_t *ul, const vpoint_t *lr )
|
void GAME_EXPORT VGUI_DrawQuad( const vpoint_t *ul, const vpoint_t *lr )
|
||||||
{
|
{
|
||||||
float xscale = glState.width / (float)clgame.scrInfo.iWidth;
|
float xscale = gpGlobals->width / (float)clgame.scrInfo.iWidth;
|
||||||
float yscale = glState.height / (float)clgame.scrInfo.iHeight;
|
float yscale = gpGlobals->height / (float)clgame.scrInfo.iHeight;
|
||||||
|
|
||||||
ASSERT( ul != NULL && lr != NULL );
|
ASSERT( ul != NULL && lr != NULL );
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ void R_AddSkyBoxSurface( msurface_t *fa )
|
|||||||
float *v;
|
float *v;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( FBitSet( WORLDMODEL->flags, FWORLD_SKYSPHERE ) && fa->polys && !FBitSet( WORLDMODEL->flags, FWORLD_CUSTOM_SKYBOX ))
|
if( gEngfuncs.CL_GetRenderParm( PARM_SKY_SPHERE ) && fa->polys && !tr.fCustomSkybox )
|
||||||
{
|
{
|
||||||
glpoly_t *p = fa->polys;
|
glpoly_t *p = fa->polys;
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ void R_UnloadSkybox( void )
|
|||||||
tr.skyboxbasenum = 5800; // set skybox base (to let some mods load hi-res skyboxes)
|
tr.skyboxbasenum = 5800; // set skybox base (to let some mods load hi-res skyboxes)
|
||||||
|
|
||||||
memset( tr.skyboxTextures, 0, sizeof( tr.skyboxTextures ));
|
memset( tr.skyboxTextures, 0, sizeof( tr.skyboxTextures ));
|
||||||
ClearBits( WORLDMODEL->flags, FWORLD_CUSTOM_SKYBOX );
|
tr.fCustomSkybox = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -411,8 +411,8 @@ R_SetupSky
|
|||||||
*/
|
*/
|
||||||
void R_SetupSky( const char *skyboxname )
|
void R_SetupSky( const char *skyboxname )
|
||||||
{
|
{
|
||||||
char loadname[MAX_QPATH];
|
char loadname[MAX_STRING];
|
||||||
char sidename[MAX_QPATH];
|
char sidename[MAX_STRING];
|
||||||
int i, result;
|
int i, result;
|
||||||
|
|
||||||
if( !COM_CheckString( skyboxname ))
|
if( !COM_CheckString( skyboxname ))
|
||||||
@ -439,7 +439,7 @@ void R_SetupSky( const char *skyboxname )
|
|||||||
|
|
||||||
// release old skybox
|
// release old skybox
|
||||||
R_UnloadSkybox();
|
R_UnloadSkybox();
|
||||||
Con_DPrintf( "SKY: " );
|
gEngfuncs.Con_DPrintf( "SKY: " );
|
||||||
|
|
||||||
for( i = 0; i < 6; i++ )
|
for( i = 0; i < 6; i++ )
|
||||||
{
|
{
|
||||||
@ -449,17 +449,17 @@ void R_SetupSky( const char *skyboxname )
|
|||||||
|
|
||||||
tr.skyboxTextures[i] = GL_LoadTexture( sidename, NULL, 0, TF_CLAMP|TF_SKY );
|
tr.skyboxTextures[i] = GL_LoadTexture( sidename, NULL, 0, TF_CLAMP|TF_SKY );
|
||||||
if( !tr.skyboxTextures[i] ) break;
|
if( !tr.skyboxTextures[i] ) break;
|
||||||
Con_DPrintf( "%s%s%s", skyboxname, r_skyBoxSuffix[i], i != 5 ? ", " : ". " );
|
gEngfuncs.Con_DPrintf( "%s%s%s", skyboxname, r_skyBoxSuffix[i], i != 5 ? ", " : ". " );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( i == 6 )
|
if( i == 6 )
|
||||||
{
|
{
|
||||||
SetBits( WORLDMODEL->flags, FWORLD_CUSTOM_SKYBOX );
|
tr.fCustomSkybox = true;
|
||||||
Con_DPrintf( "done\n" );
|
gEngfuncs.Con_DPrintf( "done\n" );
|
||||||
return; // loaded
|
return; // loaded
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_DPrintf( "^2failed\n" );
|
gEngfuncs.Con_DPrintf( "^2failed\n" );
|
||||||
R_UnloadSkybox();
|
R_UnloadSkybox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user