From 78fb0cca208b3fc7e5c85d3b0668069f4000d4f6 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 29 Dec 2022 20:50:47 +0100 Subject: [PATCH] fixed apply_perspective to use the actual z to keep z-ordering correct --- hypgraph.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hypgraph.cpp b/hypgraph.cpp index d6f7b086..17a9d9c8 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -379,11 +379,11 @@ EX ld signed_sqrt(ld x) { return x > 0 ? sqrt(x) : -sqrt(-x); } EX int axial_x, axial_y; EX void apply_perspective(const hyperpoint& H, hyperpoint& ret) { - if(H[2] == 0) { ret[0] = 1e6; ret[1] = 1e6; ret[2] = 1; return; } + if(H[2] == 0) { ret[0] = 1e6; ret[1] = 1e6; ret[2] = 0; return; } ld ratio = vid.xres / current_display->tanfov / current_display->radius / 2; ret[0] = H[0]/H[2] * ratio; ret[1] = H[1]/H[2] * ratio; - ret[2] = 1; + ret[2] = H[2]; ret[3] = 1; }