summaryrefslogtreecommitdiff
path: root/src/3d/object.h
AgeCommit message (Collapse)Author
11 hoursrefactor(build): Split asset_manager.h into dcl/core/utils headersskal
Split monolithic asset_manager.h (61 lines) into 3 focused headers: - asset_manager_dcl.h: Forward declarations (AssetId, ProcGenFunc) - asset_manager.h: Core API (GetAsset, DropAsset, AssetRecord) - asset_manager_utils.h: Typed helpers (TextureAsset, MeshAsset) Updated 17 source files to use appropriate headers: - object.h: Uses dcl.h (only needs AssetId forward declaration) - 7 files using TextureAsset/MeshAsset: Use utils.h - 10 files using only GetAsset(): Keep asset_manager.h Performance improvement: - Before: Touch asset_manager.h → 4.82s (35 files rebuild) - After: Touch asset_manager_utils.h → 2.01s (24 files rebuild) - Improvement: 58% faster for common workflow (tweaking mesh/texture helpers) Note: Touching base headers (dcl/core) still triggers ~33 file rebuilds due to object.h dependency chain. Further optimization would require reducing object.h's footprint (separate task). Files changed: - Created: asset_manager_dcl.h, asset_manager_utils.h - Modified: asset_manager.h (removed structs), asset_manager.cc - Updated: object.h, visual_debug.h, renderer_mesh.cc, flash_cube_effect.cc, hybrid_3d_effect.cc, test files
13 hoursfix: Correct mesh normal transformation and floor shadow renderingskal
14 hoursfeat(tests): Add test_mesh tool for OBJ loading and normal visualizationskal
Implemented a new standalone test tool 'test_mesh' to: - Load a .obj file specified via command line. - Display the mesh with rotation and basic lighting on a tiled floor. - Provide a '--debug' option to visualize vertex normals as cyan lines. - Updated asset_packer to auto-generate smooth normals for OBJs if missing. - Fixed various WGPU API usage inconsistencies and build issues on macOS. - Exposed Renderer3D::GetVisualDebug() for test access. - Added custom Vec3 struct and math utilities for OBJ parsing. This tool helps verify mesh ingestion and normal computation independently of the main demo logic.
15 hoursfeat(3d): Implement basic OBJ mesh asset pipelineskal
Added support for loading and rendering OBJ meshes. - Updated asset_packer to parse .obj files into a binary format. - Added MeshAsset and GetMeshAsset helper to asset_manager. - Extended Object3D with mesh_asset_id and ObjectType::MESH. - Implemented mesh rasterization pipeline in Renderer3D. - Added a sample cube mesh and verified in test_3d_render.
29 hoursfeat(physics): Implement SDF-based physics engine and BVHskal
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.
3 daysfix: Implement proper skybox rendering with Perlin noiseskal
- Added ObjectType::SKYBOX for dedicated skybox rendering. - Created assets/final/shaders/skybox.wgsl for background rendering. - Implemented a two-pass rendering strategy in Renderer3D::render: - First pass renders the skybox without depth writes. - Second pass renders scene objects with depth testing. - Corrected GlobalUniforms struct in common_uniforms.wgsl and src/3d/renderer.h to include and explicit padding for 112-byte alignment. - Updated Renderer3D::update_uniforms to set the new and zero-initialize padding. - Reverted sky sampling logic in renderer_3d.wgsl to for SDF misses, preventing background bleed-through. - Updated test_3d_render.cc to include a SKYBOX object with Perlin noise. handoff(Gemini): The skybox is now correctly rendered with Perlin noise as a dedicated background pass. Objects render correctly without transparency to the sky. All necessary C++ and WGSL shader changes are implemented and verified.
5 daysfeat: Implement hybrid rendering with SDF primitivesskal
- Added SDF logic for Sphere, Box, and Torus in WGSL. - Implemented hybrid normal calculation (analytical for sphere, numerical fallback). - Updated Renderer3D to dispatch object types to shader. - Updated test_3d_render to display mixed SDF shapes (Sphere, Torus, Box). - Added BOX to ObjectType enum.
5 daysfeat: Implement 3D system and procedural texture managerskal
- Extended mini_math.h with mat4 multiplication and affine transforms. - Implemented TextureManager for runtime procedural texture generation and GPU upload. - Added 3D system components: Camera, Object, Scene, and Renderer3D. - Created test_3d_render mini-demo for interactive 3D verification. - Fixed WebGPU validation errors regarding depthSlice and unimplemented WaitAny.