summaryrefslogtreecommitdiff
path: root/TODO.md
diff options
context:
space:
mode:
Diffstat (limited to 'TODO.md')
-rw-r--r--TODO.md126
1 files changed, 116 insertions, 10 deletions
diff --git a/TODO.md b/TODO.md
index 69bb111..105be30 100644
--- a/TODO.md
+++ b/TODO.md
@@ -2,6 +2,15 @@
This file tracks prioritized tasks with detailed attack plans.
+## Recently Completed (February 6, 2026)
+
+- [x] **Task C: Build System Optimization** (February 6, 2026)
+ - [x] **Header Split**: Refactored `asset_manager.h` into `asset_manager_dcl.h` (forward declarations), `asset_manager.h` (core API), and `asset_manager_utils.h` (typed helpers for TextureAsset/MeshAsset).
+ - [x] **Asset Dependency Tracking**: Added file-level dependencies for all assets (.wgsl shaders, .spec audio, .obj meshes). CMake now tracks 42 demo assets + 17 test assets individually.
+ - [x] **Performance Impact**: Editing TextureAsset/MeshAsset helpers: 4.82s → 2.01s (58% faster). Editing shaders now triggers correct rebuild (was broken before - stale code bug fixed).
+ - [x] **Developer Workflow**: No more manual `touch demo_assets.txt` workaround needed. Edit any asset file and rebuild works correctly.
+ - **Result**: Critical correctness bug fixed (shader changes were not triggering rebuilds). Build system now has proper dependency tracking for all source and asset files.
+
## Recently Completed (February 5, 2026)
- [x] **Audio Lifecycle Refactor (Task #56)**:
@@ -18,8 +27,8 @@ This file tracks prioritized tasks with detailed attack plans.
- [x] **Integration & Visualization**: Added `velocity`, `mass`, `is_static` to `Object3D`. Integrated physics loop into `test_3d_render.cc` and added BVH wireframe visualization to `VisualDebug`.
- [x] **Audio Playback Debugging & Core Audio Optimization**:
- - [x] **Core Audio Timing Fix**: Resolved stop-and-go audio glitches caused by timing mismatch. Core Audio optimized for 44.1kHz (10ms periods), but 32kHz system expected ~13.78ms callbacks. Added `allowNominalSampleRateChange = TRUE` to force OS-level 32kHz native and `performanceProfile = conservative` for 4096-frame buffers (128ms). Result: Stable ~128ms callbacks, <1ms jitter, zero underruns.
- - [x] **Ring Buffer Capacity**: Increased from 200ms to 400ms (25,600 samples) for tempo scaling headroom. Added bounds checking with abort() on violations.
+ - [x] **Core Audio Timing Fix**: Resolved stop-and-go audio glitches caused by timing mismatch. Core Audio optimized for 44.1kHz (10ms periods), but our 32kHz system expected uniform ~13.78ms callbacks, causing resampling jitter. Fix: Added `allowNominalSampleRateChange = TRUE` to force OS-level 32kHz native and `performanceProfile = conservative` for 4096-frame buffers (128ms). Result: Stable ~128ms callbacks, <1ms jitter, zero underruns.
+ - [x] **Ring Buffer Capacity**: Increased from 200ms to 400ms (25,600 samples) to handle tempo scaling headroom. Added comprehensive bounds checking with abort() on violations.
- [x] **Tempo-Scaled Buffer Fill**: Fixed critical bug where buffer pre-fill didn't scale dt by tempo (`audio_render_ahead(g_music_time, dt * g_tempo_scale)`). Buffer now maintains 400ms fullness during 2.0x acceleration.
- [x] **Extensive Diagnostics**: Added high-resolution timing tracking (clock_gettime), callback interval measurement, buffer level monitoring, underrun detection. All under conditional compilation for future debugging.
@@ -86,7 +95,7 @@ This file tracks prioritized tasks with detailed attack plans.
- [x] **Task #51.1: Audio Backend Abstraction**:
- [x] **Interface Created**: Defined `AudioBackend` interface in `src/audio/audio_backend.h` with hooks for voice triggering and frame rendering.
- - [x] **Production Backend**: Moved miniaudio implementation to `MiniaudioBackend` class, maintaining backward compatibility.
+ - [x] **Production Backend**: Moved miniaudio implementation from `audio.cc` to `MiniaudioBackend` class, maintaining backward compatibility.
- [x] **Audio Refactoring**: Updated `audio.cc` to use backend abstraction with automatic fallback to `MiniaudioBackend`.
- [x] **Event Hooks**: Added time tracking to `synth.cc` with `on_voice_triggered()` callbacks (guarded by `!STRIP_ALL`).
- [x] **Verification Test**: Created `test_audio_backend.cc` to verify backend injection and event recording work correctly.
@@ -116,7 +125,7 @@ This file tracks prioritized tasks with detailed attack plans.
- [x] **Documentation:** Updated `doc/HOWTO.md` with usage instructions.
- [x] **Skybox & Two-pass Rendering Stability**:
- [x] **Fixed Two-pass Rendering:** Implemented mandatory clear operations for color and depth when the skybox is absent, preventing black screens and depth validation errors.
- - [x] **Implemented Rotating Skybox:** Added `inv_view_proj` to `GlobalUniforms` and updated the skybox shader to perform world-space ray unprojection, enabling correct rotation with the camera.
+ - [x] **Implemented Rotating Skybox:** Added `inv_view_proj` to `GlobalUniforms` and updated the skybox shader to perform world-space ray unprojection (`inv_view_proj`), enabling correct rotation with the camera.
- [x] **Enhanced Procedural Noise:** Implemented a multi-octave Value Noise generator for higher-quality skybox textures.
- [x] **Scene Integrity:** Restored proper object indexing and removed redundant geometry, ensuring the floor grid and objects render correctly.
@@ -137,13 +146,102 @@ This file tracks prioritized tasks with detailed attack plans.
- **Result**: Fully functional timeline editor ready for production use. Phase 1.1 complete (basic editing, snap-to-beat, waveform). Phase 1.2 (Add Effect button) and Phase 2.5 (music.track visualization) documented in ROADMAP.md.
- **Files**: `tools/timeline_editor/index.html` (~1200 lines), `README.md`, `ROADMAP.md` (3 phases, 117-161 hour estimate).
+## Critical Fixes
+
+- [ ] **Task A: Fix Test Mesh** (Partially Complete)
+ - [x] Fixed mesh normal transformation bug (double-transpose in shaders)
+ - [x] Fixed quaternion rotation stretching (non-normalized axis in quat::from_axis)
+ - [x] Fixed mesh shadow scaling (excluded meshes from SDF scale factor)
+ - [x] Fixed floor rendering artifacts (changed from PLANE to BOX)
+ - [ ] **Task A.1**: Investigate and fix missing shadows in test_mesh
+ - [ ] **Task A.2**: Investigate and fix ObjectType::PLANE with non-uniform scaling
+ - **Issue**: PLANE with extreme non-uniform scaling (e.g., vec3(20, 0.01, 20)) causes incorrect SDF distance calculations in shadows
+ - **Workaround**: Changed test_mesh floor to use ObjectType::BOX instead
+ - **Root Cause**: sdPlane distance calculation doesn't account for non-uniform scaling when transformed to local space
+ - **Investigation needed**: Determine if PLANE should handle non-uniform scaling or if it's unsupported by design
+
+- [ ] **Task B: Move platform-specific conditional code into a single header location**
+ - [ ] Abstract out `#if defined(DEMO_CROSS_COMPILE_WIN32)` statements from core `.cc` and `.h` sources.
+ - [ ] Centralize platform-specific code and `#ifdef`s into `platform.h` or equivalent.
+ - [ ] Address `str_view()` calls that cause compilation breaks.
+
+## Priority 1: Spectral Brush Editor (Task #5) [IN PROGRESS]
+
+**Goal:** Create a web-based tool for procedurally tracing audio spectrograms. Replaces large `.spec` binary assets with tiny procedural C++ code (50-100× compression).
+
+**Design Document:** See `doc/SPECTRAL_BRUSH_EDITOR.md` for complete architecture.
+
+**Core Concept: "Spectral Brush"**
+- **Central Curve** (Bezier): Traces time-frequency path through spectrogram
+- **Vertical Profile**: Shapes "brush stroke" around curve (Gaussian, Decaying Sinusoid, Noise)
+
+**Workflow:**
+```
+.wav → Load in editor → Trace with Bezier curves → Export procedural_params.txt + C++ code
+```
+
+### Phase 1: C++ Runtime (Foundation)
+- [ ] **Files:** `src/audio/spectral_brush.h`, `src/audio/spectral_brush.cc`
+- [ ] Define API (`ProfileType`, `draw_bezier_curve()`, `evaluate_profile()`)
+- [ ] Implement linear Bezier interpolation
+- [ ] Implement Gaussian profile evaluation
+- [ ] Implement home-brew deterministic RNG (for future noise support)
+- [ ] Add unit tests (`src/tests/test_spectral_brush.cc`)
+- [ ] **Deliverable:** Compiles, tests pass
+
+### Phase 2: Editor Core
+- [ ] **Files:** `tools/spectral_editor/index.html`, `script.js`, `style.css`, `dct.js` (reuse from old editor)
+- [ ] HTML structure (canvas, controls, file input)
+- [ ] Canvas rendering (dual-layer: reference + procedural)
+- [ ] Bezier curve editor (click to place, drag to adjust, delete control points)
+- [ ] Profile controls (Gaussian sigma slider)
+- [ ] Real-time spectrogram rendering
+- [ ] Audio playback (IDCT → Web Audio API)
+- [ ] Undo/Redo system (action history with snapshots)
+- [ ] **Keyboard shortcuts:**
+ - Key '1': Play procedural sound
+ - Key '2': Play original .wav
+ - Space: Play/pause
+ - Ctrl+Z: Undo
+ - Ctrl+Shift+Z: Redo
+ - Delete: Remove control point
+- [ ] **Deliverable:** Interactive editor, can trace .wav files
+
+### Phase 3: File I/O
+- [ ] Load .wav (decode, FFT/STFT → spectrogram)
+- [ ] Load .spec (binary format parser)
+- [ ] Save procedural_params.txt (human-readable, re-editable)
+- [ ] Generate C++ code (ready to compile)
+- [ ] Load procedural_params.txt (re-editing workflow)
+- [ ] **Deliverable:** Full save/load cycle works
+
+### Phase 4: Future Extensions (Post-MVP)
+- [ ] Cubic Bezier interpolation (smoother curves)
+- [ ] Decaying sinusoid profile (metallic sounds)
+- [ ] Noise profile (textured sounds)
+- [ ] Composite profiles (add/subtract/multiply)
+- [ ] Multi-dimensional Bezier ({freq, amplitude, decay, ...})
+- [ ] Frequency snapping (snap to musical notes)
+- [ ] Generic `gen_from_params()` code generation
+
+**Design Decisions:**
+- Linear Bezier interpolation (Phase 1), cubic later
+- Soft parameter limits in UI (not enforced)
+- Home-brew RNG (small, deterministic)
+- Single function per sound (generic loader later)
+- Start with Bezier + Gaussian only
+
+**Size Impact:** 50-100× compression (5 KB .spec → ~100 bytes C++ code)
+
+---
+
## Priority 2: 3D System Enhancements (Task #18)
**Goal:** Establish a pipeline for importing complex 3D scenes to replace hardcoded geometry.
-- [ ] **Task #18.0: Basic OBJ Asset Pipeline** (New)
- - [ ] Define `ASSET_MESH` type in `asset_manager`.
- - [ ] Update `asset_packer` to parse simple `.obj` files (positions, normals, UVs) and serialize them.
- - [ ] Update `Renderer3D` to handle `ObjectType::MESH` in the rasterization path.
-- [ ] **Task #36: Blender Exporter:** Create a Python script (`tools/blender_export.py`) to export meshes/cameras/lights to a binary asset format.
+- [x] **Task #18.0: Basic OBJ Asset Pipeline** (New)
+ - [x] Define `ASSET_MESH` type in `asset_manager`.
+ - [x] Update `asset_packer` to parse simple `.obj` files (positions, normals, UVs) and serialize them.
+ - [x] Update `Renderer3D` to handle `ObjectType::MESH` in the rasterization path.
+- [ ] **Task #36: Blender Exporter:** Create a Python script (`tools/blender_export.py`) to export meshes/cameras/lights to a binary asset format. (Deprioritized)
- [ ] **Task #37: Asset Ingestion:** Update `asset_packer` to handle the new 3D binary format.
- [ ] **Task #38: Runtime Loader:** Implement a minimal C++ parser to load the scene data into the ECS/Renderer.
@@ -178,10 +276,18 @@ This file tracks prioritized tasks with detailed attack plans.
## Future Goals & Ideas (Untriaged)
+- [ ] **Task #52: Procedural SDF Font**: Minimal bezier/spline set for [A-Z, 0-9] and SDF rendering.
+- [ ] **Task #53: Particles Shader Polish**: Improve visual quality of particles.
+- [ ] **Task #55: SDF Random Planes Intersection**: Implement `sdPolyhedron` (crystal/gem shapes) via plane intersection.
+- [ ] **Task #54: Tracy Integration**: Integrate Tracy debugger for performance profiling.
- [ ] **Task #58: Advanced Shader Factorization**: Further factorize WGSL code into smaller, reusable snippets.
- [ ] **Task #59: Comprehensive RNG Library**: Add WGSL snippets for float/vec2/vec3 noise (Perlin, Gyroid, etc.) and random number generators.
- [ ] **Task #60: OOP Refactoring**: Investigate if more C++ code can be made object-oriented without size penalty (vs functional style).
- [ ] **Task #61: GPU Procedural Generation**: Implement system to generate procedural data (textures, geometry) on GPU and read back to CPU.
+- [ ] **Task #62: Physics Engine Enhancements (PBD & Rotation)**:
+ - [ ] **Task #62.1: Quaternion Rotation**: Implement quaternion-based rotation for `Object3D` and incorporate angular momentum into physics.
+ - [ ] **Task #62.2: Position Based Dynamics (PBD)**: Refactor solver to re-evaluate velocity after resolving all collisions and constraints.
+- [ ] **Task #63: Refactor large files**: Split `src/3d/renderer.cc` (currently > 500 lines) into sub-functionalities.
---
@@ -434,4 +540,4 @@ tools/timeline_editor/
---
-## Future Goals
+## Future Goals \ No newline at end of file