From 996a5d3e9a834ca8e4255cbf8f3245a6154cda12 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Sat, 19 Feb 2022 01:46:39 +0100 Subject: [PATCH] xrt: Move fov from xrt_view to xrt_hmd_parts::distortion --- src/xrt/auxiliary/util/u_device.c | 32 +++++++++---------- src/xrt/auxiliary/util/u_distortion.c | 4 +-- src/xrt/compositor/render/comp_resources.c | 2 +- src/xrt/drivers/hdk/hdk_device.cpp | 10 +++--- src/xrt/drivers/north_star/ns_hmd.c | 16 +++++----- src/xrt/drivers/ohmd/oh_device.c | 10 +++--- src/xrt/drivers/sample/sample_hmd.c | 4 +-- src/xrt/drivers/survive/survive_driver.c | 2 +- src/xrt/drivers/vive/vive_device.c | 2 +- src/xrt/drivers/wmr/wmr_hmd.c | 19 +++++------ src/xrt/include/xrt/xrt_device.h | 8 ++--- src/xrt/ipc/client/ipc_client_hmd.c | 4 +-- src/xrt/ipc/server/ipc_server_process.c | 4 +-- src/xrt/state_trackers/oxr/oxr_instance.c | 16 +++++----- src/xrt/state_trackers/oxr/oxr_session.c | 2 +- .../steamvr_drv/ovrd_driver.cpp | 8 ++--- 16 files changed, 71 insertions(+), 72 deletions(-) diff --git a/src/xrt/auxiliary/util/u_device.c b/src/xrt/auxiliary/util/u_device.c index 8dfd7d86b..690a3154b 100644 --- a/src/xrt/auxiliary/util/u_device.c +++ b/src/xrt/auxiliary/util/u_device.c @@ -101,11 +101,11 @@ u_device_dump_config(struct xrt_device *xdev, const char *prefix, const char *pr PRINT_INT( "views[0].display.w_pixels ", xdev->hmd->views[0].display.w_pixels); PRINT_INT( "views[0].display.h_pixels ", xdev->hmd->views[0].display.h_pixels); PRINT_MAT2X2("views[0].rot ", xdev->hmd->views[0].rot); - PRINT_ANGLE( "views[0].fov.angle_left ", xdev->hmd->views[0].fov.angle_left); - PRINT_ANGLE( "views[0].fov.angle_right", xdev->hmd->views[0].fov.angle_right); - PRINT_ANGLE( "views[0].fov.angle_up ", xdev->hmd->views[0].fov.angle_up); - PRINT_ANGLE( "views[0].fov.angle_down ", xdev->hmd->views[0].fov.angle_down); -// PRINT_ANGLE( "info.views[0].fov ", info.views[0].fov); + PRINT_ANGLE( "distortion.fov[0].angle_left ", xdev->hmd->distortion.fov[0].angle_left); + PRINT_ANGLE( "distortion.fov[0].angle_right", xdev->hmd->distortion.fov[0].angle_right); + PRINT_ANGLE( "distortion.fov[0].angle_up ", xdev->hmd->distortion.fov[0].angle_up); + PRINT_ANGLE( "distortion.fov[0].angle_down ", xdev->hmd->distortion.fov[0].angle_down); +// PRINT_ANGLE( "distortion.fov[0] ", xdev->hmd->distortion.fov[0]); PRINT_INT( "views[1].viewport.x_pixels ", xdev->hmd->views[1].viewport.x_pixels); PRINT_INT( "views[1].viewport.y_pixels ", xdev->hmd->views[1].viewport.y_pixels); PRINT_INT( "views[1].viewport.w_pixels ", xdev->hmd->views[1].viewport.w_pixels); @@ -113,11 +113,11 @@ u_device_dump_config(struct xrt_device *xdev, const char *prefix, const char *pr PRINT_INT( "views[1].display.w_pixels ", xdev->hmd->views[1].display.w_pixels); PRINT_INT( "views[1].display.h_pixels ", xdev->hmd->views[1].display.h_pixels); PRINT_MAT2X2("views[1].rot ", xdev->hmd->views[1].rot); - PRINT_ANGLE( "views[1].fov.angle_left ", xdev->hmd->views[1].fov.angle_left); - PRINT_ANGLE( "views[1].fov.angle_right", xdev->hmd->views[1].fov.angle_right); - PRINT_ANGLE( "views[1].fov.angle_up ", xdev->hmd->views[1].fov.angle_up); - PRINT_ANGLE( "views[1].fov.angle_down ", xdev->hmd->views[1].fov.angle_down); -// PRINT_ANGLE( "info.views[1].fov ", info.views[0].fov); + PRINT_ANGLE( "distortion.fov[1].angle_left ", xdev->hmd->distortion.fov[1].angle_left); + PRINT_ANGLE( "distortion.fov[1].angle_right", xdev->hmd->distortion.fov[1].angle_right); + PRINT_ANGLE( "distortion.fov[1].angle_up ", xdev->hmd->distortion.fov[1].angle_up); + PRINT_ANGLE( "distortion.fov[1].angle_down ", xdev->hmd->distortion.fov[1].angle_down); +// PRINT_ANGLE( "distortion.fov[1] ", xdev->hmd->distortion.fov[1]); } // clang-format on } @@ -209,17 +209,17 @@ u_device_setup_split_side_by_side(struct xrt_device *xdev, const struct u_device { /* right eye */ if (!math_compute_fovs(w_meters, lens_center_x_meters[1], info->views[1].fov, h_meters, - lens_center_y_meters[1], 0, &xdev->hmd->views[1].fov)) { + lens_center_y_meters[1], 0, &xdev->hmd->distortion.fov[1])) { return false; } } { /* left eye - just mirroring right eye now */ - xdev->hmd->views[0].fov.angle_up = xdev->hmd->views[1].fov.angle_up; - xdev->hmd->views[0].fov.angle_down = xdev->hmd->views[1].fov.angle_down; + xdev->hmd->distortion.fov[0].angle_up = xdev->hmd->distortion.fov[1].angle_up; + xdev->hmd->distortion.fov[0].angle_down = xdev->hmd->distortion.fov[1].angle_down; - xdev->hmd->views[0].fov.angle_left = -xdev->hmd->views[1].fov.angle_right; - xdev->hmd->views[0].fov.angle_right = -xdev->hmd->views[1].fov.angle_left; + xdev->hmd->distortion.fov[0].angle_left = -xdev->hmd->distortion.fov[1].angle_right; + xdev->hmd->distortion.fov[0].angle_right = -xdev->hmd->distortion.fov[1].angle_left; } return true; @@ -457,7 +457,7 @@ u_device_get_view_poses(struct xrt_device *xdev, xrt_device_get_tracked_pose(xdev, XRT_INPUT_GENERIC_HEAD_POSE, at_timestamp_ns, out_head_relation); for (uint32_t i = 0; i < view_count && i < ARRAY_SIZE(xdev->hmd->views); i++) { - out_fovs[i] = xdev->hmd->views[i].fov; + out_fovs[i] = xdev->hmd->distortion.fov[i]; } for (uint32_t i = 0; i < view_count; i++) { diff --git a/src/xrt/auxiliary/util/u_distortion.c b/src/xrt/auxiliary/util/u_distortion.c index 2f5ffbfdd..e1e4fd78f 100644 --- a/src/xrt/auxiliary/util/u_distortion.c +++ b/src/xrt/auxiliary/util/u_distortion.c @@ -46,7 +46,7 @@ u_distortion_cardboard_calculate(const struct u_cardboard_distortion_arguments * parts->views[0].display.w_pixels = w_pixels; parts->views[0].display.h_pixels = h_pixels; parts->views[0].rot = u_device_rotation_ident; - parts->views[0].fov = args->fov; + parts->distortion.fov[0] = args->fov; parts->views[1].viewport.x_pixels = w_pixels; parts->views[1].viewport.y_pixels = 0; @@ -55,7 +55,7 @@ u_distortion_cardboard_calculate(const struct u_cardboard_distortion_arguments * parts->views[1].display.w_pixels = w_pixels; parts->views[1].display.h_pixels = h_pixels; parts->views[1].rot = u_device_rotation_ident; - parts->views[1].fov = args->fov; + parts->distortion.fov[1] = args->fov; /* diff --git a/src/xrt/compositor/render/comp_resources.c b/src/xrt/compositor/render/comp_resources.c index 1eaf67577..b3753616b 100644 --- a/src/xrt/compositor/render/comp_resources.c +++ b/src/xrt/compositor/render/comp_resources.c @@ -392,7 +392,7 @@ struct tan_angles_transforms static void calc_uv_to_tanangle(struct xrt_device *xdev, uint32_t view, struct xrt_normalized_rect *out_rect) { - const struct xrt_fov fov = xdev->hmd->views[view].fov; + const struct xrt_fov fov = xdev->hmd->distortion.fov[view]; const double tan_left = tan(fov.angle_left); const double tan_right = tan(fov.angle_right); diff --git a/src/xrt/drivers/hdk/hdk_device.cpp b/src/xrt/drivers/hdk/hdk_device.cpp index 4ba903b10..4c9a899b9 100644 --- a/src/xrt/drivers/hdk/hdk_device.cpp +++ b/src/xrt/drivers/hdk/hdk_device.cpp @@ -359,15 +359,15 @@ hdk_device_create(struct os_hid_device *dev, enum HDK_VARIANT variant) { /* right eye */ math_compute_fovs(1.0, hCOP, hFOV * DEGREES_TO_RADIANS, 1, vCOP, vFOV * DEGREES_TO_RADIANS, - &hd->base.hmd->views[1].fov); + &hd->base.hmd->distortion.fov[1]); } { /* left eye - just mirroring right eye now */ - hd->base.hmd->views[0].fov.angle_up = hd->base.hmd->views[1].fov.angle_up; - hd->base.hmd->views[0].fov.angle_down = hd->base.hmd->views[1].fov.angle_down; + hd->base.hmd->distortion.fov[0].angle_up = hd->base.hmd->distortion.fov[1].angle_up; + hd->base.hmd->distortion.fov[0].angle_down = hd->base.hmd->distortion.fov[1].angle_down; - hd->base.hmd->views[0].fov.angle_left = -hd->base.hmd->views[1].fov.angle_right; - hd->base.hmd->views[0].fov.angle_right = -hd->base.hmd->views[1].fov.angle_left; + hd->base.hmd->distortion.fov[0].angle_left = -hd->base.hmd->distortion.fov[1].angle_right; + hd->base.hmd->distortion.fov[0].angle_right = -hd->base.hmd->distortion.fov[1].angle_left; } switch (variant) { diff --git a/src/xrt/drivers/north_star/ns_hmd.c b/src/xrt/drivers/north_star/ns_hmd.c index 4516a5ee3..c39818809 100644 --- a/src/xrt/drivers/north_star/ns_hmd.c +++ b/src/xrt/drivers/north_star/ns_hmd.c @@ -204,11 +204,11 @@ ns_vipd_parse(struct ns_hmd *ns) try_get_fov(ns, config_json, &temp_data->fov[0], &temp_data->fov[1]); // stupid - memcpy(&ns->base.hmd->views[0].fov, &temp_data->fov[0], sizeof(struct xrt_fov)); - memcpy(&ns->base.hmd->views[1].fov, &temp_data->fov[1], sizeof(struct xrt_fov)); + memcpy(&ns->base.hmd->distortion.fov[0], &temp_data->fov[0], sizeof(struct xrt_fov)); + memcpy(&ns->base.hmd->distortion.fov[1], &temp_data->fov[1], sizeof(struct xrt_fov)); - printf("%f %f %f %f\n", ns->base.hmd->views[1].fov.angle_down, ns->base.hmd->views[1].fov.angle_left, - ns->base.hmd->views[1].fov.angle_right, ns->base.hmd->views[1].fov.angle_up); + printf("%f %f %f %f\n", ns->base.hmd->distortion.fov[1].angle_down, ns->base.hmd->distortion.fov[1].angle_left, + ns->base.hmd->distortion.fov[1].angle_right, ns->base.hmd->distortion.fov[1].angle_up); ns->head_pose_to_eye[0].orientation.x = 0.0f; ns->head_pose_to_eye[0].orientation.y = 0.0f; @@ -287,8 +287,8 @@ ns_p2d_parse(struct ns_hmd *ns) try_get_fov(ns, config_json, &ns->dist_p2d.fov[0], &ns->dist_p2d.fov[1]); - memcpy(&ns->base.hmd->views[0].fov, &ns->dist_p2d.fov[0], sizeof(struct xrt_fov)); - memcpy(&ns->base.hmd->views[1].fov, &ns->dist_p2d.fov[1], sizeof(struct xrt_fov)); + memcpy(&ns->base.hmd->distortion.fov[0], &ns->dist_p2d.fov[0], sizeof(struct xrt_fov)); + memcpy(&ns->base.hmd->distortion.fov[1], &ns->dist_p2d.fov[1], sizeof(struct xrt_fov)); ns->base.compute_distortion = &ns_p2d_mesh_calc; memcpy(&ns->head_pose_to_eye, &temp_eyes_center_to_eye, sizeof(struct xrt_pose) * 2); @@ -399,8 +399,8 @@ ns_3d_parse(struct ns_hmd *ns) goto cleanup_l3d; // Locked in, okay to touch anything inside ns struct - ns_3d_fov_calculate(&ns->base.hmd->views[0].fov, our_ns_3d_data->eyes[0].camera_projection); - ns_3d_fov_calculate(&ns->base.hmd->views[1].fov, our_ns_3d_data->eyes[1].camera_projection); + ns_3d_fov_calculate(&ns->base.hmd->distortion.fov[0], our_ns_3d_data->eyes[0].camera_projection); + ns_3d_fov_calculate(&ns->base.hmd->distortion.fov[1], our_ns_3d_data->eyes[1].camera_projection); ns->head_pose_to_eye[0] = our_ns_3d_data->eyes[0].eye_pose; // Left eye. ns->head_pose_to_eye[1] = our_ns_3d_data->eyes[1].eye_pose; // Right eye. diff --git a/src/xrt/drivers/ohmd/oh_device.c b/src/xrt/drivers/ohmd/oh_device.c index 1a42e33a6..5e9e095d5 100644 --- a/src/xrt/drivers/ohmd/oh_device.c +++ b/src/xrt/drivers/ohmd/oh_device.c @@ -740,7 +740,7 @@ create_hmd(ohmd_context *ctx, int device_idx, int device_flags) /* right eye */ if (!math_compute_fovs(info.views[1].display.w_meters, info.views[1].lens_center_x_meters, info.views[1].fov, info.views[1].display.h_meters, - info.views[1].lens_center_y_meters, 0, &ohd->base.hmd->views[1].fov)) { + info.views[1].lens_center_y_meters, 0, &ohd->base.hmd->distortion.fov[1])) { OHMD_ERROR(ohd, "Failed to compute the partial fields of view."); free(ohd); return NULL; @@ -748,11 +748,11 @@ create_hmd(ohmd_context *ctx, int device_idx, int device_flags) } { /* left eye - just mirroring right eye now */ - ohd->base.hmd->views[0].fov.angle_up = ohd->base.hmd->views[1].fov.angle_up; - ohd->base.hmd->views[0].fov.angle_down = ohd->base.hmd->views[1].fov.angle_down; + ohd->base.hmd->distortion.fov[0].angle_up = ohd->base.hmd->distortion.fov[1].angle_up; + ohd->base.hmd->distortion.fov[0].angle_down = ohd->base.hmd->distortion.fov[1].angle_down; - ohd->base.hmd->views[0].fov.angle_left = -ohd->base.hmd->views[1].fov.angle_right; - ohd->base.hmd->views[0].fov.angle_right = -ohd->base.hmd->views[1].fov.angle_left; + ohd->base.hmd->distortion.fov[0].angle_left = -ohd->base.hmd->distortion.fov[1].angle_right; + ohd->base.hmd->distortion.fov[0].angle_right = -ohd->base.hmd->distortion.fov[1].angle_left; } // clang-format off diff --git a/src/xrt/drivers/sample/sample_hmd.c b/src/xrt/drivers/sample/sample_hmd.c index 136bd344e..13711b387 100644 --- a/src/xrt/drivers/sample/sample_hmd.c +++ b/src/xrt/drivers/sample/sample_hmd.c @@ -150,12 +150,12 @@ sample_hmd_create(void) const double vCOP = 0.5; if ( /* right eye */ - !math_compute_fovs(1, hCOP, hFOV, 1, vCOP, vFOV, &sh->base.hmd->views[1].fov) || + !math_compute_fovs(1, hCOP, hFOV, 1, vCOP, vFOV, &sh->base.hmd->distortion.fov[1]) || /* * left eye - same as right eye, except the horizontal center of projection is moved in the opposite * direction now */ - !math_compute_fovs(1, 1.0 - hCOP, hFOV, 1, vCOP, vFOV, &sh->base.hmd->views[0].fov)) { + !math_compute_fovs(1, 1.0 - hCOP, hFOV, 1, vCOP, vFOV, &sh->base.hmd->distortion.fov[0])) { // If those failed, it means our math was impossible. SH_ERROR(sh, "Failed to setup basic device info"); sample_hmd_destroy(&sh->base); diff --git a/src/xrt/drivers/survive/survive_driver.c b/src/xrt/drivers/survive/survive_driver.c index 449ee08b1..1ac8e6e67 100644 --- a/src/xrt/drivers/survive/survive_driver.c +++ b/src/xrt/drivers/survive/survive_driver.c @@ -912,7 +912,7 @@ _create_hmd_device(struct survive_system *sys, const struct SurviveSimpleObject for (uint8_t eye = 0; eye < 2; eye++) { if (!math_compute_fovs(w_meters, (double)lens_center[eye].x, fov, h_meters, (double)lens_center[eye].y, - 0, &survive->base.hmd->views[eye].fov)) { + 0, &survive->base.hmd->distortion.fov[eye])) { SURVIVE_ERROR(survive, "Failed to compute the partial fields of view."); free(survive); return NULL; diff --git a/src/xrt/drivers/vive/vive_device.c b/src/xrt/drivers/vive/vive_device.c index 6f2797a56..2d111ebc1 100644 --- a/src/xrt/drivers/vive/vive_device.c +++ b/src/xrt/drivers/vive/vive_device.c @@ -855,7 +855,7 @@ vive_device_create(struct os_hid_device *mainboard_dev, for (uint8_t eye = 0; eye < 2; eye++) { if (!math_compute_fovs(w_meters, (double)lens_center[eye].x, fov, h_meters, (double)lens_center[eye].y, - 0, &d->base.hmd->views[eye].fov)) { + 0, &d->base.hmd->distortion.fov[eye])) { VIVE_ERROR(d, "Failed to compute the partial fields of view."); free(d); return NULL; diff --git a/src/xrt/drivers/wmr/wmr_hmd.c b/src/xrt/drivers/wmr/wmr_hmd.c index 64cd51227..5ed3c9894 100644 --- a/src/xrt/drivers/wmr/wmr_hmd.c +++ b/src/xrt/drivers/wmr/wmr_hmd.c @@ -1406,18 +1406,19 @@ wmr_hmd_create(enum wmr_headset_type hmd_type, math_matrix_3x3_inverse(&wh->config.eye_params[eye].affine_xform, &wh->distortion_params[eye].inv_affine_xform); - compute_distortion_bounds( - wh, eye, &wh->base.hmd->views[eye].fov.angle_left, &wh->base.hmd->views[eye].fov.angle_right, - &wh->base.hmd->views[eye].fov.angle_down, &wh->base.hmd->views[eye].fov.angle_up); + compute_distortion_bounds(wh, eye, &wh->base.hmd->distortion.fov[eye].angle_left, + &wh->base.hmd->distortion.fov[eye].angle_right, + &wh->base.hmd->distortion.fov[eye].angle_down, + &wh->base.hmd->distortion.fov[eye].angle_up); WMR_INFO(wh, "FoV eye %d angles left %f right %f down %f up %f", eye, - wh->base.hmd->views[eye].fov.angle_left, wh->base.hmd->views[eye].fov.angle_right, - wh->base.hmd->views[eye].fov.angle_down, wh->base.hmd->views[eye].fov.angle_up); + wh->base.hmd->distortion.fov[eye].angle_left, wh->base.hmd->distortion.fov[eye].angle_right, + wh->base.hmd->distortion.fov[eye].angle_down, wh->base.hmd->distortion.fov[eye].angle_up); - wh->distortion_params[eye].tex_x_range.x = tanf(wh->base.hmd->views[eye].fov.angle_left); - wh->distortion_params[eye].tex_x_range.y = tanf(wh->base.hmd->views[eye].fov.angle_right); - wh->distortion_params[eye].tex_y_range.x = tanf(wh->base.hmd->views[eye].fov.angle_down); - wh->distortion_params[eye].tex_y_range.y = tanf(wh->base.hmd->views[eye].fov.angle_up); + wh->distortion_params[eye].tex_x_range.x = tanf(wh->base.hmd->distortion.fov[eye].angle_left); + wh->distortion_params[eye].tex_x_range.y = tanf(wh->base.hmd->distortion.fov[eye].angle_right); + wh->distortion_params[eye].tex_y_range.x = tanf(wh->base.hmd->distortion.fov[eye].angle_down); + wh->distortion_params[eye].tex_y_range.y = tanf(wh->base.hmd->distortion.fov[eye].angle_up); WMR_INFO(wh, "Render texture range %f, %f to %f, %f", wh->distortion_params[eye].tex_x_range.x, wh->distortion_params[eye].tex_y_range.x, wh->distortion_params[eye].tex_x_range.y, diff --git a/src/xrt/include/xrt/xrt_device.h b/src/xrt/include/xrt/xrt_device.h index 5ac6cb80e..4a9ab64d5 100644 --- a/src/xrt/include/xrt/xrt_device.h +++ b/src/xrt/include/xrt/xrt_device.h @@ -75,11 +75,6 @@ struct xrt_view * the vertex positions. */ struct xrt_matrix_2x2 rot; - - /*! - * FoV expressed as in OpenXR. - */ - struct xrt_fov fov; }; /*! @@ -148,6 +143,9 @@ struct xrt_hmd_parts //! Total number of elements in mesh::indices array. uint32_t index_count_total; } mesh; + + //! distortion is subject to the field of view + struct xrt_fov fov[2]; } distortion; }; diff --git a/src/xrt/ipc/client/ipc_client_hmd.c b/src/xrt/ipc/client/ipc_client_hmd.c index 4e66e44fa..34a9f7956 100644 --- a/src/xrt/ipc/client/ipc_client_hmd.c +++ b/src/xrt/ipc/client/ipc_client_hmd.c @@ -198,10 +198,10 @@ ipc_client_hmd_create(struct ipc_connection *ipc_c, struct xrt_tracking_origin * ich->base.hmd->views[0].display.w_pixels = ipc_c->ism->hmd.views[0].display.w_pixels; ich->base.hmd->views[0].display.h_pixels = ipc_c->ism->hmd.views[0].display.h_pixels; - ich->base.hmd->views[0].fov = ipc_c->ism->hmd.views[0].fov; + ich->base.hmd->distortion.fov[0] = ipc_c->ism->hmd.views[0].fov; ich->base.hmd->views[1].display.w_pixels = ipc_c->ism->hmd.views[1].display.w_pixels; ich->base.hmd->views[1].display.h_pixels = ipc_c->ism->hmd.views[1].display.h_pixels; - ich->base.hmd->views[1].fov = ipc_c->ism->hmd.views[1].fov; + ich->base.hmd->distortion.fov[1] = ipc_c->ism->hmd.views[1].fov; // Distortion information, fills in xdev->compute_distortion(). u_distortion_mesh_set_none(&ich->base); diff --git a/src/xrt/ipc/server/ipc_server_process.c b/src/xrt/ipc/server/ipc_server_process.c index d4c251440..e7362595e 100644 --- a/src/xrt/ipc/server/ipc_server_process.c +++ b/src/xrt/ipc/server/ipc_server_process.c @@ -252,10 +252,10 @@ init_shm(struct ipc_server *s) if (xdev->hmd != NULL) { ism->hmd.views[0].display.w_pixels = xdev->hmd->views[0].display.w_pixels; ism->hmd.views[0].display.h_pixels = xdev->hmd->views[0].display.h_pixels; - ism->hmd.views[0].fov = xdev->hmd->views[0].fov; + ism->hmd.views[0].fov = xdev->hmd->distortion.fov[0]; ism->hmd.views[1].display.w_pixels = xdev->hmd->views[1].display.w_pixels; ism->hmd.views[1].display.h_pixels = xdev->hmd->views[1].display.h_pixels; - ism->hmd.views[1].fov = xdev->hmd->views[1].fov; + ism->hmd.views[1].fov = xdev->hmd->distortion.fov[1]; for (size_t i = 0; i < xdev->hmd->blend_mode_count; i++) { // Not super necessary, we also do this assert in oxr_system.c diff --git a/src/xrt/state_trackers/oxr/oxr_instance.c b/src/xrt/state_trackers/oxr/oxr_instance.c index d8155d07a..8392f93d6 100644 --- a/src/xrt/state_trackers/oxr/oxr_instance.c +++ b/src/xrt/state_trackers/oxr/oxr_instance.c @@ -326,8 +326,8 @@ oxr_instance_create(struct oxr_logger *log, "and right eye angle_right with %f radians (%i°)", left_override, radtodeg_for_display(left_override), -left_override, radtodeg_for_display(-left_override)); - dev->hmd->views[0].fov.angle_left = left_override; - dev->hmd->views[1].fov.angle_right = -left_override; + dev->hmd->distortion.fov[0].angle_left = left_override; + dev->hmd->distortion.fov[1].angle_right = -left_override; } const float right_override = debug_get_float_option_lfov_right(); @@ -337,24 +337,24 @@ oxr_instance_create(struct oxr_logger *log, "and right eye angle_left with %f radians (%i°)", right_override, radtodeg_for_display(right_override), -right_override, radtodeg_for_display(-right_override)); - dev->hmd->views[0].fov.angle_right = right_override; - dev->hmd->views[1].fov.angle_left = -right_override; + dev->hmd->distortion.fov[0].angle_right = right_override; + dev->hmd->distortion.fov[1].angle_left = -right_override; } const float up_override = debug_get_float_option_lfov_up(); if (up_override != 0.0f) { U_LOG_I("Overriding both eyes angle_up with %f radians (%i°)", up_override, radtodeg_for_display(up_override)); - dev->hmd->views[0].fov.angle_up = up_override; - dev->hmd->views[1].fov.angle_up = up_override; + dev->hmd->distortion.fov[0].angle_up = up_override; + dev->hmd->distortion.fov[1].angle_up = up_override; } const float down_override = debug_get_float_option_lfov_down(); if (down_override != 0.0f) { U_LOG_I("Overriding both eyes angle_down with %f radians (%i°)", down_override, radtodeg_for_display(down_override)); - dev->hmd->views[0].fov.angle_down = down_override; - dev->hmd->views[1].fov.angle_down = down_override; + dev->hmd->distortion.fov[0].angle_down = down_override; + dev->hmd->distortion.fov[1].angle_down = down_override; } // Sets the enabled extensions, this is where we should do any extra validation. diff --git a/src/xrt/state_trackers/oxr/oxr_session.c b/src/xrt/state_trackers/oxr/oxr_session.c index 852726d00..70d1b3acd 100644 --- a/src/xrt/state_trackers/oxr/oxr_session.c +++ b/src/xrt/state_trackers/oxr/oxr_session.c @@ -410,7 +410,7 @@ oxr_session_locate_views(struct oxr_logger *log, oxr_view_relation_ref_relation(log, sess, &head_relation, xdev, baseSpc, viewLocateInfo->displayTime, &base_spc_head_relation); - // @todo the fov information that we get from xdev->hmd->views[i].fov is + // @todo the fov information that we get from xdev->hmd->distortion.fov[i] is // not properly filled out in oh_device.c, fix before wasting time // on debugging weird rendering when adding stuff here. diff --git a/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp b/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp index bf3c6c90b..c31c21419 100644 --- a/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp +++ b/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp @@ -1041,10 +1041,10 @@ CDeviceDriver_Monado::GetEyeOutputViewport( void CDeviceDriver_Monado::GetProjectionRaw(vr::EVREye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom) { - *pfLeft = tanf(m_xdev->hmd->views[eEye].fov.angle_left); - *pfRight = tanf(m_xdev->hmd->views[eEye].fov.angle_right); - *pfTop = tanf(-m_xdev->hmd->views[eEye].fov.angle_up); - *pfBottom = tanf(-m_xdev->hmd->views[eEye].fov.angle_down); + *pfLeft = tanf(m_xdev->hmd->distortion.fov[eEye].angle_left); + *pfRight = tanf(m_xdev->hmd->distortion.fov[eEye].angle_right); + *pfTop = tanf(-m_xdev->hmd->distortion.fov[eEye].angle_up); + *pfBottom = tanf(-m_xdev->hmd->distortion.fov[eEye].angle_down); ovrd_log("Projection Raw: L%f R%f T%f B%f\n", *pfLeft, *pfRight, *pfTop, *pfBottom); }