summaryrefslogtreecommitdiff
path: root/TODO.md
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-05 16:40:27 +0100
committerskal <pascal.massimino@gmail.com>2026-02-05 16:40:27 +0100
commitf6f3c13fcd287774a458730722854baab8a17366 (patch)
tree44420eecdd2e2dd84d68be12cb12641064eb1c5a /TODO.md
parent93a65b43094641b4c188b4fc260b8ed44c883728 (diff)
feat(physics): Implement SDF-based physics engine and BVH
Completed Task #49. - Implemented CPU-side SDF library (sphere, box, torus, plane). - Implemented Dynamic BVH construction (rebuilt every frame). - Implemented PhysicsSystem with semi-implicit Euler integration and collision resolution. - Added visual debugging for BVH nodes. - Created test_3d_physics interactive test and test_physics unit tests. - Updated project docs and triaged new tasks.
Diffstat (limited to 'TODO.md')
-rw-r--r--TODO.md40
1 files changed, 18 insertions, 22 deletions
diff --git a/TODO.md b/TODO.md
index 38b0ad3..3322304 100644
--- a/TODO.md
+++ b/TODO.md
@@ -2,7 +2,13 @@
This file tracks prioritized tasks with detailed attack plans.
-## Recently Completed (February 4, 2026)
+## Recently Completed (February 5, 2026)
+
+- [x] **Physics & Collision (Task #49)**:
+ - [x] **CPU-Side SDF Library**: Implemented `sdSphere`, `sdBox`, `sdTorus`, `sdPlane` in `src/3d/sdf_cpu.h` using `mini_math.h`. Added `calc_normal` for numerical gradients.
+ - [x] **BVH Construction**: Implemented `BVHNode` and `BVHBuilder` in `src/3d/bvh.h/cc`. Optimized broad-phase collision queries with `BVH::Query`.
+ - [x] **Physics System**: Created `PhysicsSystem` in `src/3d/physics.h/cc` implementing semi-implicit Euler integration, broad-phase BVH culling, and narrow-phase SDF proxy probing.
+ - [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.
@@ -107,33 +113,23 @@ This file tracks prioritized tasks with detailed attack plans.
- [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.
-## Priority 1: Physics & Collision (Task #49)
-**Goal**: Implement a lightweight physics engine using SDFs and BVH acceleration. (See `doc/3D.md` for design).
-
-- [ ] **Task #49.1: CPU-Side SDF Library**:
- - [ ] Create `src/3d/sdf_cpu.h` implementing `sdSphere`, `sdBox`, `sdTorus`, `sdPlane` using `mini_math.h`.
- - [ ] Implement `calc_normal` (numerical gradient) for these SDFs.
- - [ ] Add unit tests in `src/tests/test_physics.cc` to verify CPU SDFs match ground truth.
-
-- [ ] **Task #49.2: BVH Construction**:
- - [ ] Define `BVHNode` struct in `src/3d/bvh.h` (shared/compatible with GPU layout).
- - [ ] Implement `BVHBuilder::Build(const std::vector<Object3D>&)` in `src/3d/bvh.cc`.
- - [ ] Implement `BVH::Query(AABB)` for broad-phase collision detection.
- - [ ] Visualize BVH in `src/tests/test_3d_render.cc` (using `VisualDebug`).
-
-- [ ] **Task #49.3: Physics Loop**:
- - [ ] Create `PhysicsSystem` class in `src/3d/physics.h`.
- - [ ] Implement `Update(dt)`: Integration -> Broad Phase -> Narrow Phase (SDF Probe) -> Resolution.
- - [ ] Add `velocity`, `mass`, `restitution` fields to `Object3D`.
- - [ ] Integrate into `test_3d_render.cc` main loop.
-
## 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.
- [ ] **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.
+ - [ ] **Task #38: Runtime Loader:** Implement a minimal C++ parser to load the scene data into the ECS/Renderer.
+
+- [ ] **Task #18-B: GPU BVH & Shadows** (Optimization)
+ - [ ] **Upload BVH:** Create a storage buffer for `BVHNode` data and upload the CPU-built BVH every frame in `Renderer3D`.
+ - [ ] **Shader Traversal:** Implement stack-based BVH traversal in `scene_query.wgsl` to replace the linear loop in `map_scene`.
+ - [ ] **Shadow Optimization:** Use the BVH traversal for `calc_shadow` to skip occluded objects efficiently.
## Priority 3: WGSL Modularization (Task #50) [RECURRENT]
+
**Goal**: Refactor `ShaderComposer` and WGSL assets to support granular, reusable snippets and `#include` directives. This is an ongoing task to maintain shader code hygiene as new features are added.
## Priority 4: Developer Tooling & CI