2013-03-28 02:04:40 +00:00
|
|
|
varying vec2 xy;
|
|
|
|
uniform vec4 blobs[10];
|
|
|
|
|
|
|
|
float doBlob(vec4 blob) {
|
|
|
|
vec2 s = pow(blob.xy - xy, vec2(2.0, 2.0));
|
|
|
|
return 1.0 / ((s.x / blob.z) + (s.y / blob.w));
|
|
|
|
}
|
|
|
|
void main() {
|
|
|
|
float v = 0.0;
|
|
|
|
for (int i = 0; i < 10; i ++) {
|
|
|
|
v += doBlob(blobs[i]/*vec4(0.3, 0.3, 0.1, 0.1)*/);
|
|
|
|
}
|
|
|
|
float celledge = min(fract(xy.x), fract(xy.y));
|
|
|
|
float majorxy = (fract(xy.x) < fract(xy.y)) ? xy.x : xy.y;
|
|
|
|
float cell = (mod(abs(floor(majorxy)), 2.0) + 1.0) / 2.0;
|
|
|
|
|
|
|
|
gl_FragColor = v > 0.32 ? vec4(1.0, 1.0, 1.0, 1.0) :
|
|
|
|
(v > 0.3 ? vec4(v, v, v, 1.0) :
|
|
|
|
(celledge < 0.01 ? vec4(cell, cell, cell, 1.0)
|
|
|
|
: vec4(0.0, 0.0, 0.0, 0.0)));
|
2013-03-27 03:56:27 +00:00
|
|
|
}
|