Convert shaders in dali-demo to use shader compilation tool
[platform/core/uifw/dali-demo.git] / examples / metaball-refrac / shaders / metaball-refraction.frag
1 // Fragment shader code for metaball and background composition with refraction effect
2
3 precision mediump float;
4 varying vec2 vTexCoord;
5 uniform sampler2D sTexture;
6 uniform sampler2D sEffect;
7
8 void main()
9 {
10   vec4 metaColor = texture2D(sEffect, vTexCoord);
11   vec2 zoomCoords;
12   float bright = 1.0;
13   if (metaColor.r > 0.85)
14   {
15     zoomCoords = ((vTexCoord - 0.5) * 0.95) + 0.5;
16   }
17   else if (metaColor.r > 0.78)
18   {
19     float interpolation = mix(0.95, 1.05, (0.85 - metaColor.r) * 50.0);
20     zoomCoords = ((vTexCoord - 0.5) * interpolation) + 0.5;
21     bright = 1.2;
22   }
23   else
24   {
25     zoomCoords = vTexCoord;
26   }
27
28   gl_FragColor = texture2D(sTexture, zoomCoords) * bright;
29 }