From 3569e4f2ed86b5bafc7a7d2dfa8529b507c70010 Mon Sep 17 00:00:00 2001 From: Moses Turner Date: Fri, 11 Jun 2021 11:56:35 -0500 Subject: [PATCH] d/ns: Fix 3D distortion FOV calc co-authored-by: Nico Zobernig --- src/xrt/drivers/north_star/ns_hmd.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/xrt/drivers/north_star/ns_hmd.c b/src/xrt/drivers/north_star/ns_hmd.c index 58b29b61a..e4f459634 100644 --- a/src/xrt/drivers/north_star/ns_hmd.c +++ b/src/xrt/drivers/north_star/ns_hmd.c @@ -8,6 +8,7 @@ * @author Nova King * @author Jakob Bornecrantz * @author Moses Turner + * @author Nico Zobernig * @ingroup drv_ns */ @@ -328,14 +329,12 @@ ns_3d_mesh_calc(struct xrt_device *xdev, int view, float u, float v, struct xrt_ static void ns_3d_fov_calculate(struct xrt_fov *fov, struct xrt_quat projection) -{ // All of these are wrong - gets "hidden" by the simple_fov making it look - // okay. Needs to be fixed. - - fov->angle_up = projection.x; // atanf(fabsf(projection.x) / - // near_plane); - fov->angle_down = projection.y; // atanf(fabsf(projection.y) / near_plane); - fov->angle_left = projection.z; // atanf(fabsf(projection.z) / near_plane); - fov->angle_right = projection.w; // atanf(fabsf(projection.w) / near_plane); +{ + // Million thanks to Nico Zobernig for figuring this out + fov->angle_left = atanf(projection.x); + fov->angle_right = atanf(projection.y); + fov->angle_up = atanf(projection.z); + fov->angle_down = atanf(projection.w); } /*