~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kwin/effects/lookingglass/data/lookingglass.frag

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
uniform sampler2D sampler;
 
2
uniform vec2 u_cursor;
 
3
uniform float u_zoom;
 
4
uniform float u_radius;
 
5
uniform vec2 u_textureSize;
 
6
 
 
7
varying vec2 varyingTexCoords;
 
8
 
 
9
#define PI 3.14159
 
10
 
 
11
void main()
 
12
{
 
13
    vec2 d = u_cursor - varyingTexCoords;
 
14
    float dist = sqrt(d.x*d.x + d.y*d.y);
 
15
    vec2 texcoord = varyingTexCoords;
 
16
    if (dist < u_radius) {
 
17
        float disp = sin(dist / u_radius * PI) * (u_zoom - 1.0) * 20.0;
 
18
        texcoord += d / dist * disp;
 
19
    }
 
20
 
 
21
    texcoord = texcoord/u_textureSize;
 
22
    texcoord.t = 1.0 - texcoord.t;
 
23
    gl_FragColor = texture2D(sampler, texcoord);
 
24
}
 
25