From c93b1fa60601054451fad1600f5fe9b91f81ae25 Mon Sep 17 00:00:00 2001 From: Samuliak Date: Tue, 2 Jul 2024 10:10:20 +0200 Subject: [PATCH] transform z position coordinate --- src/host_shaders/metal_shaders.metal | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/host_shaders/metal_shaders.metal b/src/host_shaders/metal_shaders.metal index 38bab7d3..5eeee24a 100644 --- a/src/host_shaders/metal_shaders.metal +++ b/src/host_shaders/metal_shaders.metal @@ -30,7 +30,9 @@ struct DrawVertexOut { vertex DrawVertexOut vertexDraw(DrawVertexIn in [[stage_in]]) { DrawVertexOut out; - out.position = float4(in.position.xy, 0.0, 1.0); // HACK + out.position = in.position; + // in.position.z is in range of [-1 ... 1], convert it to [0 ... 1] + out.position.z = (in.position.z + 1.0) * 0.5; out.color = in.color; return out;