ref: gl: make use of new TF_ALLOW_NEAREST_TOGGLE flag

This commit is contained in:
Alibek Omarov 2024-01-29 05:50:59 +03:00
parent 04f42df7d5
commit 600d574376
4 changed files with 4 additions and 29 deletions

View File

@ -46,8 +46,8 @@ GNU General Public License for more details.
#define REF_API_VERSION 7
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP)
#define TF_FONT (TF_NOMIPMAP|TF_CLAMP)
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP|TF_ALLOW_NEAREST_TOGGLE)
#define TF_FONT (TF_NOMIPMAP|TF_CLAMP|TF_ALLOW_NEAREST_TOGGLE)
#define TF_IMAGE (TF_NOMIPMAP|TF_CLAMP)
#define TF_DECAL (TF_CLAMP)

View File

@ -131,7 +131,7 @@ qboolean GL_TextureFilteringEnabled( const gl_texture_t *tex )
if( FBitSet( tex->flags, TF_ATLAS_PAGE ))
return gl_lightmap_nearest.value == 0.0f;
if( FBitSet( tex->flags, TF_SKYSIDE ))
if( FBitSet( tex->flags, TF_ALLOW_NEAREST_TOGGLE ))
return gl_texture_nearest.value == 0.0f;
return true;
@ -329,8 +329,6 @@ void R_SetTextureParameters( void )
// change all the existing mipmapped texture objects
for( i = 0; i < gl_numTextures; i++ )
GL_UpdateTextureParams( i );
R_UpdateRippleTexParams();
}
/*

View File

@ -496,7 +496,6 @@ void EmitWaterPolys( msurface_t *warp, qboolean reverse );
void R_InitRipples( void );
void R_ResetRipples( void );
void R_AnimateRipples( void );
void R_UpdateRippleTexParams( void );
void R_UploadRipples( texture_t *image );
//

View File

@ -882,11 +882,7 @@ void R_InitRipples( void )
pic.numMips = 1;
memset( pic.buffer, 0, pic.size );
g_ripple.rippletexturenum = GL_LoadTextureInternal( "*rippletex", &pic, TF_NOMIPMAP );
// need to set proper tex params for TF_NOMIPMAP texture,
// as during upload it fails TF_NEAREST check and gets blurry even with gl_texture_nearest 1
R_UpdateRippleTexParams();
g_ripple.rippletexturenum = GL_LoadTextureInternal( "*rippletex", &pic, TF_NOMIPMAP|TF_ALLOW_NEAREST_TOGGLE );
}
static void R_SwapBufs( void )
@ -967,24 +963,6 @@ void R_AnimateRipples( void )
R_RunRipplesAnimation( g_ripple.oldbuf, g_ripple.curbuf );
}
void R_UpdateRippleTexParams( void )
{
gl_texture_t *tex = R_GetTexture( g_ripple.rippletexturenum );
GL_Bind( XASH_TEXTURE0, g_ripple.rippletexturenum );
if( gl_texture_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 );
}
}
void R_UploadRipples( texture_t *image )
{
gl_texture_t *glt;