double-hit-balls/assets/ms_fragment.txt

16 lines
348 B
Plaintext
Raw Normal View History

2018-01-14 00:17:27 +00:00
precision mediump float;
varying vec4 color;
varying vec3 position;
uniform vec4 lineParams;
void main()
{
float a = lineParams.x;
float b = lineParams.y;
float c = lineParams.z;
float distance = abs(a*position.x + b*position.y + c);
gl_FragColor = vec4(color.rgb, color.a*clamp(1.2 / (distance + 1.0) - 0.5, 0.0, 1.0));
}