do not assume alpha test works (because it does not in gles2 / core).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4300 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-04-08 03:51:21 +00:00
parent 1d3f52ac87
commit 20a338b0f6
5 changed files with 19 additions and 5 deletions

View file

@ -2383,7 +2383,7 @@ static void BE_SendPassBlendDepthMask(unsigned int sbits)
}
#ifdef GL_ALPHA_TEST //alpha test doesn't exist in gles2
if (delta & SBITS_ATEST_BITS)
if ((delta & SBITS_ATEST_BITS) && !gl_config.nofixedfunc)
{
switch (sbits & SBITS_ATEST_BITS)
{

View file

@ -4383,7 +4383,11 @@ void * RMod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum,
Q_strncatz(name, va("_%i.tga", framenum), sizeof(name));
pspriteframe->shader = R_RegisterShader(name,
"{\n"
"if gl_blendsprites\n"
"program defaultsprite\n"
"else\n"
"program defaultsprite#MASK=1\n"
"endif\n"
"{\n"
"map $diffuse\n"
"alphafunc ge128\n"

View file

@ -860,7 +860,12 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"uniform vec4 e_colourident;\n"
"void main ()\n"
"{\n"
"gl_FragColor = fog4blend(texture2D(s_t0, tc) * vc * e_colourident);\n"
"vec4 col = texture2D(s_t0, tc);\n"
"#ifdef MASK\n"
"if (col.a < 0.5)\n"
"discard;\n"
"#endif\n"
"gl_FragColor = fog4blend(col * vc * e_colourident);\n"
"}\n"
"#endif\n"
},

View file

@ -529,7 +529,7 @@ char *PR_ValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
}
break;
case ev_field:
fielddef = ED_FieldAtOfs (progfuncs, val->_int );
fielddef = ED_FieldAtOfs (progfuncs, val->_int + progfuncs->funcs.fieldadjust);
if (!fielddef)
sprintf (line, ".??? (%i)", val->_int);
else

View file

@ -22,6 +22,11 @@ varying vec4 vc;
uniform vec4 e_colourident;
void main ()
{
gl_FragColor = fog4blend(texture2D(s_t0, tc) * vc * e_colourident);
vec4 col = texture2D(s_t0, tc);
#ifdef MASK
if (col.a < 0.5)
discard;
#endif
gl_FragColor = fog4blend(col * vc * e_colourident);
}
#endif