aboutsummaryrefslogtreecommitdiffstats
path: root/src/ru/olamedia/asset/shader/block.fp
blob: 291e97535787333123b6fd7dfd9c22a82dca5e5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28


smooth in vec2 texCoord;
//vec4 frontColor;

uniform sampler2D mesh_ActiveTexture;

vec4 frontColor = vec4(1.0);
const vec4 texEnvColor = vec4(0.0);

const vec4 zerov4 = vec4(0.0);
const vec4 onev4 = vec4(1.0);

vec4 calcTexColor(in vec4 color, in vec4 texColor) {
    color.rgb = mix(color.rgb, texEnvColor.rgb, texColor.rgb);
    color.a *= texColor.a;
    color = clamp(color, zerov4, onev4);
    return color;
}

void main (void)
{
	vec4 texColor;
    texColor = texture2D(mesh_ActiveTexture, texCoord.st);
    if (texColor.a < 0.1f) discard;
	vec4 color = calcTexColor(frontColor, texColor);
    gl_FragColor = vec4(gl_FragColor.a) * gl_FragColor + vec4(1.0 - gl_FragColor.a) * texColor;
}