From 4599983c8ec4a003b8b02d5c41de9902803f71ba Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 25 Jan 2024 05:46:54 +0300 Subject: [PATCH] ref: gl: add PARM_TEX_FILTERING handler --- ref/gl/gl_context.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ref/gl/gl_context.c b/ref/gl/gl_context.c index db05733d..ff3e0667 100644 --- a/ref/gl/gl_context.c +++ b/ref/gl/gl_context.c @@ -167,6 +167,25 @@ qboolean Mod_ProcessRenderData( model_t *mod, qboolean create, const byte *buf ) return loaded; } +static qboolean R_TextureFilteringEnabled( int arg ) +{ + gl_texture_t *glt; + + if( arg < 0 ) + return gl_texture_nearest.value == 0.0f; + + glt = R_GetTexture( arg ); + + if( FBitSet( glt->flags, TF_NEAREST )) + return false; + + // lightmaps have special cvar + if( FBitSet( glt->flags, TF_ATLAS_PAGE )) + return gl_lightmap_nearest.value == 0.0f; + + return gl_texture_nearest.value == 0.0f; +} + static int GL_RefGetParm( int parm, int arg ) { gl_texture_t *glt; @@ -237,6 +256,8 @@ static int GL_RefGetParm( int parm, int arg ) return glState.stencilEnabled; case PARM_SKY_SPHERE: return FBitSet( tr.world->flags, FWORLD_SKYSPHERE ) && !FBitSet( tr.world->flags, FWORLD_CUSTOM_SKYBOX ); + case PARM_TEX_FILTERING: + return R_TextureFilteringEnabled( arg ); default: return ENGINE_GET_PARM_( parm, arg ); }