Defs: Add token "forcefilter" to textures, skyboxes, and model skins. It forces the use of GL filtering for the resource in question.

git-svn-id: https://svn.eduke32.com/eduke32@5108 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-03-28 09:49:37 +00:00
parent 8282a7e846
commit 75801f2e68
7 changed files with 35 additions and 20 deletions

View file

@ -1260,6 +1260,12 @@ void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype);
extern int32_t glanisotropy;
extern int32_t glusetexcompr;
extern int32_t gltexfiltermode;
enum {
TEXFILTER_OFF = 2, // GL_NEAREST_MIPMAP_NEAREST
TEXFILTER_ON = 5, // GL_LINEAR_MIPMAP_LINEAR
};
extern int32_t glredbluemode;
extern int32_t glusetexcache, glusememcache;
extern int32_t glmultisample, glnvmultisamplehint;

View file

@ -75,6 +75,7 @@ enum
enum
{
HICR_NOSAVE = 1,
HICR_FORCEFILTER = 2,
HICR_NOCOMPRESS = 16,
};

View file

@ -166,6 +166,7 @@ enum {
PTH_HASALPHA = 8,
PTH_HASFULLBRIGHT = 16,
PTH_NPOTWALL = DAMETH_WALL, // r_npotwallmode=1 generated texture
PTH_FORCEFILTER = 64,
PTH_INVALIDATED = 128,
};

View file

@ -76,6 +76,7 @@ enum scripttoken_t
T_NOFLOORPAL,
T_RED,T_GREEN,T_BLUE,
T_TEXTURE,T_ALPHACUT,T_XSCALE,T_YSCALE,T_SPECPOWER,T_SPECFACTOR,T_NOCOMPRESS,T_NODOWNSIZE,
T_FORCEFILTER,
T_ORIGSIZEX,T_ORIGSIZEY,
T_UNDEFMODEL,T_UNDEFMODELRANGE,T_UNDEFMODELOF,T_UNDEFTEXTURE,T_UNDEFTEXTURERANGE,
T_ALPHAHACK,T_ALPHAHACKRANGE,
@ -1212,6 +1213,7 @@ static int32_t defsparser(scriptfile *script)
{ "specfactor", T_SPECFACTOR }, { "specularfactor", T_SPECFACTOR }, { "parallaxbias", T_SPECFACTOR },
{ "nocompress", T_NOCOMPRESS },
{ "nodownsize", T_NODOWNSIZE },
{ "forcefilter", T_FORCEFILTER },
};
if (scriptfile_getbraces(script,&skinend)) break;
@ -1236,6 +1238,8 @@ static int32_t defsparser(scriptfile *script)
flags |= HICR_NOSAVE; break;
case T_NODOWNSIZE:
flags |= HICR_NOCOMPRESS; break;
case T_FORCEFILTER:
flags |= HICR_FORCEFILTER; break;
#endif
}
}
@ -1540,6 +1544,7 @@ static int32_t defsparser(scriptfile *script)
{ "dn" ,T_BOTTOM },{ "bottom" ,T_BOTTOM },{ "floor" ,T_BOTTOM },{ "down" ,T_BOTTOM },
{ "nocompress", T_NOCOMPRESS },
{ "nodownsize", T_NODOWNSIZE },
{ "forcefilter", T_FORCEFILTER },
};
if (scriptfile_getbraces(script,&modelend)) break;
@ -1569,6 +1574,8 @@ static int32_t defsparser(scriptfile *script)
flags |= HICR_NOSAVE; break;
case T_NODOWNSIZE:
flags |= HICR_NOCOMPRESS; break;
case T_FORCEFILTER:
flags |= HICR_FORCEFILTER; break;
#endif
}
}
@ -1878,6 +1885,7 @@ static int32_t defsparser(scriptfile *script)
{ "specfactor", T_SPECFACTOR }, { "specularfactor", T_SPECFACTOR }, { "parallaxbias", T_SPECFACTOR },
{ "nocompress", T_NOCOMPRESS },
{ "nodownsize", T_NODOWNSIZE },
{ "forcefilter", T_FORCEFILTER },
{ "orig_sizex", T_ORIGSIZEX }, { "orig_sizey", T_ORIGSIZEY }
};
@ -1904,6 +1912,8 @@ static int32_t defsparser(scriptfile *script)
flags |= HICR_NOSAVE; break;
case T_NODOWNSIZE:
flags |= HICR_NOCOMPRESS; break;
case T_FORCEFILTER:
flags |= HICR_FORCEFILTER; break;
#endif
case T_ORIGSIZEX:
scriptfile_getnumber(script, &xsiz);
@ -1967,6 +1977,7 @@ static int32_t defsparser(scriptfile *script)
{ "specfactor", T_SPECFACTOR }, { "specularfactor", T_SPECFACTOR }, { "parallaxbias", T_SPECFACTOR },
{ "nocompress", T_NOCOMPRESS },
{ "nodownsize", T_NODOWNSIZE },
{ "forcefilter", T_FORCEFILTER },
};
if (EDUKE32_PREDICT_FALSE(scriptfile_getbraces(script,&detailend))) break;
@ -1989,6 +2000,8 @@ static int32_t defsparser(scriptfile *script)
flags |= HICR_NOSAVE; break;
case T_NODOWNSIZE:
flags |= HICR_NOCOMPRESS; break;
case T_FORCEFILTER:
flags |= HICR_FORCEFILTER; break;
#endif
default:
break;

View file

@ -879,8 +879,10 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
m->skinloaded = 1+number;
}
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[gltexfiltermode].mag);
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[gltexfiltermode].min);
int32_t const filter = sk->flags & HICR_FORCEFILTER ? TEXFILTER_ON : gltexfiltermode;
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[filter].mag);
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[filter].min);
#ifndef EDUKE32_GLES
if (glinfo.maxanisotropy > 1.0)
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy);

View file

@ -92,7 +92,7 @@ struct glfiltermodes glfiltermodes[NUMGLFILTERMODES] =
};
int32_t glanisotropy = 1; // 0 = maximum supported by card
int32_t gltexfiltermode = 2; // GL_NEAREST_MIPMAP_NEAREST
int32_t gltexfiltermode = TEXFILTER_OFF;
#ifdef EDUKE32_GLES
int32_t glusetexcompr = 0;
@ -241,17 +241,12 @@ void gltexapplyprops(void)
{
for (pthtyp *pth=texcache.list[i]; pth; pth=pth->next)
{
#ifndef EDUKE32_TOUCH_DEVICES
bind_2d_texture(pth->glpic, -1);
int32_t const filter = pth->flags & PTH_FORCEFILTER ? TEXFILTER_ON : -1;
bind_2d_texture(pth->glpic, filter);
if (r_fullbrights && pth->flags & PTH_HASFULLBRIGHT)
bind_2d_texture(pth->ofb->glpic, -1);
#else
bind_2d_texture(pth->glpic, pth->flags & PTH_HIGHTILE ? 5 : -1);
if (r_fullbrights && pth->flags & PTH_HASFULLBRIGHT)
bind_2d_texture(pth->ofb->glpic, pth->flags & PTH_HIGHTILE ? 5 : -1);
#endif
bind_2d_texture(pth->ofb->glpic, filter);
}
}
@ -274,7 +269,7 @@ void gltexapplyprops(void)
{
if (!sk->texid[j])
continue;
bind_2d_texture(sk->texid[j], -1);
bind_2d_texture(sk->texid[j], sk->flags & HICR_FORCEFILTER ? TEXFILTER_ON : -1);
}
}
}
@ -1171,11 +1166,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
pth->scale.y = (float)tsiz.y / (float)tilesiz[dapic].y;
}
#ifdef EDUKE32_TOUCH_DEVICES
polymost_setuptexture(dameth, 5);
#else
polymost_setuptexture(dameth, -1);
#endif
polymost_setuptexture(dameth, hicr->flags & HICR_FORCEFILTER ? TEXFILTER_ON : -1);
DO_FREE_AND_NULL(pic);
@ -1184,7 +1175,8 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
pth->picnum = dapic;
pth->effects = effect;
pth->flags = TO_PTH_CLAMPED(dameth) | PTH_HIGHTILE | ((facen>0) * PTH_SKYBOX) | ((hasalpha != 255) ? PTH_HASALPHA : 0);
pth->flags = TO_PTH_CLAMPED(dameth) | PTH_HIGHTILE | ((facen>0) * PTH_SKYBOX) | ((hasalpha != 255) ? PTH_HASALPHA : 0) |
(hicr->flags & HICR_FORCEFILTER ? PTH_FORCEFILTER : 0);
pth->skyface = facen;
pth->hicr = hicr;

View file

@ -2660,7 +2660,7 @@ static int32_t M_MenuEntryOptionModify(MenuEntry_t *entry, int32_t newOption)
#ifdef USE_OPENGL
else if (entry == &ME_DISPLAYSETUP_TEXFILTER)
{
gltexfiltermode = newOption ? 5 : 2;
gltexfiltermode = newOption ? TEXFILTER_ON : TEXFILTER_OFF;
gltexapplyprops();
}
else if (entry == &ME_DISPLAYSETUP_ASPECTRATIO)