Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VertexShader VSBLUR
- {
- Source =
- """
- attribute highp vec3 a_position;
- attribute highp vec2 a_texCoord0;
- varying highp vec2 v_texCoord0;
- varying highp vec2 v_texCoord1;
- varying highp vec2 v_texCoord2;
- varying highp vec2 v_texCoord3;
- varying highp vec2 v_texCoord4;
- varying highp vec2 v_texCoord5;
- varying highp vec2 v_texCoord6;
- uniformbuffer FrameUniforms;
- uniformbuffer BasicMaterialUniforms;
- const vec2 futher = vec2(5.15); // Todo calculate?
- const vec2 mid = vec2(3.2307692308);
- const vec2 close = vec2(1.3846153846);
- highp vec2 transformTexCoord (highp vec2 texCoord)
- {
- return texCoord * u_texScaleOffset.xy + u_texScaleOffset.zw;
- }
- void main()
- {
- #if defined(HORIZONTAL)
- vec2 sizeAndDir = vec2(4.0, 0.0) / u_screenSize;
- #else
- vec2 sizeAndDir = vec2(0.0, 4.0) / u_screenSize;
- #endif
- vec2 c = futher * sizeAndDir;
- vec2 b = mid * sizeAndDir;
- vec2 a = close * sizeAndDir;
- vec2 uv = transformTexCoord(a_texCoord0);
- v_texCoord0 = uv - c;
- v_texCoord1 = uv - b;
- v_texCoord2 = uv - a;
- v_texCoord3 = uv;
- v_texCoord4 = uv + a;
- v_texCoord5 = uv + b;
- v_texCoord6 = uv + c;
- gl_Position = vec4(a_position, 1.0);
- }
- """
- }
- PixelShader PS
- {
- Source =
- """
- varying highp vec2 v_texCoord0;
- //resourcebuffer BackgroundResources;
- resourcebuffer BasicMaterialResources;
- void main()
- {
- gl_FragColor = texture2D(u_texture, v_texCoord0);
- }
- """
- }
- PixelShader BLUR
- {
- Source =
- """
- resourcebuffer BasicMaterialResources;
- varying highp vec2 v_texCoord0;
- varying highp vec2 v_texCoord1;
- varying highp vec2 v_texCoord2;
- varying highp vec2 v_texCoord3;
- varying highp vec2 v_texCoord4;
- varying highp vec2 v_texCoord5;
- varying highp vec2 v_texCoord6;
- #define center 0.2270270270
- #define close 0.2962162162
- #define far 0.0702702703
- #define further 0.0375000000 // Todo calculate?
- void main()
- {
- gl_FragColor.rgb = further * texture2D(u_texture, v_texCoord0).rgb
- + far * texture2D(u_texture, v_texCoord1).rgb
- + close * texture2D(u_texture, v_texCoord2).rgb
- + center * texture2D(u_texture, v_texCoord3).rgb
- + close * texture2D(u_texture, v_texCoord4).rgb
- + far * texture2D(u_texture, v_texCoord5).rgb
- + further * texture2D(u_texture, v_texCoord6).rgb;
- }
- """
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement