From 0127c747a41f972fd68e3e6e6b472859bfdb80dd Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 14 Feb 2026 15:26:55 +0100 Subject: refactor(wgsl): consolidate SDF shapes into single common file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge sdf_primitives.wgsl into math/sdf_shapes.wgsl to eliminate duplication and establish single source of truth for all SDF functions. Changes: - Delete common/shaders/sdf_primitives.wgsl (duplicate of math/sdf_shapes.wgsl) - Add sdBox2D() and sdEllipse() to math/sdf_shapes.wgsl - Update ellipse.wgsl (main/test) to use #include "math/sdf_shapes" - Update scene1.wgsl to use math/sdf_shapes instead of sdf_primitives - Rename asset SHADER_SDF_PRIMITIVES → SHADER_SDF_SHAPES - Update shader registration and tests Impact: - ~60 lines eliminated from ellipse shaders - Single source for 3D primitives (sphere, box, torus, plane) and 2D (box, ellipse) - Consistent include path across codebase All tests passing (34/34). handoff(Claude): SDF shapes consolidated to math/sdf_shapes.wgsl Co-Authored-By: Claude Sonnet 4.5 --- workspaces/main/assets.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'workspaces/main/assets.txt') diff --git a/workspaces/main/assets.txt b/workspaces/main/assets.txt index ace1462..0b64ba9 100644 --- a/workspaces/main/assets.txt +++ b/workspaces/main/assets.txt @@ -25,7 +25,7 @@ NOISE_TEX, PROC(gen_noise, 1234, 16), _, "Procedural noise texture for bump mapp # --- WGSL Shaders & Snippets --- SHADER_RENDERER_3D, NONE, shaders/renderer_3d.wgsl, "Hybrid 3D Renderer Shader" SHADER_COMMON_UNIFORMS, NONE, ../../common/shaders/common_uniforms.wgsl, "Common Uniforms Snippet" -SHADER_SDF_PRIMITIVES, NONE, ../../common/shaders/sdf_primitives.wgsl, "SDF Primitives Snippet" +SHADER_SDF_SHAPES, NONE, ../../common/shaders/math/sdf_shapes.wgsl, "SDF Shapes (2D/3D primitives)" SHADER_LIGHTING, NONE, ../../common/shaders/lighting.wgsl, "Lighting Snippet" SHADER_RAY_BOX, NONE, ../../common/shaders/ray_box.wgsl, "Ray-Box Intersection Snippet" SHADER_RAY_TRIANGLE, NONE, ../../common/shaders/ray_triangle.wgsl, "Ray-Triangle Intersection Snippet (Möller-Trumbore)" -- cgit v1.2.3