precision highp float;

varying vec2 resultCoord0;
varying vec2 resultCoord1;

// kawase blur
uniform sampler2D textureBack;
uniform sampler2D textureFore;
uniform sampler2D textureMask;


uniform float  alpha;
uniform vec3 colorMultiply;
uniform float  maskTransitionVague;
uniform float  maskTransitionStep;

uniform float  offset;
uniform float  size;


void main()
{
	vec4 fore = texture2D(textureFore, resultCoord1);
	vec4 mask = texture2D(textureMask, resultCoord1);
	float mask_a = 1.0;
	fore.r = 0.0;
	fore.g = 0.0;
	fore.b = 0.0;

	fore += texture2D(textureFore, resultCoord1 + (vec2( offset,  offset) * size)) * 0.25;
	fore += texture2D(textureFore, resultCoord1 + (vec2(-offset,  offset) * size)) * 0.25;
	fore += texture2D(textureFore, resultCoord1 + (vec2(-offset, -offset) * size)) * 0.25;
	fore += texture2D(textureFore, resultCoord1 + (vec2( offset, -offset) * size)) * 0.25;

	fore.a *= mask_a * alpha;

	gl_FragColor = fore;
}

