2013-05-21 08:56:10 +00:00
|
|
|
#version 140
|
2011-02-17 17:44:52 +00:00
|
|
|
uniform sampler2D sampler;
|
2011-01-06 16:18:27 +00:00
|
|
|
uniform vec2 u_cursor;
|
|
|
|
uniform float u_zoom;
|
|
|
|
uniform float u_radius;
|
|
|
|
uniform vec2 u_textureSize;
|
2007-07-13 13:22:09 +00:00
|
|
|
|
2015-11-30 15:32:29 +00:00
|
|
|
in vec2 texcoord0;
|
2013-05-21 08:56:10 +00:00
|
|
|
|
|
|
|
out vec4 fragColor;
|
2007-07-13 13:22:09 +00:00
|
|
|
|
2011-01-06 16:18:27 +00:00
|
|
|
#define PI 3.14159
|
2007-07-13 13:22:09 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2015-11-30 15:32:29 +00:00
|
|
|
vec2 d = u_cursor - texcoord0;
|
2011-01-06 16:18:27 +00:00
|
|
|
float dist = sqrt(d.x*d.x + d.y*d.y);
|
2015-11-30 15:32:29 +00:00
|
|
|
vec2 texcoord = texcoord0;
|
2011-01-06 16:18:27 +00:00
|
|
|
if (dist < u_radius) {
|
|
|
|
float disp = sin(dist / u_radius * PI) * (u_zoom - 1.0) * 20.0;
|
|
|
|
texcoord += d / dist * disp;
|
2007-07-13 13:22:09 +00:00
|
|
|
}
|
|
|
|
|
2011-01-06 16:18:27 +00:00
|
|
|
texcoord = texcoord/u_textureSize;
|
|
|
|
texcoord.t = 1.0 - texcoord.t;
|
2013-05-21 08:56:10 +00:00
|
|
|
fragColor = texture(sampler, texcoord);
|
2007-07-13 13:22:09 +00:00
|
|
|
}
|
|
|
|
|