From 96a0a8c916533eb5625816192ed38488f639326d Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 22 Feb 2012 11:00:20 -0800 Subject: Integrating canvas-2d drawing and WebGL fixes, including adding back WebGL materials. Signed-off-by: Nivesh Rajbhandari --- assets/shaders/radialBlur.frag.glsl | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 assets/shaders/radialBlur.frag.glsl (limited to 'assets/shaders/radialBlur.frag.glsl') diff --git a/assets/shaders/radialBlur.frag.glsl b/assets/shaders/radialBlur.frag.glsl new file mode 100644 index 00000000..673d082a --- /dev/null +++ b/assets/shaders/radialBlur.frag.glsl @@ -0,0 +1,47 @@ + +precision highp float; + +uniform vec2 u_resolution; +uniform float u_time; +uniform vec4 color; +uniform sampler2D u_tex0; + +vec3 deform( in vec2 p ) +{ + vec2 uv; + + //float time = color.x; + float time = u_time; + vec2 q = vec2( sin(1.1*time+p.x),sin(1.2*time+p.y) ); + + float a = atan(q.y,q.x); + float r = sqrt(dot(q,q)); + + uv.x = sin(0.0+1.0*time)+p.x*sqrt(r*r+1.0); + uv.y = sin(0.6+1.1*time)+p.y*sqrt(r*r+1.0); + + return texture2D(u_tex0,uv*.5).xyz; +} + +void main(void) +{ + vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; + //vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / vec2(500,500).xy; + vec2 s = p; + + vec3 total = vec3(0.0); + vec2 d = (vec2(0.0,0.0)-p)/40.0; + float w = 1.0; + for( int i=0; i<40; i++ ) + { + vec3 res = deform(s); + res = smoothstep(0.1,1.0,res*res); + total += w*res; + w *= .99; + s += d; + } + total /= 40.0; + float r = 1.5/(1.0+dot(p,p)); + + gl_FragColor = vec4( total*r,1.0); +} \ No newline at end of file -- cgit v1.2.3 From f775fb752cac57a0c1f6c42c8c60f5ff329eab32 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 22 Feb 2012 11:36:19 -0800 Subject: Revert "Integrating canvas-2d drawing and WebGL fixes, including adding back WebGL materials." This reverts commit 96a0a8c916533eb5625816192ed38488f639326d. --- assets/shaders/radialBlur.frag.glsl | 47 ------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 assets/shaders/radialBlur.frag.glsl (limited to 'assets/shaders/radialBlur.frag.glsl') diff --git a/assets/shaders/radialBlur.frag.glsl b/assets/shaders/radialBlur.frag.glsl deleted file mode 100644 index 673d082a..00000000 --- a/assets/shaders/radialBlur.frag.glsl +++ /dev/null @@ -1,47 +0,0 @@ - -precision highp float; - -uniform vec2 u_resolution; -uniform float u_time; -uniform vec4 color; -uniform sampler2D u_tex0; - -vec3 deform( in vec2 p ) -{ - vec2 uv; - - //float time = color.x; - float time = u_time; - vec2 q = vec2( sin(1.1*time+p.x),sin(1.2*time+p.y) ); - - float a = atan(q.y,q.x); - float r = sqrt(dot(q,q)); - - uv.x = sin(0.0+1.0*time)+p.x*sqrt(r*r+1.0); - uv.y = sin(0.6+1.1*time)+p.y*sqrt(r*r+1.0); - - return texture2D(u_tex0,uv*.5).xyz; -} - -void main(void) -{ - vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; - //vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / vec2(500,500).xy; - vec2 s = p; - - vec3 total = vec3(0.0); - vec2 d = (vec2(0.0,0.0)-p)/40.0; - float w = 1.0; - for( int i=0; i<40; i++ ) - { - vec3 res = deform(s); - res = smoothstep(0.1,1.0,res*res); - total += w*res; - w *= .99; - s += d; - } - total /= 40.0; - float r = 1.5/(1.0+dot(p,p)); - - gl_FragColor = vec4( total*r,1.0); -} \ No newline at end of file -- cgit v1.2.3 From d5b216d9d6d2b8cb93106e8f8ca351089d05b41d Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 22 Feb 2012 11:52:31 -0800 Subject: Integrating canvas-2d and WebGL drawing fixes. Also adding back WebGL materials. Signed-off-by: Nivesh Rajbhandari --- assets/shaders/radialBlur.frag.glsl | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 assets/shaders/radialBlur.frag.glsl (limited to 'assets/shaders/radialBlur.frag.glsl') diff --git a/assets/shaders/radialBlur.frag.glsl b/assets/shaders/radialBlur.frag.glsl new file mode 100644 index 00000000..673d082a --- /dev/null +++ b/assets/shaders/radialBlur.frag.glsl @@ -0,0 +1,47 @@ + +precision highp float; + +uniform vec2 u_resolution; +uniform float u_time; +uniform vec4 color; +uniform sampler2D u_tex0; + +vec3 deform( in vec2 p ) +{ + vec2 uv; + + //float time = color.x; + float time = u_time; + vec2 q = vec2( sin(1.1*time+p.x),sin(1.2*time+p.y) ); + + float a = atan(q.y,q.x); + float r = sqrt(dot(q,q)); + + uv.x = sin(0.0+1.0*time)+p.x*sqrt(r*r+1.0); + uv.y = sin(0.6+1.1*time)+p.y*sqrt(r*r+1.0); + + return texture2D(u_tex0,uv*.5).xyz; +} + +void main(void) +{ + vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_resolution.xy; + //vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / vec2(500,500).xy; + vec2 s = p; + + vec3 total = vec3(0.0); + vec2 d = (vec2(0.0,0.0)-p)/40.0; + float w = 1.0; + for( int i=0; i<40; i++ ) + { + vec3 res = deform(s); + res = smoothstep(0.1,1.0,res*res); + total += w*res; + w *= .99; + s += d; + } + total /= 40.0; + float r = 1.5/(1.0+dot(p,p)); + + gl_FragColor = vec4( total*r,1.0); +} \ No newline at end of file -- cgit v1.2.3