diff --git a/src/playsim/a_dynlight.cpp b/src/playsim/a_dynlight.cpp index 98d105acb..b274d63c6 100644 --- a/src/playsim/a_dynlight.cpp +++ b/src/playsim/a_dynlight.cpp @@ -256,7 +256,7 @@ void FDynamicLight::Tick() if (owned) { - if (!target->state) + if (!target->state || !target->ShouldRenderLocally()) { Deactivate(); return; diff --git a/src/playsim/actor.h b/src/playsim/actor.h index b51cee366..ca7c1d7f9 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -501,6 +501,7 @@ 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 }; // This translucency value produces the closest match to Heretic's TINTTAB. diff --git a/src/playsim/dthinker.cpp b/src/playsim/dthinker.cpp index 3214decf3..4229de792 100644 --- a/src/playsim/dthinker.cpp +++ b/src/playsim/dthinker.cpp @@ -132,7 +132,7 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level) if (dolights) ac->SetDynamicLights(); } // This was merged from P_RunEffects to eliminate the costly duplicate ThinkerIterator loop. - if ((ac->effects || ac->fountaincolor) && !Level->isFrozen()) + if ((ac->effects || ac->fountaincolor) && ac->ShouldRenderLocally() && !Level->isFrozen()) { P_RunEffect(ac, ac->effects); } diff --git a/src/playsim/p_effect.h b/src/playsim/p_effect.h index 29f1cb720..5eafdcd4b 100644 --- a/src/playsim/p_effect.h +++ b/src/playsim/p_effect.h @@ -69,6 +69,7 @@ enum EParticleFlags SPF_FACECAMERA = 1 << 11, SPF_NOFACECAMERA = 1 << 12, SPF_ROLLCENTER = 1 << 13, + SPF_NOMIPMAP = 1 << 14, }; class DVisualThinker; diff --git a/src/rendering/hwrenderer/scene/hw_drawstructs.h b/src/rendering/hwrenderer/scene/hw_drawstructs.h index 00706f81e..fa0f098ea 100644 --- a/src/rendering/hwrenderer/scene/hw_drawstructs.h +++ b/src/rendering/hwrenderer/scene/hw_drawstructs.h @@ -411,6 +411,7 @@ public: 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, FRenderState& state, sector_t * frontsector, bool translucent); void PerformSpriteClipAdjustment(AActor *thing, const DVector2 &thingpos, float spriteheight); diff --git a/src/rendering/hwrenderer/scene/hw_sprites.cpp b/src/rendering/hwrenderer/scene/hw_sprites.cpp index 68ea7bf7e..3f84c6982 100644 --- a/src/rendering/hwrenderer/scene/hw_sprites.cpp +++ b/src/rendering/hwrenderer/scene/hw_sprites.cpp @@ -224,8 +224,10 @@ void HWSprite::DrawSprite(HWDrawInfo *di, FRenderState &state, bool translucent) state.SetFog(0, 0); } + int clampmode = nomipmap ? CLAMP_XY_NOMIP : CLAMP_XY; + uint32_t spritetype = actor? uint32_t(actor->renderflags & RF_SPRITETYPEMASK) : 0; - if (texture) state.SetMaterial(texture, UF_Sprite, (spritetype == RF_FACESPRITE) ? CTF_Expand : 0, CLAMP_XY, translation, OverrideShader); + if (texture) state.SetMaterial(texture, UF_Sprite, (spritetype == RF_FACESPRITE) ? CTF_Expand : 0, clampmode, translation, OverrideShader); else if (!modelframe) state.EnableTexture(false); //SetColor(lightlevel, rel, Colormap, trans); @@ -834,6 +836,8 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto 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)) || @@ -1377,6 +1381,7 @@ void HWSprite::ProcessParticle(HWDrawInfo *di, FRenderState& state, particle_t * 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 997ab78b1..570dd2a4e 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -384,6 +384,7 @@ 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), // Bounce flags DEFINE_FLAG2(BOUNCE_Walls, BOUNCEONWALLS, AActor, BounceFlags), diff --git a/wadsrc/static/zscript/constants.zs b/wadsrc/static/zscript/constants.zs index 38481ba55..38bf37a65 100644 --- a/wadsrc/static/zscript/constants.zs +++ b/wadsrc/static/zscript/constants.zs @@ -718,6 +718,7 @@ enum EParticleFlags SPF_FACECAMERA = 1 << 11, SPF_NOFACECAMERA = 1 << 12, SPF_ROLLCENTER = 1 << 13, + SPF_NOMIPMAP = 1 << 14, SPF_RELATIVE = SPF_RELPOS|SPF_RELVEL|SPF_RELACCEL|SPF_RELANG };