double-hit-balls/assets/ms_fragment_x16.txt
2018-04-11 16:40:22 +03:00

47 lines
2.3 KiB
Plaintext
Executable File

precision mediump float;
varying vec4 color;
varying vec3 position;
uniform vec4 lineParams0;
uniform vec4 lineParams1;
uniform vec4 lineParams2;
uniform vec4 lineParams3;
uniform vec4 lineParams4;
uniform vec4 lineParams5;
uniform vec4 lineParams6;
uniform vec4 lineParams7;
uniform vec4 lineParams8;
uniform vec4 lineParams9;
uniform vec4 lineParams10;
uniform vec4 lineParams11;
uniform vec4 lineParams12;
uniform vec4 lineParams13;
uniform vec4 lineParams14;
uniform vec4 lineParams15;
void main()
{
float distance = abs(lineParams0.x*position.x + lineParams0.y*position.y + lineParams0.z);
distance = min(distance, abs(lineParams1.x*position.x + lineParams1.y*position.y + lineParams1.z));
distance = min(distance, abs(lineParams2.x*position.x + lineParams2.y*position.y + lineParams2.z));
distance = min(distance, abs(lineParams3.x*position.x + lineParams3.y*position.y + lineParams3.z));
distance = min(distance, abs(lineParams4.x*position.x + lineParams4.y*position.y + lineParams4.z));
distance = min(distance, abs(lineParams5.x*position.x + lineParams5.y*position.y + lineParams5.z));
distance = min(distance, abs(lineParams6.x*position.x + lineParams6.y*position.y + lineParams6.z));
distance = min(distance, abs(lineParams7.x*position.x + lineParams7.y*position.y + lineParams7.z));
distance = min(distance, abs(lineParams8.x*position.x + lineParams8.y*position.y + lineParams8.z));
distance = min(distance, abs(lineParams9.x*position.x + lineParams9.y*position.y + lineParams9.z));
distance = min(distance, abs(lineParams10.x*position.x + lineParams10.y*position.y + lineParams10.z));
distance = min(distance, abs(lineParams11.x*position.x + lineParams11.y*position.y + lineParams11.z));
distance = min(distance, abs(lineParams12.x*position.x + lineParams12.y*position.y + lineParams12.z));
distance = min(distance, abs(lineParams13.x*position.x + lineParams13.y*position.y + lineParams13.z));
distance = min(distance, abs(lineParams14.x*position.x + lineParams14.y*position.y + lineParams14.z));
distance = min(distance, abs(lineParams15.x*position.x + lineParams15.y*position.y + lineParams15.z));
//gl_FragColor = vec4(color.rgb, color.a*clamp(1.2 / (distance + 1.0) - 0.5, 0.0, 1.0));
gl_FragColor = vec4(color.rgb*clamp(1.2 / (distance + 1.0) - 0.5, 0.0, 1.0), 1.0);
}