21 Sep 2017

This commit is contained in:
g-cont 2017-09-21 00:00:00 +03:00 committed by Alibek Omarov
parent 766bbdc8a8
commit c7c82dca1e
6 changed files with 31 additions and 21 deletions

View File

@ -147,7 +147,7 @@ void GL_ApplyTextureParams( gltexture_t *tex )
}
else if( FBitSet( tex->flags, TF_NOMIPMAP ) || tex->numMips <= 1 )
{
if( FBitSet( tex->flags, TF_NEAREST ))
if( FBitSet( tex->flags, TF_NEAREST ) || ( !Q_strncmp( tex->name, "*lightmap", 9 ) && gl_lightmap_nearest->value ))
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
@ -262,6 +262,20 @@ static void GL_UpdateTextureParams( int iTexture )
if( GL_Support( GL_TEXTURE_LOD_BIAS ) && ( tex->numMips > 1 ) && !FBitSet( tex->flags, TF_DEPTHMAP ))
pglTexParameterf( tex->target, GL_TEXTURE_LOD_BIAS_EXT, gl_texture_lodbias->value );
if( !Q_strncmp( tex->name, "*lightmap", 9 ))
{
if( gl_lightmap_nearest->value )
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
}
else
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
}
}
if( tex->numMips <= 1 ) return;
if( FBitSet( tex->flags, TF_NEAREST ) || gl_texture_nearest->value )
@ -304,6 +318,7 @@ void R_SetTextureParameters( void )
ClearBits( gl_texture_anisotropy->flags, FCVAR_CHANGED );
ClearBits( gl_texture_lodbias->flags, FCVAR_CHANGED );
ClearBits( gl_texture_nearest->flags, FCVAR_CHANGED );
ClearBits( gl_lightmap_nearest->flags, FCVAR_CHANGED );
// change all the existing mipmapped texture objects
for( i = 0; i < r_numTextures; i++ )

View File

@ -662,6 +662,7 @@ extern convar_t *gl_extensions;
extern convar_t *gl_check_errors;
extern convar_t *gl_texture_lodbias;
extern convar_t *gl_texture_nearest;
extern convar_t *gl_lightmap_nearest;
extern convar_t *gl_keeptjunctions;
extern convar_t *gl_detailscale;
extern convar_t *gl_wireframe;

View File

@ -714,14 +714,14 @@ static void R_CheckFog( void )
RI.fogEnabled = false;
if( RI.onlyClientDraw || cl.local.waterlevel < 2 || !RI.drawWorld || !RI.viewleaf )
if( RI.onlyClientDraw || cl.local.waterlevel < 3 || !RI.drawWorld || !RI.viewleaf )
{
if( RI.cached_waterlevel == 3 && !RI.fogCustom )
if( RI.cached_waterlevel == 3 )
{
// in some cases waterlevel jumps from 3 to 1. Catch it
RI.cached_waterlevel = cl.local.waterlevel;
RI.cached_contents = CONTENTS_EMPTY;
pglDisable( GL_FOG );
if( !RI.fogCustom ) pglDisable( GL_FOG );
}
return;
}
@ -733,19 +733,6 @@ static void R_CheckFog( void )
RI.cached_waterlevel = cl.local.waterlevel;
if( IsLiquidContents( RI.cached_contents ) && !IsLiquidContents( cnt ))
{
RI.cached_contents = CONTENTS_EMPTY;
pglDisable( GL_FOG );
return;
}
if( cl.local.waterlevel < 3 )
{
pglDisable( GL_FOG );
return;
}
if( !IsLiquidContents( RI.cached_contents ) && IsLiquidContents( cnt ))
{
tex = NULL;
@ -974,10 +961,10 @@ void R_RenderScene( void )
R_Clear( ~0 );
R_MarkLeaves();
R_CheckFog();
R_DrawFog ();
R_DrawWorld();
R_CheckFog();
CL_ExtraUpdate (); // don't let sound get messed up if going slow
@ -1062,7 +1049,7 @@ void R_BeginFrame( qboolean clearScene )
pglDrawBuffer( GL_BACK );
// update texture parameters
if( FBitSet( gl_texture_nearest->flags|gl_texture_anisotropy->flags|gl_texture_lodbias->flags, FCVAR_CHANGED ))
if( FBitSet( gl_texture_nearest->flags|gl_lightmap_nearest->flags|gl_texture_anisotropy->flags|gl_texture_lodbias->flags, FCVAR_CHANGED ))
R_SetTextureParameters();
// swapinterval stuff

View File

@ -31,6 +31,7 @@ convar_t *gl_extensions;
convar_t *gl_texture_anisotropy;
convar_t *gl_texture_lodbias;
convar_t *gl_texture_nearest;
convar_t *gl_lightmap_nearest;
convar_t *gl_keeptjunctions;
convar_t *gl_showtextures;
convar_t *gl_detailscale;
@ -1584,6 +1585,7 @@ void GL_InitCommands( void )
gl_extensions = Cvar_Get( "gl_allow_extensions", "1", FCVAR_GLCONFIG, "allow gl_extensions" );
gl_texture_nearest = Cvar_Get( "gl_texture_nearest", "0", FCVAR_ARCHIVE, "disable texture filter" );
gl_lightmap_nearest = Cvar_Get( "gl_lightmap_nearest", "0", FCVAR_ARCHIVE, "disable lightmap filter" );
gl_max_size = Cvar_Get( "gl_max_size", "512", FCVAR_ARCHIVE, "no effect in Xash3D just a legacy" );
gl_check_errors = Cvar_Get( "gl_check_errors", "1", FCVAR_ARCHIVE, "ignore video engine errors" );
gl_vsync = Cvar_Get( "gl_vsync", "0", FCVAR_ARCHIVE, "enable vertical syncronization" );

View File

@ -95,6 +95,7 @@ typedef struct
int block_size; // lightmap blocksize
color24 *deluxedata; // deluxemap data pointer
char message[2048]; // just for debug
char compiler[256]; // map compiler
// visibility info
byte *visdata; // uncompressed visdata

View File

@ -143,6 +143,7 @@ void Mod_PrintBSPFileSizes_f( void )
Msg( "Supports transparency world water: %s\n", world.water_alpha ? "Yes" : "No" );
Msg( "original name: ^1%s\n", worldmodel->name );
Msg( "internal name: %s\n", (world.message[0]) ? va( "^2%s", world.message ) : "none" );
Msg( "map compiler: %s\n", (world.compiler[0]) ? va( "^3%s", world.compiler ) : "unknown" );
}
/*
@ -1050,7 +1051,7 @@ static void Mod_LoadTexInfo( const dlump_t *l, dextrahdr_t *extrahdr )
miptex = in->miptex;
if( miptex < 0 || miptex > loadmodel->numtextures )
Host_Error( "Mod_LoadTexInfo: bad miptex number in '%s'\n", loadmodel->name );
Host_Error( "Mod_LoadTexInfo: bad miptex number %i in '%s'\n", miptex, loadmodel->name );
out->texture = loadmodel->textures[miptex];
out->flags = in->flags;
@ -1895,7 +1896,7 @@ static void Mod_LoadPlanes( const dlump_t *l )
}
if( VectorIsNull( out->normal ))
Host_Error( "Mod_LoadPlanes: bad normal for plane #%i\n", i );
MsgDev( D_ERROR, "Mod_LoadPlanes: zero normal for plane #%i\n", i );
out->dist = in->dist;
out->type = in->type;
@ -1944,6 +1945,7 @@ static void Mod_LoadEntities( const dlump_t *l )
world.entdatasize = l->filelen;
pfile = (char *)loadmodel->entities;
world.compiler[0] = '\0';
world.message[0] = '\0';
wadlist.count = 0;
@ -1991,6 +1993,8 @@ static void Mod_LoadEntities( const dlump_t *l )
world.mapversion = Q_atoi( token );
else if( !Q_stricmp( keyname, "message" ))
Q_strncpy( world.message, token, sizeof( world.message ));
else if( !Q_stricmp( keyname, "compiler" ) || !Q_stricmp( keyname, "_compiler" ))
Q_strncpy( world.compiler, token, sizeof( world.compiler ));
}
return; // all done
}