Skip to content

Commit

Permalink
- enable mipmapping in 2D
Browse files Browse the repository at this point in the history
  • Loading branch information
madame-rachelle committed Dec 26, 2024
1 parent a4e5279 commit d6e1097
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/common/rendering/hwrenderer/hw_draw2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
//===========================================================================

CVAR(Bool, gl_aalines, false, CVAR_ARCHIVE)
CVAR(Bool, hw_2dmip, true, CVAR_ARCHIVE)

void Draw2D(F2DDrawer* drawer, FRenderState& state)
{
Expand All @@ -71,6 +72,8 @@ void Draw2D(F2DDrawer* drawer, FRenderState& state, int x, int y, int width, int
state.EnableMultisampling(false);
state.EnableLineSmooth(gl_aalines);

bool cache_hw_2dmip = hw_2dmip; // cache cvar lookup so it's not done in a loop

auto &vertices = drawer->mVertices;
auto &indices = drawer->mIndices;
auto &commands = drawer->mData;
Expand Down Expand Up @@ -180,7 +183,7 @@ void Draw2D(F2DDrawer* drawer, FRenderState& state, int x, int y, int width, int
auto flags = cmd.mTexture->GetUseType() >= ETextureType::Special? UF_None : cmd.mTexture->GetUseType() == ETextureType::FontChar? UF_Font : UF_Texture;

auto scaleflags = cmd.mFlags & F2DDrawer::DTF_Indexed ? CTF_Indexed : 0;
state.SetMaterial(cmd.mTexture, flags, scaleflags, cmd.mFlags & F2DDrawer::DTF_Wrap ? CLAMP_NONE : CLAMP_XY_NOMIP, cmd.mTranslationId, -1);
state.SetMaterial(cmd.mTexture, flags, scaleflags, cmd.mFlags & F2DDrawer::DTF_Wrap ? CLAMP_NONE : (cache_hw_2dmip ? CLAMP_XY : CLAMP_XY_NOMIP), cmd.mTranslationId, -1);
state.EnableTexture(true);

// Canvas textures are stored upside down
Expand Down

0 comments on commit d6e1097

Please sign in to comment.