lygia
/v1.1.6
/draw
/stroke
)fill a stroke in a SDF. From PixelSpiritDeck https://github.com/patriciogonzalezvivo/PixelSpiritDeck
Dependencies:
Use:
stroke(<float> sdf, <float> size, <float> width [, <float> edge])
#ifndef FNC_STROKE
#define FNC_STROKE
float stroke(float x, float size, float w) {
float d = aastep(size, x + w * 0.5) - aastep(size, x - w * 0.5);
return saturate(d);
}
float stroke(float x, float size, float w, float edge) {
float d = smoothstep(size - edge, size + edge, x + w * 0.5) - smoothstep(size - edge, size + edge, x - w * 0.5);
return saturate(d);
}
#endif
Dependencies:
Use:
stroke(<float> sdf, <float> size, <float> width [, <float> edge])
#ifndef FNC_STROKE
#define FNC_STROKE
float stroke(float x, float size, float w) {
float d = aastep(size, x + w * 0.5) - aastep(size, x - w * 0.5);
return saturate(d);
}
float stroke(float x, float size, float w, float edge) {
float d = smoothstep(size - edge, size + edge, x + w * 0.5) - smoothstep(size - edge, size + edge, x - w * 0.5);
return saturate(d);
}
#endif
fn stroke(x: f32, size: f32, w: f32, edge: f32) -> f32 {
return saturate(smoothstep(size - edge, size + edge, x + w * 0.5) - smoothstep(size - edge, size + edge, x - w * 0.5));
}
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository