diff options
Diffstat (limited to 'PROJECT_CONTEXT.md')
| -rw-r--r-- | PROJECT_CONTEXT.md | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/PROJECT_CONTEXT.md b/PROJECT_CONTEXT.md index 24b1517..5afc7a7 100644 --- a/PROJECT_CONTEXT.md +++ b/PROJECT_CONTEXT.md @@ -37,13 +37,30 @@ Incoming tasks in no particular order: - [x] 9. work on the compact in-line and off-line asset system (@ASSET_SYSTEM.md) - 10. optimize spectool to remove trailing zeroes from a spec file before saving it - [x] 11. implement a general [time / timer / beat] system in the demo, for effects timing -- 12. Implement 'Sequence' and 'Effect' system: - - `Effect` interface: `start()`, `draw(time, beat, intensity)`, `end()`. - - `Sequence` manager: Handles a list of potentially overlapping effects. - - `time` is relative to sequence start. `beat` is a [0..1] pulse. `intensity` is signal strength (e.g. music level). +- [x] 12. Implement 'Sequence' and 'Effect' system: + - `Effect` interface: `init`, `start`, `compute`, `render`, `end`, `priority`. + - `Sequence` manager: Handles a list of temporally sorted `SequenceItem`s. + - `MainSequence`: Manages global resources (`device`, `queue`) and orchestrates the frame render. + - Refactored `gpu.cc` to use `MainSequence`. + - Moved concrete effects to `src/gpu/demo_effects.cc`. ## Session Decisions and Current State +### Sequence & Effect System +- **Architecture**: Implemented a hierarchical sequencing system. + - **Effect**: Abstract base for visual elements. Supports `compute` (physics) and `render` (draw) phases. Idempotent `init` for shared asset loading. + - **Sequence**: Manages a timeline of effects with `start_time` and `end_time`. Handles activation/deactivation and sorting by priority. + - **MainSequence**: The top-level coordinator. Holds the WebGPU device/queue/surface. Manages multiple overlapping `Sequence` layers (sorted by priority). +- **Implementation**: + - `src/gpu/gpu.cc`: Simplified to be a thin wrapper initializing and driving `MainSequence`. + - `src/gpu/demo_effects.h/cc`: Concrete implementations of `HeptagonEffect` and `ParticlesEffect`. +- **Integration**: The main loop now calculates fractional beats and passes them along with `time` and `aspect_ratio` to the rendering system. + +### Debugging Features +- **Fast Forward / Seek**: Implemented `--seek <seconds>` CLI option. + - **Mechanism**: Simulates logic, audio (silent render), and GPU compute (physics) frame-by-frame from `t=0` to `target_time` before starting real-time playback. + - **Audio Refactor**: Split `audio_init()` (resource allocation) from `audio_start()` (device callback start) to allow manual `audio_render_silent()` during the seek phase. + ### Asset Management System: - **Architecture**: Implemented a C++ tool (`asset_packer`) that bundles external files into hex-encoded C arrays. - **Lookup**: Uses a highly efficient array-based lookup (AssetRecord) for O(1) retrieval of raw byte data at runtime. |
