aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/shaders/modules/sdf.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/resources/shaders/modules/sdf.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/resources/shaders/modules/sdf.cs b/src/main/resources/shaders/modules/sdf.cs
new file mode 100644
index 0000000..8121b18
--- /dev/null
+++ b/src/main/resources/shaders/modules/sdf.cs
@@ -0,0 +1,12 @@
+float sdf_circle(in vec3 p, in float radius) {
+ return length(p) - radius;
+}
+
+float sdf_plane(in vec3 p, in vec3 normal, in float offset) {
+ return dot(p, normal) + offset;
+}
+
+float sdf_box(in vec3 p, in vec3 dimens, in float rounding) {
+ vec3 q = abs(p) - dimens + rounding;
+ return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0) - rounding;
+}