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_pipelines.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/3d/renderer_pipelines.cc') diff --git a/src/3d/renderer_pipelines.cc b/src/3d/renderer_pipelines.cc index 3abc3bd..195baad 100644 --- a/src/3d/renderer_pipelines.cc +++ b/src/3d/renderer_pipelines.cc @@ -253,7 +253,10 @@ void Renderer3D::create_mesh_pipeline() { pipeline_desc.vertex.buffers = &vert_buffer_layout; pipeline_desc.primitive.topology = WGPUPrimitiveTopology_TriangleList; pipeline_desc.primitive.cullMode = WGPUCullMode_Back; - pipeline_desc.primitive.frontFace = WGPUFrontFace_CW; // Y-flipped perspective + // CW winding compensates for Y-negation in perspective() (post-process chain). + // Direct-to-surface rendering uses standard CCW winding. + pipeline_desc.primitive.frontFace = + direct_render_ ? WGPUFrontFace_CCW : WGPUFrontFace_CW; pipeline_desc.multisample.count = 1; pipeline_desc.fragment = &fragment_state; pipeline_desc.depthStencil = &depth_stencil; -- cgit v1.2.3