summaryrefslogtreecommitdiff
path: root/src/3d/renderer_pipelines.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-03-29 01:50:47 +0100
committerskal <pascal.massimino@gmail.com>2026-03-29 01:50:47 +0100
commita178de4e8680051925af9454b140343bf7eae214 (patch)
treee7c8cf472fb2ebe49ab015b2e3aecf61d2c3c6d6 /src/3d/renderer_pipelines.cc
parent70b77307a9a9ee4fdff23f783e041fe49e60e100 (diff)
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.
Diffstat (limited to 'src/3d/renderer_pipelines.cc')
-rw-r--r--src/3d/renderer_pipelines.cc5
1 files changed, 4 insertions, 1 deletions
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;