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/EFFECT_WORKFLOW.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'doc/EFFECT_WORKFLOW.md') diff --git a/doc/EFFECT_WORKFLOW.md b/doc/EFFECT_WORKFLOW.md index 22b8dc9..57cf904 100644 --- a/doc/EFFECT_WORKFLOW.md +++ b/doc/EFFECT_WORKFLOW.md @@ -10,6 +10,8 @@ Automated checklist for adding new visual effects to the demo. **For ShaderToy conversions:** Use `tools/shadertoy/convert_shadertoy.py` then follow steps 3-8 below. +**For SDF/raymarching effects:** See `doc/SDF_EFFECT_GUIDE.md` for streamlined workflow using SDFEffect base class. + **For custom effects:** Follow all steps 1-8. --- @@ -18,6 +20,8 @@ Automated checklist for adding new visual effects to the demo. ### 1. Create Effect Files +**Description:** Each visual effect must have its own dedicated header (`.h`) and implementation (`.cc`) file pair. + **Location:** - Header: `src/effects/_effect.h` - Implementation: `src/effects/_effect.cc` @@ -84,7 +88,7 @@ SHADER_TUNNEL, NONE, shaders/tunnel.wgsl, "Tunnel effect shader" # In normal section (line ~183): src/effects/solarize_effect.cc - src/effects/tunnel_effect.cc # <-- Add here + src/effects/tunnel.cc # <-- Add here src/effects/chroma_aberration_effect.cc ``` @@ -92,7 +96,7 @@ SHADER_TUNNEL, NONE, shaders/tunnel.wgsl, "Tunnel effect shader" **File:** `src/gpu/demo_effects.h` -**Action:** Add include directive: +**Action:** `src/gpu/demo_effects.h` now acts as a central include file. Add a single include directive for your new effect's header: ```cpp #include "effects/_effect.h" ``` -- cgit v1.2.3