Skip to content

Commit

Permalink
Disable texture filter/aniso options if r_softemu >= 2
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-drexler committed Sep 11, 2024
1 parent 03108fa commit 36ed75c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
12 changes: 11 additions & 1 deletion Quake/gl_texmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,16 @@ static void TexMgr_ForceFilterUpdate (void)
gl_texfilter.anisotropy = -1.f;
}

/*
===============
TexMgr_UsesFilterOverride
===============
*/
qboolean TexMgr_UsesFilterOverride (void)
{
return softemu >= SOFTEMU_COARSE || r_softemu_lightmap_banding.value > 0.f;
}

/*
===============
TexMgr_ApplySettings -- called at the beginning of each frame
Expand All @@ -339,7 +349,7 @@ void TexMgr_ApplySettings (void)
gl_texfilter.lodbias = lodbias;

// if softemu is either 2 & 3 or r_softemu_lightmap_banding is > 0 we override the filtering mode, unless it's GL_NEAREST
if (gl_texfilter.mode != 0 && (softemu >= SOFTEMU_COARSE || r_softemu_lightmap_banding.value > 0.f))
if (gl_texfilter.mode != 0 && TexMgr_UsesFilterOverride ())
{
const float SOFTEMU_ANISOTROPY = 8.f;
gl_texfilter.mode = 2; // nearest with linear mips
Expand Down
1 change: 1 addition & 0 deletions Quake/gl_texmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ void TexMgr_NewGame (void);
void TexMgr_Init (void);
void TexMgr_DeleteTextureObjects (void);
void TexMgr_ApplySettings (void);
qboolean TexMgr_UsesFilterOverride (void);

// IMAGE LOADING
gltexture_t *TexMgr_LoadImage (qmodel_t *owner, const char *name, int width, int height, enum srcformat format,
Expand Down
10 changes: 9 additions & 1 deletion Quake/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2934,11 +2934,17 @@ VID_Menu_GetTexFilterDesc
*/
static const char *VID_Menu_GetTexFilterDesc (void)
{
const char *current = Cvar_VariableString ("gl_texturemode");
const char *current;
int i;

if (TexMgr_UsesFilterOverride ())
return "Classic";

current = Cvar_VariableString ("gl_texturemode");
for (i = 0; i < countof (texfilters); i++)
if (!q_strcasecmp (current, texfilters[i][0]))
return texfilters[i][1];

return "";
}

Expand Down Expand Up @@ -3490,6 +3496,8 @@ static qboolean M_Options_IsEnabled (int index)
index += optionsmenu.first_item;
if ((unsigned int) index >= countof (options_names))
return false;
if (index == OPT_TEXFILTER || index == OPT_ANISO)
return !TexMgr_UsesFilterOverride ();
if (index > GAMEPAD_OPTIONS_BEGIN && index < GAMEPAD_OPTIONS_END && !IN_HasGamepad ())
return false;
if (index == GPAD_OPT_RUMBLE && !IN_HasRumble ())
Expand Down

0 comments on commit 36ed75c

Please sign in to comment.