aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/shaders/modules
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/resources/shaders/modules/sdf.glsl9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/resources/shaders/modules/sdf.glsl b/src/main/resources/shaders/modules/sdf.glsl
index 9051339..c6787c9 100644
--- a/src/main/resources/shaders/modules/sdf.glsl
+++ b/src/main/resources/shaders/modules/sdf.glsl
@@ -2,6 +2,10 @@ float sdf_circle(in vec3 p, in float radius) {
return length(p) - radius;
}
+float sdf_circle(in vec2 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;
}
@@ -11,6 +15,11 @@ float sdf_box(in vec3 p, in vec3 dimens, in float rounding) {
return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0) - rounding;
}
+float sdf_box(in vec2 p, in vec2 dimens, in float rounding) {
+ vec2 q = abs(p) - dimens + rounding;
+ return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - rounding;
+}
+
float sd_ellipsoid(vec3 p, vec3 r) {
float k0 = length(p / r);
float k1 = length(p / (r * r));