blur-effect: Fix loop unrolling
The box blur shader was not sampling all the points for producing the desired effect.
This commit is contained in:
parent
eb3017df7e
commit
8583986e16
@ -72,12 +72,13 @@ static const gchar *box_blur_glsl_shader =
|
|||||||
" vec4 color = gl_Color * texture2D (tex, vec2 (gl_TexCoord[0].xy));\n"
|
" vec4 color = gl_Color * texture2D (tex, vec2 (gl_TexCoord[0].xy));\n"
|
||||||
" float count = 1.0;\n"
|
" float count = 1.0;\n"
|
||||||
" color += get_rgba_rel (tex, -x_step, -y_step); count++;\n"
|
" color += get_rgba_rel (tex, -x_step, -y_step); count++;\n"
|
||||||
" color += get_rgba_rel (tex, -x_step, 0.0); count++;\n"
|
|
||||||
" color += get_rgba_rel (tex, 0.0, -y_step); count++;\n"
|
" color += get_rgba_rel (tex, 0.0, -y_step); count++;\n"
|
||||||
" color += get_rgba_rel (tex, 0.0, 0.0); count++;\n"
|
|
||||||
" color += get_rgba_rel (tex, 0.0, y_step); count++;\n"
|
|
||||||
" color += get_rgba_rel (tex, x_step, -y_step); count++;\n"
|
" color += get_rgba_rel (tex, x_step, -y_step); count++;\n"
|
||||||
|
" color += get_rgba_rel (tex, -x_step, 0.0); count++;\n"
|
||||||
|
" color += get_rgba_rel (tex, 0.0, 0.0); count++;\n"
|
||||||
" color += get_rgba_rel (tex, x_step, 0.0); count++;\n"
|
" color += get_rgba_rel (tex, x_step, 0.0); count++;\n"
|
||||||
|
" color += get_rgba_rel (tex, -x_step, y_step); count++;\n"
|
||||||
|
" color += get_rgba_rel (tex, 0.0, y_step); count++;\n"
|
||||||
" color += get_rgba_rel (tex, x_step, y_step); count++;\n"
|
" color += get_rgba_rel (tex, x_step, y_step); count++;\n"
|
||||||
" gl_FragColor = color / count;\n"
|
" gl_FragColor = color / count;\n"
|
||||||
"}";
|
"}";
|
||||||
|
@ -14,8 +14,9 @@ test_rotate_main (int argc, char *argv[])
|
|||||||
ClutterAlpha *alpha;
|
ClutterAlpha *alpha;
|
||||||
ClutterBehaviour *r_behave;
|
ClutterBehaviour *r_behave;
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
ClutterActor *hand, *label;
|
ClutterActor *hand, *label, *rect;
|
||||||
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
|
||||||
|
ClutterColor rect_color;
|
||||||
gchar *file;
|
gchar *file;
|
||||||
|
|
||||||
clutter_init (&argc, &argv);
|
clutter_init (&argc, &argv);
|
||||||
@ -37,8 +38,13 @@ test_rotate_main (int argc, char *argv[])
|
|||||||
|
|
||||||
g_free (file);
|
g_free (file);
|
||||||
|
|
||||||
|
clutter_color_from_string (&rect_color, "#ce5c00ff");
|
||||||
|
rect = clutter_rectangle_new_with_color (&rect_color);
|
||||||
|
clutter_actor_add_effect_with_name (rect, "blur", clutter_blur_effect_new ());
|
||||||
|
clutter_actor_set_position (rect, 340, 140);
|
||||||
|
clutter_actor_set_size (rect, 150, 150);
|
||||||
|
|
||||||
clutter_actor_set_position (hand, 240, 140);
|
clutter_actor_set_position (hand, 240, 140);
|
||||||
clutter_actor_show (hand);
|
|
||||||
clutter_actor_add_effect_with_name (hand, "desaturate", clutter_desaturate_effect_new (0.75));
|
clutter_actor_add_effect_with_name (hand, "desaturate", clutter_desaturate_effect_new (0.75));
|
||||||
clutter_actor_add_effect_with_name (hand, "blur", clutter_blur_effect_new ());
|
clutter_actor_add_effect_with_name (hand, "blur", clutter_blur_effect_new ());
|
||||||
clutter_actor_animate_with_timeline (hand, CLUTTER_LINEAR, timeline,
|
clutter_actor_animate_with_timeline (hand, CLUTTER_LINEAR, timeline,
|
||||||
@ -53,7 +59,7 @@ test_rotate_main (int argc, char *argv[])
|
|||||||
clutter_actor_set_position (label, 150, 150);
|
clutter_actor_set_position (label, 150, 150);
|
||||||
clutter_actor_set_size (label, 500, 100);
|
clutter_actor_set_size (label, 500, 100);
|
||||||
|
|
||||||
clutter_container_add (CLUTTER_CONTAINER (stage), hand, label, NULL);
|
clutter_container_add (CLUTTER_CONTAINER (stage), rect, hand, label, NULL);
|
||||||
|
|
||||||
/* Set an alpha func to power behaviour */
|
/* Set an alpha func to power behaviour */
|
||||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
||||||
@ -70,6 +76,7 @@ test_rotate_main (int argc, char *argv[])
|
|||||||
/* Apply it to our actor */
|
/* Apply it to our actor */
|
||||||
clutter_behaviour_apply (r_behave, hand);
|
clutter_behaviour_apply (r_behave, hand);
|
||||||
clutter_behaviour_apply (r_behave, label);
|
clutter_behaviour_apply (r_behave, label);
|
||||||
|
clutter_behaviour_apply (r_behave, rect);
|
||||||
|
|
||||||
/* start the timeline and thus the animations */
|
/* start the timeline and thus the animations */
|
||||||
clutter_timeline_start (timeline);
|
clutter_timeline_start (timeline);
|
||||||
|
Loading…
Reference in New Issue
Block a user