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/visual_debug.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/3d/visual_debug.h') diff --git a/src/3d/visual_debug.h b/src/3d/visual_debug.h index 6173fc4..ebccf45 100644 --- a/src/3d/visual_debug.h +++ b/src/3d/visual_debug.h @@ -8,6 +8,7 @@ #include "gpu/gpu.h" #include "util/mini_math.h" +#include "3d/object.h" #include struct DebugLine { @@ -27,6 +28,8 @@ class VisualDebug { void add_aabb(const vec3& min, const vec3& max, const vec3& color); + void add_mesh_normals(const mat4& transform, uint32_t num_vertices, const MeshVertex* vertices); + // Render all queued primitives and clear the queue void render(WGPURenderPassEncoder pass, const mat4& view_proj); -- cgit v1.2.3