2016-07-19 18:40:10 +02:00
|
|
|
layout(std140) uniform State
|
|
|
|
{
|
|
|
|
int u_alphaTest;
|
|
|
|
float u_alphaRef;
|
|
|
|
|
|
|
|
float u_fogStart;
|
|
|
|
float u_fogEnd;
|
2020-04-26 19:33:43 +02:00
|
|
|
float u_fogRange;
|
|
|
|
float u_fogDisable;
|
2016-07-19 18:40:10 +02:00
|
|
|
vec4 u_fogColor;
|
|
|
|
};
|
|
|
|
|
2020-04-26 19:33:43 +02:00
|
|
|
uniform sampler2D tex0;
|
2016-07-19 18:40:10 +02:00
|
|
|
|
|
|
|
in vec4 v_color;
|
|
|
|
in vec2 v_tex0;
|
|
|
|
in float v_fog;
|
|
|
|
|
|
|
|
out vec4 color;
|
|
|
|
|
|
|
|
void
|
|
|
|
main(void)
|
|
|
|
{
|
2020-04-26 19:33:43 +02:00
|
|
|
color = v_color*texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
|
|
|
|
color.rgb = mix(u_fogColor.rgb, color.rgb, v_fog);
|
2016-07-19 18:40:10 +02:00
|
|
|
switch(u_alphaTest){
|
|
|
|
default:
|
|
|
|
case 0: break;
|
|
|
|
case 1:
|
|
|
|
if(color.a < u_alphaRef)
|
|
|
|
discard;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if(color.a >= u_alphaRef)
|
|
|
|
discard;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|