From 8ded2005d441f8aab44c833fc658d9622c788ebd Mon Sep 17 00:00:00 2001 From: skal Date: Fri, 6 Feb 2026 08:05:20 +0100 Subject: feat(tests): Add test_mesh tool for OBJ loading and normal visualization 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. --- src/3d/object.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/3d/object.h') diff --git a/src/3d/object.h b/src/3d/object.h index 0c8edd8..a7ce0b8 100644 --- a/src/3d/object.h +++ b/src/3d/object.h @@ -40,11 +40,12 @@ class Object3D { bool is_static; AssetId mesh_asset_id; + void* user_data; // For tool-specific data, not for general use Object3D(ObjectType t = ObjectType::CUBE) : position(0, 0, 0), rotation(0, 0, 0, 1), scale(1, 1, 1), type(t), color(1, 1, 1, 1), velocity(0, 0, 0), mass(1.0f), restitution(0.5f), - is_static(false), mesh_asset_id((AssetId)0) { + is_static(false), mesh_asset_id((AssetId)0), user_data(nullptr) { } mat4 get_model_matrix() const { -- cgit v1.2.3