flip y positions

This commit is contained in:
Samuliak 2024-07-02 16:58:29 +02:00
parent 56262c2c24
commit cd12d88994

View file

@ -10,6 +10,7 @@ vertex DisplayVertexOut vertexDisplay(uint vid [[vertex_id]]) {
DisplayVertexOut out;
out.uv = float2((vid << 1) & 2, vid & 2);
out.position = float4(out.uv * 2.0f + -1.0f, 0.0f, 1.0f);
out.position.y = -out.position.y;
return out;
}
@ -86,6 +87,8 @@ vertex DrawVertexOut vertexDraw(DrawVertexIn in [[stage_in]], constant PicaRegs&
out.position = in.position;
// HACK: rotate the position
out.position.xy = -out.position.yx;
// Flip the y position
out.position.y = -out.position.y;
// in.position.z is in range of [-1 ... 1], convert it to [0 ... 1]
out.position.z = (in.position.z + 1.0) * 0.5;