2011-02-17 17:44:52 +00:00
|
|
|
uniform sampler2D sampler;
|
2015-11-30 10:39:04 +00:00
|
|
|
uniform vec4 geometryColor;
|
2010-12-31 09:34:29 +00:00
|
|
|
uniform float u_opacity;
|
2010-12-31 09:53:12 +00:00
|
|
|
uniform int u_mirror;
|
2011-05-01 09:18:02 +00:00
|
|
|
uniform int u_untextured;
|
2010-12-31 09:34:29 +00:00
|
|
|
|
2015-11-30 10:39:04 +00:00
|
|
|
varying vec2 texcoord0;
|
2010-12-31 09:34:29 +00:00
|
|
|
|
2010-12-31 09:53:12 +00:00
|
|
|
vec2 mirrorTex(vec2 coords) {
|
|
|
|
vec2 mirrored = coords;
|
|
|
|
if (u_mirror != 0) {
|
|
|
|
mirrored.t = mirrored.t * (-1.0) + 1.0;
|
|
|
|
}
|
|
|
|
return mirrored;
|
|
|
|
}
|
|
|
|
|
2010-12-31 09:34:29 +00:00
|
|
|
void main() {
|
2015-11-30 10:39:04 +00:00
|
|
|
vec4 color = geometryColor;
|
|
|
|
vec2 texCoord = mirrorTex(texcoord0);
|
2011-02-17 17:44:52 +00:00
|
|
|
vec4 tex = texture2D(sampler, texCoord);
|
2010-12-31 09:53:12 +00:00
|
|
|
if (texCoord.s < 0.0 || texCoord.s > 1.0 ||
|
2011-05-01 09:18:02 +00:00
|
|
|
texCoord.t < 0.0 || texCoord.t > 1.0 || u_untextured != 0) {
|
2015-11-30 10:39:04 +00:00
|
|
|
tex = geometryColor;
|
2010-12-31 09:34:29 +00:00
|
|
|
}
|
|
|
|
color.rgb = tex.rgb*tex.a + color.rgb*(1.0-tex.a);
|
|
|
|
color.a = u_opacity;
|
|
|
|
|
|
|
|
gl_FragColor = color;
|
|
|
|
}
|