From d5fc277531825c21e24a68e7f7c86f22ceba506e Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 30 Dec 2020 20:21:07 +0100 Subject: [PATCH] 3D drawing --- hypgraph.cpp | 9 ++++++--- mapeditor.cpp | 2 +- vr.cpp | 17 +++++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/hypgraph.cpp b/hypgraph.cpp index 3b045c66..90fde66b 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -100,8 +100,8 @@ EX shiftmatrix minimize_point_value(shiftmatrix T, function > headset_desc = { {"none", "Ignore the headset movement and rotation."}, {"rotation only", "Ignore the headset movement but do not ignore its rotation."}, @@ -472,9 +474,15 @@ ld vr_distance(shiftpoint h, int id, ld& dist) { E4; hscr[3] = 1; hyperpoint hc = inverse(sm * hmd_at * vrdata.pose_matrix[id] * sm) * hmd_mv * hscr; - if(hc[2] > 0.1) return 1e6; /* behind */ - dist = -hc[2]; - return sqhypot_d(2, hc); + if(WDIM == 2) { + if(hc[2] > 0.1) return 1e6; /* behind */ + dist = -hc[2]; + return sqhypot_d(2, hc); + } + else { + hc[2] += dist; + return sqhypot_d(3, hc); + } } EX hyperpoint vr_direction; @@ -489,8 +497,9 @@ EX void compute_point(int id, shiftpoint& res, cell*& c, ld& dist) { movedir md = vectodir(vr_direction); cellwalker xc = cwt + md.d + wstep; forward_cell = xc.at; - return; } + + dist = pointer_length; gen_mv(); set_vr_sphere();