Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Draw Line https://www.shadertoy.com/view/4ljfRD
float drawLine (vec2 p1, vec2 p2, vec2 uv, float a)
{
float r = 0.;
float one_px = 1. / iResolution.x; //not really one px
// get dist between points
float d = distance(p1, p2);
// get dist between current pixel and p1
float duv = distance(p1, uv);
//if point is on line, according to dist, it should match current uv
r = 1.-floor(1.-(a*one_px)+distance (mix(p1, p2, clamp(duv/d, 0., 1.)), uv));
r = max(0.,r); // added ikekou
return r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.