Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. uniform sampler2D     mpass_texture;
  2. uniform sampler2D     color_texture;
  3. uniform vec2          color_texture_pow2_sz; // pow2 tex size
  4. uniform vec4          vid_attributes;        // gamma, contrast, brightness
  5.  
  6. #define TEX2D(c) texture2D(mpass_texture,(c))
  7. #define PI 3.141592653589
  8.  
  9. void main()
  10. {
  11.     vec2 xy = gl_TexCoord[0].st;
  12.  
  13.     vec2 uv_ratio     = fract(xy*color_texture_pow2_sz);
  14.     vec2 one          = 1.0/color_texture_pow2_sz;
  15.  
  16.     vec4 col, col2;
  17.  
  18.     vec4 coeffs = vec4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x);
  19.     coeffs = (sin(PI * coeffs) * sin(PI * coeffs / 2.0)) / (coeffs * coeffs);
  20.     coeffs = coeffs / (coeffs.x+coeffs.y+coeffs.z+coeffs.w);
  21.  
  22.     col  = clamp(coeffs.x * TEX2D(xy + vec2(-one.x,0.0)) + coeffs.y * TEX2D(xy) + coeffs.z * TEX2D(xy + vec2(one.x, 0.0)) + coeffs.w * TEX2D(xy + vec2(2 * one.x, 0.0)),0.0,1.0);
  23.  
  24.     gl_FragColor = col;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement