aboutsummaryrefslogtreecommitdiff
path: root/template/sdf.lib.glsl.mako
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-12-28 23:18:23 +0100
committerAdrian Kummerlaender2019-12-28 23:18:23 +0100
commite399841b70683013ebdc9f6bcb31a871fef33db2 (patch)
tree15e013be6ebc5f28793f5ba1a378fd8f53dfde18 /template/sdf.lib.glsl.mako
parent342d554e2da1f80aa93d5d28d2d87573db87bbb0 (diff)
downloadsymlbm_playground-e399841b70683013ebdc9f6bcb31a871fef33db2.tar
symlbm_playground-e399841b70683013ebdc9f6bcb31a871fef33db2.tar.gz
symlbm_playground-e399841b70683013ebdc9f6bcb31a871fef33db2.tar.bz2
symlbm_playground-e399841b70683013ebdc9f6bcb31a871fef33db2.tar.lz
symlbm_playground-e399841b70683013ebdc9f6bcb31a871fef33db2.tar.xz
symlbm_playground-e399841b70683013ebdc9f6bcb31a871fef33db2.tar.zst
symlbm_playground-e399841b70683013ebdc9f6bcb31a871fef33db2.zip
Adapt existing channel example to new SDF-based rendering and voxelization
Diffstat (limited to 'template/sdf.lib.glsl.mako')
-rw-r--r--template/sdf.lib.glsl.mako8
1 files changed, 6 insertions, 2 deletions
diff --git a/template/sdf.lib.glsl.mako b/template/sdf.lib.glsl.mako
index 515f959..c58cc7b 100644
--- a/template/sdf.lib.glsl.mako
+++ b/template/sdf.lib.glsl.mako
@@ -12,6 +12,10 @@ float box(vec3 v, vec3 b) {
return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0);
}
+float cylinder(vec3 v, float r, float h) {
+ return max(length(v.xy) - r, fabs(v.z) - 0.5*h);
+}
+
vec3 flip_xy(vec3 v) {
return v3(v.y, v.x, v.z);
}
@@ -43,7 +47,7 @@ float rounded(float a, float r) {
return a - r;
}
-float sunify(float a, float b, float k) {
+float sadd(float a, float b, float k) {
float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);
return mix(b, a, h) - k * h * (1 - h);
}
@@ -62,7 +66,7 @@ float sub(float a, float b) {
return max(-b, a);
}
-float unify(float a, float b) {
+float add(float a, float b) {
return min(a, b);
}