From b8d4a815453acac752c6fb3c56d047e39a76fd05 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 14 Feb 2026 19:05:34 +0100 Subject: feat(gpu): add SDF camera infrastructure and effect base class Add unified camera system for SDF raymarching effects: - CameraParams struct (80 bytes): inv_view matrix + FOV/near/far/aspect - SDFEffect base class: manages camera uniform, provides update_camera() helpers - camera_common.wgsl: getCameraRay(), position/forward/up/right extractors - SDFTestEffect: working example with orbiting camera + animated sphere Refactor effect headers: - Extract class definitions from demo_effects.h to individual .h files - Update includes in .cc files to use specific headers - Cleaner compilation dependencies, faster incremental builds Documentation: - Add SDF_EFFECT_GUIDE.md with complete workflow - Update ARCHITECTURE.md, UNIFORM_BUFFER_GUIDELINES.md - Update EFFECT_WORKFLOW.md, CONTRIBUTING.md Tests: 34/34 passing, SDFTestEffect validated Co-Authored-By: Claude Sonnet 4.5 --- doc/CONTRIBUTING.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'doc/CONTRIBUTING.md') diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index d7ef88a..7fbfd64 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -65,10 +65,14 @@ See `doc/CODING_STYLE.md` for detailed examples. ## Development Protocols ### Adding Visual Effect -1. Create effect class files (use `tools/shadertoy/convert_shadertoy.py` or templates) + +**For SDF/raymarching effects:** Use `SDFEffect` base class (see `doc/SDF_EFFECT_GUIDE.md`). + +**For standard effects:** +1. Create effect class files (each effect should have its own `.h` and `.cc` file, e.g., `src/effects/my_effect.h` and `src/effects/my_effect.cc`). Use `tools/shadertoy/convert_shadertoy.py` or templates. 2. Add shader to `workspaces/main/assets.txt` 3. Add effect `.cc` file to `CMakeLists.txt` GPU_SOURCES (both sections) -4. Include header in `src/gpu/demo_effects.h` +4. Include header in `src/gpu/demo_effects.h` (which now serves as a central include for all individual effect headers) 5. Add to workspace `timeline.seq` (e.g., `workspaces/main/timeline.seq`) 6. **Update `src/tests/gpu/test_demo_effects.cc`**: - Add to `post_process_effects` list (lines 80-93) or `scene_effects` list (lines 125-137) -- cgit v1.2.3