23 lines
783 B
Text
23 lines
783 B
Text
#include "../math/aastep.msl"
|
|
|
|
/*
|
|
contributors: Patricio Gonzalez Vivo
|
|
description: Fill a SDF. From PixelSpiritDeck https://github.com/patriciogonzalezvivo/PixelSpiritDeck
|
|
use: fill(<float> sdf, <float> size [, <float> edge])
|
|
examples:
|
|
- https://raw.githubusercontent.com/patriciogonzalezvivo/lygia_examples/main/draw_shapes.frag
|
|
license:
|
|
- Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0
|
|
- Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license
|
|
*/
|
|
|
|
#ifndef FNC_FILL
|
|
#define FNC_FILL
|
|
float fill(float x, float size, float edge) {
|
|
return 1.0 - smoothstep(size - edge, size + edge, x);
|
|
}
|
|
|
|
float fill(float x, float size) {
|
|
return 1.0 - aastep(size, x);
|
|
}
|
|
#endif
|