Skip to content

Commit

Permalink
Revert "Make debug color clearer."
Browse files Browse the repository at this point in the history
This reverts commit 6efc19e.
  • Loading branch information
behdad committed Jan 4, 2016
1 parent 5d9ba6d commit 77bd0c2
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions demo/demo-fshader.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ antialias (float d)
return smoothstep (-.75, +.75, d);
}

vec4
source_over (const vec4 src, const vec4 dst)
{
// http://dev.w3.org/fxtf/compositing-1/#porterduffcompositingoperators_srcover
float alpha = src.a + (dst.a * (1. - src.a));
return vec4 (((src.rgb * src.a) + (dst.rgb * dst.a * (1. - src.a))) / alpha, alpha);
}

void
main()
{
Expand Down Expand Up @@ -67,19 +59,26 @@ main()
alpha = pow (alpha, 1./u_gamma_adjust);
color = vec4 (color.rgb,color.a * alpha);
} else {
color = vec4 (0,0,0,0);

// Color the inside of the glyph a light red
color += vec4 (.5,0,0,.5) * smoothstep (1., -1., sdist);

float udist = abs (sdist);
float gudist = abs (gsdist);
float debug_color = 0.4;
// Color the distance field red inside and green outside
if (!glyphy_isinf (gudist))
color = source_over (vec4 (debug_color * smoothstep (1., -1., sdist), debug_color * smoothstep (-1., 1., sdist), 0, 1. - gudist), color);
// Color the outline red
color += vec4 (1,0,0,1) * smoothstep (2., 1., udist);
// Color the distance field in green
if (!glyphy_isinf (udist))
color += vec4(0,.4,0,.4 - (abs(gsdist) / max(float(gi.nominal_size.x), float(gi.nominal_size.y))) * 4.);

float pdist = glyphy_point_dist (p, gi.nominal_size GLYPHY_DEMO_EXTRA_ARGS);
// Color points green
color = mix (vec4 (0,1,0,.5), color, smoothstep (.05, .06, pdist));

glyphy_arc_list_t arc_list = glyphy_arc_list (p, gi.nominal_size GLYPHY_DEMO_EXTRA_ARGS);
// Color the number of endpoints per cell blue
color = source_over (vec4 (0, 0, debug_color, float(arc_list.num_endpoints) / float(GLYPHY_MAX_NUM_ENDPOINTS)), color);

float pdist = glyphy_point_dist (p, gi.nominal_size GLYPHY_DEMO_EXTRA_ARGS);
// Color points yellow
color = source_over (vec4 (1, 1, 0, smoothstep (.06, .05, pdist)), color);
color += vec4 (0,0,1,.1) * float(arc_list.num_endpoints) * 32./255.;
}

gl_FragColor = color;
Expand Down

0 comments on commit 77bd0c2

Please sign in to comment.