- enable mipmapping in 2D

This commit is contained in:
Rachael Alexanderson 2024-07-04 14:32:14 -04:00 committed by Rachael Alexanderson
parent a4e527979d
commit d6e1097b85

View file

@ -50,6 +50,7 @@
//=========================================================================== //===========================================================================
CVAR(Bool, gl_aalines, false, CVAR_ARCHIVE) CVAR(Bool, gl_aalines, false, CVAR_ARCHIVE)
CVAR(Bool, hw_2dmip, true, CVAR_ARCHIVE)
void Draw2D(F2DDrawer* drawer, FRenderState& state) void Draw2D(F2DDrawer* drawer, FRenderState& state)
{ {
@ -71,6 +72,8 @@ void Draw2D(F2DDrawer* drawer, FRenderState& state, int x, int y, int width, int
state.EnableMultisampling(false); state.EnableMultisampling(false);
state.EnableLineSmooth(gl_aalines); 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 &vertices = drawer->mVertices;
auto &indices = drawer->mIndices; auto &indices = drawer->mIndices;
auto &commands = drawer->mData; auto &commands = drawer->mData;
@ -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 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; 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); state.EnableTexture(true);
// Canvas textures are stored upside down // Canvas textures are stored upside down