2016-09-29 02:24:14 +00:00
|
|
|
#version 120
|
2016-09-30 19:24:06 +00:00
|
|
|
varying vec2 vertex;
|
|
|
|
varying vec3 velocity;
|
2016-09-30 18:19:10 +00:00
|
|
|
varying float decay;
|
|
|
|
|
2016-09-30 19:24:06 +00:00
|
|
|
varying float explCenterDist;
|
|
|
|
uniform vec3 explCenter;
|
|
|
|
|
2016-09-30 18:19:10 +00:00
|
|
|
vec3 hsv2rgb(vec3 c)
|
|
|
|
{
|
|
|
|
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
|
|
|
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
|
|
|
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
|
|
|
}
|
|
|
|
|
2016-09-29 02:24:14 +00:00
|
|
|
void main()
|
|
|
|
{
|
2016-09-30 18:19:10 +00:00
|
|
|
gl_FragColor = vec4(0.5+0.5*vertex.x, 0.5+0.5*vertex.y, 0.0, 1.0);
|
|
|
|
float r = length(vertex);
|
|
|
|
if (r > 1.0) {
|
|
|
|
discard;
|
2016-09-29 02:24:14 +00:00
|
|
|
}
|
2016-09-30 19:24:06 +00:00
|
|
|
|
2016-09-30 19:48:15 +00:00
|
|
|
float d = decay/(1.0+max(0.0, 1.0-2.0*explCenterDist));
|
2016-09-30 18:19:10 +00:00
|
|
|
float h = (1.0-d)/6.0;
|
2016-09-30 19:24:06 +00:00
|
|
|
float v = max(0.0, (1.0-log(d)));
|
2016-09-30 19:48:15 +00:00
|
|
|
float s = max(0.0, min(30.0 * sqrt(decay) * explCenterDist, 1.0));
|
2016-09-30 19:24:06 +00:00
|
|
|
|
|
|
|
//v /= decay * 10.0*length(vertex-explCenter);
|
|
|
|
//v /= 1.0+2.0*length(vertex-explCenter);
|
2016-09-30 19:48:15 +00:00
|
|
|
//v /= 1.0 + max(0.0, min(35.0*(decay-0.2), 1.0)) + 10.0 * explCenterDist;
|
|
|
|
v /= 1.0 + 10.0 * explCenterDist;
|
2016-09-30 19:24:06 +00:00
|
|
|
|
2016-09-30 18:19:10 +00:00
|
|
|
gl_FragColor = vec4(hsv2rgb(vec3(h, s, v)), 1.0);
|
|
|
|
|
|
|
|
//gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
|
2016-09-29 10:28:35 +00:00
|
|
|
}
|