From 514b8d7141d1346c48c9e301d2b89fd5e5f42cc9 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 28 Feb 2026 08:29:44 +0100 Subject: remove SDFEffect base class and sdf_test, update SDF_EFFECT_GUIDE - Delete unused SDFEffect base class (src/gpu/sdf_effect.h) - Delete sdf_test.wgsl and SHADER_SDF_TEST from assets.txt - Rewrite SDF_EFFECT_GUIDE.md based on Scene1 canonical pattern: correct bindings (2/3), vec4f syntax, UniformsSequenceParams - Fix missing newline at end of gpu.h handoff(Claude): SDF cleanup done, guide updated to match current Effect API --- workspaces/main/assets.txt | 1 - workspaces/main/shaders/sdf_test.wgsl | 68 ----------------------------------- 2 files changed, 69 deletions(-) delete mode 100644 workspaces/main/shaders/sdf_test.wgsl (limited to 'workspaces') diff --git a/workspaces/main/assets.txt b/workspaces/main/assets.txt index ba28b04..4115397 100644 --- a/workspaces/main/assets.txt +++ b/workspaces/main/assets.txt @@ -54,7 +54,6 @@ SHADER_SOLARIZE, NONE, shaders/solarize.wgsl, "Solarize Shader" SHADER_DISTORT, NONE, shaders/distort.wgsl, "Distort Shader" SHADER_CHROMA_ABERRATION, NONE, shaders/chroma_aberration.wgsl, "Chroma Aberration Shader" SHADER_VISUAL_DEBUG, NONE, shaders/visual_debug.wgsl, "Visual Debug Shader" -SHADER_SDF_TEST, NONE, shaders/sdf_test.wgsl, "SDF test effect demonstrating SDFEffect base class" SHADER_SKYBOX, NONE, ../../common/shaders/skybox.wgsl, "Skybox background shader" SHADER_MATH_SDF_SHAPES, NONE, ../../common/shaders/math/sdf_shapes.wgsl, "SDF Shapes Snippet" SHADER_MATH_SDF_UTILS, NONE, ../../common/shaders/math/sdf_utils.wgsl, "SDF Utils Snippet" diff --git a/workspaces/main/shaders/sdf_test.wgsl b/workspaces/main/shaders/sdf_test.wgsl deleted file mode 100644 index 941481e..0000000 --- a/workspaces/main/shaders/sdf_test.wgsl +++ /dev/null @@ -1,68 +0,0 @@ -// SDF Test Effect - demonstrates SDFEffect base class usage -// Simple scene with a sphere and box - -#include "common_uniforms" -#include "camera_common" -#include "math/sdf_shapes" -#include "render/raymarching" - -@group(0) @binding(0) var uniforms: CommonUniforms; -@group(0) @binding(1) var camera: CameraParams; - -// Scene distance function -fn df(p: vec3f) -> f32 { - // Animated sphere - let sphere_pos = vec3f(sin(uniforms.beat_time * 0.5) * 2.0, 0.0, 0.0); - let d_sphere = sdSphere(p - sphere_pos, 1.0); - - // Static box - let box_pos = vec3f(0.0, -2.0, 0.0); - let d_box = sdBox(p - box_pos, vec3f(3.0, 0.5, 3.0)); - - return min(d_sphere, d_box); -} - -// Simple lighting -fn shade(pos: vec3f, rd: vec3f) -> vec3f { - let n = normal(pos); - let light_dir = normalize(vec3f(1.0, 1.0, -1.0)); - let diff = max(dot(n, light_dir), 0.0); - let amb = 0.2; - - // Color based on position - let col = mix(vec3f(0.2, 0.6, 0.9), vec3f(0.9, 0.3, 0.2), - smoothstep(-2.0, 2.0, pos.x)); - - return col * (diff + amb); -} - -@vertex -fn vs_main(@builtin(vertex_index) vid: u32) -> @builtin(position) vec4f { - // Fullscreen triangle - let x = f32((vid & 1u) << 2u) - 1.0; - let y = f32((vid & 2u) << 1u) - 1.0; - return vec4f(x, y, 0.0, 1.0); -} - -@fragment -fn fs_main(@builtin(position) pos: vec4f) -> @location(0) vec4f { - // UV coordinates (-1 to 1) - let uv = (pos.xy / uniforms.resolution - 0.5) * 2.0; - - // Generate ray - let ray = getCameraRay(camera, uv); - - // Raymarch - let t = rayMarch(ray.origin, ray.direction, 0.0); - - // Background color - var col = vec3f(0.1, 0.1, 0.15); - - // Shade hit point - if (t < MAX_RAY_LENGTH) { - let hit_pos = ray.origin + ray.direction * t; - col = shade(hit_pos, ray.direction); - } - - return vec4f(col, 1.0); -} -- cgit v1.2.3