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

spiffier

git-svn-id: http://svn.net-core.org/repos/t-engine4@5408 51575b47-30f0-44d4-a5cc-537603b46e54
parent fffcfef2
No related branches found
No related tags found
No related merge requests found
#extension GL_EXT_gpu_shader4: enable
uniform sampler2D tex;
uniform float tick;
uniform vec2 mapCoord;
......@@ -12,8 +10,28 @@ float rand(vec2 co){
void main(void)
{
vec2 uv = gl_TexCoord[0].xy;
vec2 r = rand(mapCoord / texSize);
vec2 r = vec2(rand(mapCoord / texSize));
vec4 c = texture2D(tex, uv);
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;
for(int i = -blursize; i <= blursize; i++)
{
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 /= (float(blursize)*2.0) * (float(blursize)*2.0);
c = sample;
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;
}
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