precision mediump float;

uniform sampler2D texture;
uniform vec4 blurAmount;
uniform float fSinTime0_X;

varying vec2 uv;
varying vec4 color;

void main()
{
   int i;
   vec4 tmpOutColor;
   float  diffuseGlowFactor;
   vec2 offsets[4];


   offsets[0] = vec2(-1.8,  -1.8);
   offsets[1] = vec2(-1.8,  1.8);
   offsets[2] = vec2(1.8, -1.8);
   offsets[3] = vec2(1.8, 1.8);

   tmpOutColor = texture2D( texture, uv );   

   
   diffuseGlowFactor = 0.0113 * (2.0 - max( tmpOutColor.r, tmpOutColor.g ));

   
   for (i = 0; i < 4; i++) {
      tmpOutColor += color * texture2D( texture, uv + fSinTime0_X * blurAmount.x * diffuseGlowFactor * offsets[i] );
   }

   tmpOutColor *= vec4(0.25, 0.25, 0.25, 1.0);

   
   gl_FragColor = tmpOutColor;
}
