From a178de4e8680051925af9454b140343bf7eae214 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 29 Mar 2026 01:50:47 +0100 Subject: fix(3d): restore correct orientation in test_3d_render (direct-to-surface) Add Renderer3D::set_direct_render(bool) flag (must be set before init()). When true, uses standard CCW winding and un-negates perspective Y, restoring the pre-ba7ea27 orientation for direct-to-surface rendering where the post-process Y-flip is absent. handoff(Gemini): set_direct_render() is the escape hatch for any future renderer usage that bypasses the post-process chain. --- src/3d/renderer.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/3d/renderer.h') diff --git a/src/3d/renderer.h b/src/3d/renderer.h index 11a7931..8f933b5 100644 --- a/src/3d/renderer.h +++ b/src/3d/renderer.h @@ -78,6 +78,10 @@ class Renderer3D { bvh_enabled_ = enabled; } + // Call before init(). When true, renders directly to surface (no post-process + // Y-flip): uses standard perspective (Y not negated) and CCW winding. + void set_direct_render(bool v) { direct_render_ = v; } + struct MeshGpuData { WGPUBuffer vertex_buffer; WGPUBuffer index_buffer; @@ -120,6 +124,7 @@ class Renderer3D { BVH cpu_bvh_; // Keep a CPU-side copy for building/uploading bool bvh_enabled_ = true; + bool direct_render_ = false; // true = render to surface (no post-process flip) std::map mesh_cache_; const MeshGpuData* temp_mesh_override_ = nullptr; // HACK for test_mesh tool -- cgit v1.2.3