mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 13:31:37 +00:00
Move no-mipmapping from actor renderflag/particle flag, to a material property in GLDEFS, where it makes more sense. The feature was introduced in the short-lived engine version of 4.13 which was deemed too broken and needed to be replaced with a newer version anyway, so might as well perform an API-breaking change at this point in time. Note that this currently only works for sprites (its primary targeted use case) -- walls, flats and models can be patched in later.
This commit is contained in:
parent
5fb83d4762
commit
a45bf49616
8 changed files with 29 additions and 15 deletions
|
@ -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 @@ public:
|
|||
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)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1270,6 +1270,7 @@ class GLDefsParser
|
|||
bool disable_fullbright_specified = false;
|
||||
bool thiswad = false;
|
||||
bool iwad = false;
|
||||
bool no_mipmap = false;
|
||||
|
||||
UserShaderDesc usershader;
|
||||
TArray<FString> 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)
|
||||
{
|
||||
|
|
|
@ -393,8 +393,6 @@ public:
|
|||
TArray<lightlist_t> *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);
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -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),
|
||||
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue