Doodle Post
No Comments
for (var i = 0; i < 99; i++) {
var size = Rand.Int(8, 64);
planetSupply -= size;
if (planetSupply <= 0) {
size = 8;
}
var x = Rand.Float(Width);
var y = Rand.Float(Height);
var d = new Destination(x, y, size);
Add(d);
while (d.CloseToOtherDestination()) {
d.X = Rand.Float(Width);
d.Y = Rand.Float(Height);
}
}
#version 130
uniform sampler2D texture;
uniform sampler2D palette;
uniform float shift;
uniform float offset;
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
void main() {
vec2 pixpos = gl_TexCoord[0].xy;
vec4 pixcol = texture2D(texture, pixpos);
float gray = (pixcol.r + pixcol.g + pixcol.b) / 3;
gray = round(gray / 0.25) * 0.25;
gray += (rand(pixpos + offset) * 2 - 1) * 0.03;
pixcol = texture2D(palette, vec2(gray, shift));
gl_FragColor = pixcol * gl_Color;
}