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 ); }