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 --- doc/COMPLETED.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'doc/COMPLETED.md') diff --git a/doc/COMPLETED.md b/doc/COMPLETED.md index dddcc3e..1acf8d1 100644 --- a/doc/COMPLETED.md +++ b/doc/COMPLETED.md @@ -31,6 +31,21 @@ Use `read @doc/archive/FILENAME.md` to access archived documents. ## Recently Completed (February 14, 2026) +- [x] **SDF Shapes Consolidation** + - **Goal**: Consolidate duplicate SDF primitive definitions into single source + - **Changes**: + - Merged `sdf_primitives.wgsl` into `math/sdf_shapes.wgsl` + - Added `sdBox2D()` and `sdEllipse()` to common shapes + - Removed duplicate sdEllipse from ellipse.wgsl shaders (main/test) + - Updated scene1.wgsl to use `math/sdf_shapes` include + - Renamed asset from SHADER_SDF_PRIMITIVES to SHADER_SDF_SHAPES + - **Impact**: + - ~60 lines eliminated from ellipse shaders + - Single source of truth for all SDF primitives (3D: sphere, box, torus, plane; 2D: box, ellipse) + - Consistent include path: `#include "math/sdf_shapes"` + - **Result**: 34/34 tests passing (100%) + - **Related**: Task #50 (WGSL Modularization) + - [x] **Fullscreen Vertex Shader Modularization** - **Goal**: Eliminate duplicate fullscreen triangle vertex shader code - **Changes**: -- cgit v1.2.3