10 Oct 2016
This commit is contained in:
parent
12f0e031df
commit
34cd7a30af
|
@ -25,6 +25,8 @@
|
|||
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
|
||||
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
|
||||
|
||||
#define FCVAR_GLCONFIG (1<<18) // write it into opengl.cfg
|
||||
|
||||
typedef struct cvar_s
|
||||
{
|
||||
char *name;
|
||||
|
|
|
@ -305,9 +305,6 @@ void CL_CreateCmd( void )
|
|||
else if( ms <= 0 ) ms = 1; // keep time an actual
|
||||
|
||||
Q_memset( &cmd, 0, sizeof( cmd ));
|
||||
|
||||
// build list of all solid entities per next frame (exclude clients)
|
||||
CL_SetSolidEntities();
|
||||
CL_PushPMStates();
|
||||
CL_SetSolidPlayers( cl.playernum );
|
||||
|
||||
|
@ -1520,6 +1517,9 @@ void CL_ReadPackets( void )
|
|||
#endif
|
||||
CL_UpdateFrameLerp ();
|
||||
|
||||
// build list of all solid entities per next frame (exclude clients)
|
||||
CL_SetSolidEntities();
|
||||
|
||||
// singleplayer never has connection timeout
|
||||
if( NET_IsLocalAddress( cls.netchan.remote_address ))
|
||||
return;
|
||||
|
|
|
@ -1181,7 +1181,6 @@ void CL_PredictMovement( void )
|
|||
|
||||
time = cl.frame.time;
|
||||
|
||||
CL_SetSolidEntities();
|
||||
CL_SetSolidPlayers( cl.playernum );
|
||||
|
||||
while( 1 )
|
||||
|
|
|
@ -1447,8 +1447,6 @@ void CL_DrawBeam( BEAM *pbeam )
|
|||
VectorScale( color, ( pbeam->brightness / 255.0f ), color );
|
||||
VectorScale( color, ( 1.0f / 255.0f ), color );
|
||||
|
||||
pglShadeModel( GL_SMOOTH );
|
||||
|
||||
switch( pbeam->type )
|
||||
{
|
||||
case TE_BEAMDISK:
|
||||
|
@ -1478,7 +1476,6 @@ void CL_DrawBeam( BEAM *pbeam )
|
|||
MsgDev( D_ERROR, "CL_DrawBeam: Unknown beam type %i\n", pbeam->type );
|
||||
break;
|
||||
}
|
||||
pglShadeModel( GL_FLAT );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -836,6 +836,10 @@ static void GL_SetTextureTarget( gltexture_t *tex, rgbdata_t *pic )
|
|||
tex->flags |= TF_CLAMP;
|
||||
}
|
||||
|
||||
// depth cubemaps only allowed when GL_EXT_gpu_shader4 is supported
|
||||
if( !GL_Support( GL_GPU_SHADER4_EXT ) && ( tex->flags & TF_DEPTHMAP ))
|
||||
tex->target = GL_NONE;
|
||||
|
||||
tex->flags |= TF_CUBEMAP; // it's cubemap!
|
||||
}
|
||||
}
|
||||
|
@ -1109,7 +1113,8 @@ Operates in place, quartering the size of the texture
|
|||
static void GL_BuildMipMap( byte *in, int srcWidth, int srcHeight, int srcDepth, qboolean isNormalMap )
|
||||
{
|
||||
byte *out = in;
|
||||
int mipWidth, mipHeight;
|
||||
int instride = ALIGN( srcWidth * 4, 1 );
|
||||
int mipWidth, mipHeight, outpadding;
|
||||
int row, x, y, z;
|
||||
vec3_t normal;
|
||||
|
||||
|
@ -1117,6 +1122,7 @@ static void GL_BuildMipMap( byte *in, int srcWidth, int srcHeight, int srcDepth,
|
|||
|
||||
mipWidth = max( 1, ( srcWidth >> 1 ));
|
||||
mipHeight = max( 1, ( srcHeight >> 1 ));
|
||||
outpadding = ALIGN( mipWidth * 4, 1 ) - mipWidth * 4;
|
||||
row = srcWidth << 2;
|
||||
|
||||
// move through all layers
|
||||
|
@ -1124,13 +1130,23 @@ static void GL_BuildMipMap( byte *in, int srcWidth, int srcHeight, int srcDepth,
|
|||
{
|
||||
if( isNormalMap )
|
||||
{
|
||||
for( y = 0; y < mipHeight; y++, in += row )
|
||||
for( y = 0; y < mipHeight; y++, in += instride * 2, out += outpadding )
|
||||
{
|
||||
for( x = 0; x < mipWidth; x++, in += 8, out += 4 )
|
||||
byte *next = ((( y << 1 ) + 1 ) < srcHeight ) ? ( in + instride ) : in;
|
||||
for( x = 0, row = 0; x < mipWidth; x++, row += 8, out += 4 )
|
||||
{
|
||||
normal[0] = MAKE_SIGNED(in[0]) + MAKE_SIGNED(in[4]) + MAKE_SIGNED(in[row+0]) + MAKE_SIGNED(in[row+4]);
|
||||
normal[1] = MAKE_SIGNED(in[1]) + MAKE_SIGNED(in[5]) + MAKE_SIGNED(in[row+1]) + MAKE_SIGNED(in[row+5]);
|
||||
normal[2] = MAKE_SIGNED(in[2]) + MAKE_SIGNED(in[6]) + MAKE_SIGNED(in[row+2]) + MAKE_SIGNED(in[row+6]);
|
||||
if((( x << 1 ) + 1 ) < srcWidth )
|
||||
{
|
||||
normal[0] = MAKE_SIGNED(in[row+0]) + MAKE_SIGNED(in[row+4]) + MAKE_SIGNED(next[row+0]) + MAKE_SIGNED(next[row+4]);
|
||||
normal[1] = MAKE_SIGNED(in[row+1]) + MAKE_SIGNED(in[row+5]) + MAKE_SIGNED(next[row+1]) + MAKE_SIGNED(next[row+5]);
|
||||
normal[2] = MAKE_SIGNED(in[row+2]) + MAKE_SIGNED(in[row+6]) + MAKE_SIGNED(next[row+2]) + MAKE_SIGNED(next[row+6]);
|
||||
}
|
||||
else
|
||||
{
|
||||
normal[0] = MAKE_SIGNED(in[row+0]) + MAKE_SIGNED(next[row+0]);
|
||||
normal[1] = MAKE_SIGNED(in[row+1]) + MAKE_SIGNED(next[row+1]);
|
||||
normal[2] = MAKE_SIGNED(in[row+2]) + MAKE_SIGNED(next[row+2]);
|
||||
}
|
||||
|
||||
if( !VectorNormalizeLength( normal ))
|
||||
VectorSet( normal, 0.5f, 0.5f, 1.0f );
|
||||
|
@ -1144,14 +1160,25 @@ static void GL_BuildMipMap( byte *in, int srcWidth, int srcHeight, int srcDepth,
|
|||
}
|
||||
else
|
||||
{
|
||||
for( y = 0; y < mipHeight; y++, in += row )
|
||||
for( y = 0; y < mipHeight; y++, in += instride * 2, out += outpadding )
|
||||
{
|
||||
for( x = 0; x < mipWidth; x++, in += 8, out += 4 )
|
||||
byte *next = ((( y << 1 ) + 1 ) < srcHeight ) ? ( in + instride ) : in;
|
||||
for( x = 0, row = 0; x < mipWidth; x++, row += 8, out += 4 )
|
||||
{
|
||||
out[0] = (in[0] + in[4] + in[row+0] + in[row+4]) >> 2;
|
||||
out[1] = (in[1] + in[5] + in[row+1] + in[row+5]) >> 2;
|
||||
out[2] = (in[2] + in[6] + in[row+2] + in[row+6]) >> 2;
|
||||
out[3] = (in[3] + in[7] + in[row+3] + in[row+7]) >> 2;
|
||||
if((( x << 1 ) + 1 ) < srcWidth )
|
||||
{
|
||||
out[0] = (in[row+0] + in[row+4] + next[row+0] + next[row+4]) >> 2;
|
||||
out[1] = (in[row+1] + in[row+5] + next[row+1] + next[row+5]) >> 2;
|
||||
out[2] = (in[row+2] + in[row+6] + next[row+2] + next[row+6]) >> 2;
|
||||
out[3] = (in[row+3] + in[row+7] + next[row+3] + next[row+7]) >> 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
out[0] = (in[row+0] + next[row+0]) >> 1;
|
||||
out[1] = (in[row+1] + next[row+1]) >> 1;
|
||||
out[2] = (in[row+2] + next[row+2]) >> 1;
|
||||
out[3] = (in[row+3] + next[row+3]) >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -505,6 +505,7 @@ enum
|
|||
GL_OCCLUSION_QUERIES_EXT,
|
||||
GL_TEXTURE_COMPRESSION_EXT,
|
||||
GL_SHADER_GLSL100_EXT,
|
||||
GL_GPU_SHADER4_EXT,
|
||||
GL_SGIS_MIPMAPS_EXT,
|
||||
GL_DRAW_RANGEELEMENTS_EXT,
|
||||
GL_LOCKARRAYS_EXT,
|
||||
|
|
|
@ -2567,7 +2567,6 @@ R_StudioSetupRenderer
|
|||
static void R_StudioSetupRenderer( int rendermode )
|
||||
{
|
||||
g_iRenderMode = bound( 0, rendermode, kRenderTransAdd );
|
||||
pglShadeModel( GL_SMOOTH ); // enable gouraud shading
|
||||
if( clgame.ds.cullMode != GL_NONE ) GL_Cull( GL_FRONT );
|
||||
|
||||
// enable depthmask on studiomodels
|
||||
|
@ -2589,7 +2588,6 @@ R_StudioRestoreRenderer
|
|||
static void R_StudioRestoreRenderer( void )
|
||||
{
|
||||
pglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
pglShadeModel( GL_FLAT );
|
||||
|
||||
// restore depthmask state for sprites etc
|
||||
if( glState.drawTrans && g_iRenderMode != kRenderTransAdd )
|
||||
|
|
|
@ -1554,7 +1554,7 @@ static void GL_SetDefaults( void )
|
|||
pglDisable( GL_POLYGON_OFFSET_FILL );
|
||||
pglAlphaFunc( GL_GREATER, 0.0f );
|
||||
pglEnable( GL_TEXTURE_2D );
|
||||
pglShadeModel( GL_FLAT );
|
||||
pglShadeModel( GL_SMOOTH );
|
||||
|
||||
pglPointSize( 1.2f );
|
||||
pglLineWidth( 1.2f );
|
||||
|
@ -1857,6 +1857,9 @@ void GL_InitExtensions( void )
|
|||
// rectangle textures support
|
||||
GL_CheckExtension( "GL_ARB_texture_rectangle", NULL, "gl_texture_rectangle", GL_TEXTURE_2D_RECT_EXT );
|
||||
|
||||
// shadow cubeMaps required this
|
||||
GL_CheckExtension( "GL_EXT_gpu_shader4", NULL, "gl_ext_gpu_shader4", GL_GPU_SHADER4_EXT );
|
||||
|
||||
if( GL_Support( GL_SHADER_GLSL100_EXT ))
|
||||
{
|
||||
pglGetIntegerv( GL_MAX_TEXTURE_COORDS_ARB, &glConfig.max_texture_coords );
|
||||
|
|
|
@ -378,6 +378,8 @@ pfnCvar_RegisterVariable
|
|||
*/
|
||||
cvar_t *pfnCvar_RegisterVariable( const char *szName, const char *szValue, int flags )
|
||||
{
|
||||
if( flags & FCVAR_GLCONFIG )
|
||||
return (cvar_t *)Cvar_Get( szName, szValue, flags, va( "enable or disable %s", szName ));
|
||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|CVAR_CLIENTDLL, "client cvar" );
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,8 @@ GNU General Public License for more details.
|
|||
#define Q_rint(x) ((x) < 0 ? ((int)((x)-0.5f)) : ((int)((x)+0.5f)))
|
||||
#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)
|
||||
|
||||
#define ALIGN( x, a ) ((( x ) + (( size_t )( a ) - 1 )) & ~(( size_t )( a ) - 1 ))
|
||||
|
||||
#define VectorIsNAN(v) (IS_NAN(v[0]) || IS_NAN(v[1]) || IS_NAN(v[2]))
|
||||
#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
|
||||
#define DotProductAbs(x,y) (abs((x)[0]*(y)[0])+abs((x)[1]*(y)[1])+abs((x)[2]*(y)[2]))
|
||||
|
|
|
@ -66,12 +66,19 @@ SV_CheckAllEnts
|
|||
*/
|
||||
void SV_CheckAllEnts( void )
|
||||
{
|
||||
static double nextcheck;
|
||||
edict_t *e;
|
||||
int i;
|
||||
|
||||
if( !sv_check_errors->integer || sv.state != ss_active )
|
||||
return;
|
||||
|
||||
if(( nextcheck - Sys_DoubleTime()) > 0.0 )
|
||||
return;
|
||||
|
||||
// don't check entities every frame (but every 5 secs)
|
||||
nextcheck = Sys_DoubleTime() + 5.0;
|
||||
|
||||
// check edicts errors
|
||||
for( i = svgame.globals->maxClients + 1; i < svgame.numEntities; i++ )
|
||||
{
|
||||
|
|
Reference in New Issue