From 0a88adc281bd16fb15e6137c4ff4c05753fee51e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20=E2=80=98Touky=E2=80=99=20Huet?= Date: Wed, 25 Sep 2013 21:33:13 +0000 Subject: [PATCH] lolcatz shader WebGL compatible. --- test/front_camera_sprite.lolfx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/front_camera_sprite.lolfx b/test/front_camera_sprite.lolfx index 2278b573..826b72fc 100644 --- a/test/front_camera_sprite.lolfx +++ b/test/front_camera_sprite.lolfx @@ -71,15 +71,17 @@ vec3 hsv2rgb(vec3 c) return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } +const int sample_nb = 2; + void main(void) { vec2 texcoord = pass_texcoord.xy - vec2(pass_texcoord.z * in_sprite_flip, 0.0); vec4 color = texture2D(in_texture, texcoord) * pass_color; //need 130 : ivec2 tex_size = textureSize(in_texture, 0); - int sample_nb = 2; if (color.a < 0.9) { + bool break_loop = false; for (int x = -sample_nb; x <= sample_nb; x++) { for (int y = -sample_nb; y <= sample_nb; y++) @@ -92,11 +94,16 @@ void main(void) if (new_col.a > 0.9) { color = vec4(0.0, 0.0, 0.0, 1.0); - x = sample_nb + 1; - y = sample_nb + 1; + break_loop = true; + //x = sample_nb + 1; + //y = sample_nb + 1; } + if (break_loop) + break; } } + if (break_loop) + break; } } if (color.a < 0.01)