diff --git a/src/common/textures/gametexture.h b/src/common/textures/gametexture.h index 3eb3740a952..a55616e66eb 100644 --- a/src/common/textures/gametexture.h +++ b/src/common/textures/gametexture.h @@ -62,6 +62,7 @@ enum EGameTexFlags GTexf_OffsetsNotForFont = 512, // The offsets must be ignored when using this texture in a font. GTexf_NoTrim = 1024, // Don't perform trimming on this texture. GTexf_Seen = 2048, // Set to true when the texture is being used for rendering. Must be cleared manually if the check is needed. + GTexf_NoMipmap = 4096, // Disable mipmapping for this texture }; struct FMaterialLayers @@ -265,6 +266,9 @@ class FGameTexture void SetGlowing(PalEntry color) { flags = (flags & ~GTexf_AutoGlowing) | GTexf_Glowing; GlowColor = color; } void SetDisableBrightmap() { flags |= GTexf_BrightmapChecked; Brightmap = nullptr; } + bool isNoMipmap() const { return !!(flags & GTexf_NoMipmap); } + void SetNoMipmap(bool set) { if (set) flags |= GTexf_NoMipmap; else flags &= ~GTexf_NoMipmap; } + bool isUserContent() const; int CheckRealHeight() { return xs_RoundToInt(Base->CheckRealHeight() / ScaleY); } void SetSize(int x, int y) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index d472decad19..4fb96c952e7 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -502,10 +502,9 @@ enum ActorRenderFlag2 RF2_FLIPSPRITEOFFSETX = 0x0010, RF2_FLIPSPRITEOFFSETY = 0x0020, RF2_CAMFOLLOWSPLAYER = 0x0040, // Matches the cam's base position and angles to the main viewpoint. - RF2_NOMIPMAP = 0x0080, // [Nash] forces no mipmapping on sprites. Useful for tiny sprites that need to remain visually crisp - RF2_ISOMETRICSPRITES = 0x0100, - RF2_SQUAREPIXELS = 0x0200, // apply +ROLLSPRITE scaling math so that non rolling sprites get the same scaling - RF2_STRETCHPIXELS = 0x0400, // don't apply SQUAREPIXELS for ROLLSPRITES + RF2_ISOMETRICSPRITES = 0x0080, + RF2_SQUAREPIXELS = 0x0100, // apply +ROLLSPRITE scaling math so that non rolling sprites get the same scaling + RF2_STRETCHPIXELS = 0x0200, // don't apply SQUAREPIXELS for ROLLSPRITES }; // This translucency value produces the closest match to Heretic's TINTTAB. diff --git a/src/playsim/p_effect.h b/src/playsim/p_effect.h index 4884739f2b8..735a87e819e 100644 --- a/src/playsim/p_effect.h +++ b/src/playsim/p_effect.h @@ -69,8 +69,7 @@ enum EParticleFlags SPF_FACECAMERA = 1 << 11, SPF_NOFACECAMERA = 1 << 12, SPF_ROLLCENTER = 1 << 13, - SPF_NOMIPMAP = 1 << 14, - SPF_STRETCHPIXELS = 1 << 15, + SPF_STRETCHPIXELS = 1 << 14, }; class DVisualThinker; diff --git a/src/r_data/gldefs.cpp b/src/r_data/gldefs.cpp index 9b5be0e25a3..d92b9daf68e 100644 --- a/src/r_data/gldefs.cpp +++ b/src/r_data/gldefs.cpp @@ -1270,6 +1270,7 @@ class GLDefsParser bool disable_fullbright_specified = false; bool thiswad = false; bool iwad = false; + bool no_mipmap = false; UserShaderDesc usershader; TArray texNameList; @@ -1319,6 +1320,10 @@ class GLDefsParser // only affects textures defined in the IWAD. iwad = true; } + else if (sc.Compare("nomipmap")) + { + no_mipmap = true; + } else if (sc.Compare("glossiness")) { sc.MustGetFloat(); @@ -1422,6 +1427,8 @@ class GLDefsParser if (!useme) return; } + tex->SetNoMipmap(no_mipmap); + FGameTexture **bindings[6] = { &mlay.Brightmap, @@ -1681,6 +1688,7 @@ class GLDefsParser bool disable_fullbright = false; bool thiswad = false; bool iwad = false; + bool no_mipmap = false; int maplump = -1; UserShaderDesc desc; desc.shaderType = SHADER_Default; @@ -1723,6 +1731,10 @@ class GLDefsParser if (!found) sc.ScriptError("Unknown material type '%s' specified\n", sc.String); } + else if (sc.Compare("nomipmap")) + { + no_mipmap = true; + } else if (sc.Compare("speed")) { sc.MustGetFloat(); @@ -1784,6 +1796,8 @@ class GLDefsParser return; } + tex->SetNoMipmap(no_mipmap); + int firstUserTexture; switch (desc.shaderType) { diff --git a/src/rendering/hwrenderer/scene/hw_drawstructs.h b/src/rendering/hwrenderer/scene/hw_drawstructs.h index b364128de4b..903806c67de 100644 --- a/src/rendering/hwrenderer/scene/hw_drawstructs.h +++ b/src/rendering/hwrenderer/scene/hw_drawstructs.h @@ -393,8 +393,6 @@ class HWSprite TArray *lightlist; DRotator Angles; - bool nomipmap; // force the sprite to have no mipmaps (ensures tiny sprites in the distance stay crisp) - void SplitSprite(HWDrawInfo *di, sector_t * frontsector, bool translucent); void PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight); bool CalculateVertices(HWDrawInfo *di, FVector3 *v, DVector3 *vp); diff --git a/src/rendering/hwrenderer/scene/hw_sprites.cpp b/src/rendering/hwrenderer/scene/hw_sprites.cpp index 91125b75047..cbca1a90d9f 100644 --- a/src/rendering/hwrenderer/scene/hw_sprites.cpp +++ b/src/rendering/hwrenderer/scene/hw_sprites.cpp @@ -224,7 +224,12 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent) state.SetFog(0, 0); } - int clampmode = nomipmap ? CLAMP_XY_NOMIP : CLAMP_XY; + int clampmode = CLAMP_XY; + + if (texture && texture->isNoMipmap()) + { + clampmode = CLAMP_XY_NOMIP; + } uint32_t spritetype = actor? uint32_t(actor->renderflags & RF_SPRITETYPEMASK) : 0; if (texture) state.SetMaterial(texture, UF_Sprite, (spritetype == RF_FACESPRITE) ? CTF_Expand : 0, clampmode, translation, OverrideShader); @@ -786,8 +791,6 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t return; } - nomipmap = (thing->renderflags2 & RF2_NOMIPMAP); - // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. if ((!r_debug_disable_vis_filter && !!(thing->RenderRequired & ~r_renderercaps)) || @@ -1420,7 +1423,6 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, particle_t *particle, sector_t *s actor = nullptr; this->particle = particle; fullbright = particle->flags & SPF_FULLBRIGHT; - nomipmap = particle->flags & SPF_NOMIPMAP; if (di->isFullbrightScene()) { diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index be7c299edd3..dc7fcacc307 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -383,7 +383,6 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(RF2, FLIPSPRITEOFFSETX, AActor, renderflags2), DEFINE_FLAG(RF2, FLIPSPRITEOFFSETY, AActor, renderflags2), DEFINE_FLAG(RF2, CAMFOLLOWSPLAYER, AActor, renderflags2), - DEFINE_FLAG(RF2, NOMIPMAP, AActor, renderflags2), DEFINE_FLAG(RF2, ISOMETRICSPRITES, AActor, renderflags2), DEFINE_FLAG(RF2, SQUAREPIXELS, AActor, renderflags2), diff --git a/wadsrc/static/zscript/constants.zs b/wadsrc/static/zscript/constants.zs index 7ab58204f3c..5fcebf6e153 100644 --- a/wadsrc/static/zscript/constants.zs +++ b/wadsrc/static/zscript/constants.zs @@ -722,8 +722,7 @@ enum EParticleFlags SPF_FACECAMERA = 1 << 11, SPF_NOFACECAMERA = 1 << 12, SPF_ROLLCENTER = 1 << 13, - SPF_NOMIPMAP = 1 << 14, - SPF_STRETCHPIXELS = 1 << 15, + SPF_STRETCHPIXELS = 1 << 14, SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG };