Skip to content
Snippets Groups Projects
Commit f2aee5b2 authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@5409 51575b47-30f0-44d4-a5cc-537603b46e54
parent 8a8e1d73
No related branches found
No related tags found
No related merge requests found
......@@ -2,36 +2,36 @@ uniform sampler2D tex;
uniform float tick;
uniform vec2 mapCoord;
uniform vec2 texSize;
uniform vec4 displayColor;
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
void main(void)
{
vec2 uv = gl_TexCoord[0].xy;
vec2 r = vec2(rand(mapCoord / texSize));
vec4 c = texture2D(tex, uv);
int blursize = 2;
vec2 offset = 1.0/texSize;
int blursize = 2;
vec2 offset = 1.0/texSize;
// Center Pixel
vec4 sample = vec4(0.0,0.0,0.0,0.0);
float factor = ((float(blursize)*2.0)+1.0);
factor = factor*factor;
// Center Pixel
vec4 sample = vec4(0.0,0.0,0.0,0.0);
float factor = ((float(blursize)*2.0)+1.0);
factor = factor*factor;
for(int i = -blursize; i <= blursize; i++)
for(int i = -blursize; i <= blursize; i++)
{
for(int j = -blursize; j <= blursize; j++)
{
for(int j = -blursize; j <= blursize; j++)
{
sample += texture2D(tex, vec2(gl_TexCoord[0].xy+vec2(float(i)*offset.x, float(j)*offset.y)));
}
sample += texture2D(tex, vec2(gl_TexCoord[0].xy+vec2(float(i)*offset.x, float(j)*offset.y)));
}
sample /= (float(blursize)*2.0) * (float(blursize)*2.0);
c = sample;
}
sample /= (float(blursize)*2.0) * (float(blursize)*2.0);
sample *= displayColor;
c.a *= 0.3 + (((1 + r.x * sin(tick / 1000 + mapCoord.y)) / 2) * ((1 + r.y * cos(tick / 1000 + mapCoord.x)) / 2)) * 0.7;
gl_FragColor = c;
sample.a *= 0.3 + (((1 + r.x * sin(tick / 500 + mapCoord.y)) / 2) * ((1 + r.y * cos(tick / 500 + mapCoord.x)) / 2)) * 0.7;
gl_FragColor = sample;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment