summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--workspaces/main/shaders/sdf_test.wgsl9
1 files changed, 9 insertions, 0 deletions
diff --git a/workspaces/main/shaders/sdf_test.wgsl b/workspaces/main/shaders/sdf_test.wgsl
index 3c97613..71310f2 100644
--- a/workspaces/main/shaders/sdf_test.wgsl
+++ b/workspaces/main/shaders/sdf_test.wgsl
@@ -22,6 +22,15 @@ fn df(p: vec3<f32>) -> f32 {
return min(d_sphere, d_box);
}
+// Two-pass distance function (required by raymarching.wgsl)
+fn dfWithID(p: vec3<f32>) -> RayMarchResult {
+ var result: RayMarchResult;
+ result.distance = df(p);
+ result.distance_max = result.distance;
+ result.object_id = 0.0;
+ return result;
+}
+
// Simple lighting
fn shade(pos: vec3<f32>, rd: vec3<f32>) -> vec3<f32> {
let n = normal(pos);