2018-09-19 22:24:52 +03:00
|
|
|
$input v_texcoord0
|
|
|
|
|
2018-09-21 01:49:56 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2018 Eric Arnebäck. All rights reserved.
|
|
|
|
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
|
|
*/
|
|
|
|
|
2018-09-19 22:24:52 +03:00
|
|
|
#include "../common/common.sh"
|
|
|
|
|
|
|
|
SAMPLER2D(s_tex, 0);
|
|
|
|
|
|
|
|
uniform vec4 u_pixelSize;
|
|
|
|
uniform vec4 u_intensity;
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2018-09-21 08:48:07 +03:00
|
|
|
vec2 halfpixel = u_pixelSize.xy;
|
|
|
|
vec2 uv = v_texcoord0.xy;
|
2018-09-21 01:49:56 +03:00
|
|
|
|
2018-09-21 08:48:07 +03:00
|
|
|
vec4 sum = vec4_splat(0.0);
|
2018-09-21 01:49:56 +03:00
|
|
|
|
2018-09-21 08:48:07 +03:00
|
|
|
sum += (2.0 / 16.0) * texture2D(s_tex, uv + vec2(-halfpixel.x, 0.0) );
|
|
|
|
sum += (2.0 / 16.0) * texture2D(s_tex, uv + vec2( 0.0, halfpixel.y) );
|
|
|
|
sum += (2.0 / 16.0) * texture2D(s_tex, uv + vec2( halfpixel.x, 0.0) );
|
|
|
|
sum += (2.0 / 16.0) * texture2D(s_tex, uv + vec2( 0.0, -halfpixel.y) );
|
2018-09-21 01:49:56 +03:00
|
|
|
|
2018-09-21 08:48:07 +03:00
|
|
|
sum += (1.0 / 16.0) * texture2D(s_tex, uv + vec2(-halfpixel.x, -halfpixel.y) );
|
|
|
|
sum += (1.0 / 16.0) * texture2D(s_tex, uv + vec2(-halfpixel.x, halfpixel.y) );
|
|
|
|
sum += (1.0 / 16.0) * texture2D(s_tex, uv + vec2( halfpixel.x, -halfpixel.y) );
|
|
|
|
sum += (1.0 / 16.0) * texture2D(s_tex, uv + vec2( halfpixel.x, halfpixel.y) );
|
2018-09-19 22:24:52 +03:00
|
|
|
|
2018-09-21 08:48:07 +03:00
|
|
|
sum += (4.0 / 16.0) * texture2D(s_tex, uv);
|
2018-09-21 01:49:56 +03:00
|
|
|
|
2018-09-21 08:48:07 +03:00
|
|
|
gl_FragColor = u_intensity.x * sum;
|
2018-09-19 22:24:52 +03:00
|
|
|
}
|