The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/main: Use xrt_device_get_view_poses

+35 -27
+35 -27
src/xrt/compositor/main/comp_renderer.c
··· 610 610 { 611 611 COMP_TRACE_MARKER(); 612 612 613 - struct xrt_space_relation relation; 614 - 615 - xrt_device_get_tracked_pose( // 616 - r->c->xdev, // 617 - XRT_INPUT_GENERIC_HEAD_POSE, // 618 - r->c->frame.rendering.predicted_display_time_ns, // 619 - &relation); // 613 + struct xrt_space_relation head_relation = XRT_SPACE_RELATION_ZERO; 614 + struct xrt_fov fovs[2] = {0}; 615 + struct xrt_pose poses[2] = {0}; 620 616 621 - struct xrt_vec3 eye_relation = { 622 - 0.063000f, /* TODO: get actual ipd_meters */ 617 + struct xrt_vec3 default_eye_relation = { 618 + 0.063000f, /*! @todo get actual ipd_meters */ 623 619 0.0f, 624 620 0.0f, 625 621 }; 626 622 623 + xrt_device_get_view_poses( // 624 + r->c->xdev, // 625 + &default_eye_relation, // 626 + r->c->frame.rendering.predicted_display_time_ns, // 627 + 2, // 628 + &head_relation, // 629 + fovs, // 630 + poses); // 631 + 627 632 struct xrt_pose base_space_pose = XRT_POSE_IDENTITY; 628 633 629 634 for (uint32_t i = 0; i < 2; i++) { 630 - struct xrt_fov fov = r->c->xdev->hmd->views[i].fov; 635 + const struct xrt_fov fov = fovs[i]; 636 + const struct xrt_pose eye_pose = poses[i]; 631 637 632 638 comp_layer_renderer_set_fov(r->lr, &fov, i); 633 639 634 - struct xrt_pose eye_pose; 635 - xrt_device_get_view_pose(r->c->xdev, &eye_relation, i, &eye_pose); 636 - 637 640 struct xrt_space_relation result = {0}; 638 641 struct xrt_relation_chain xrc = {0}; 639 642 m_relation_chain_push_pose_if_not_identity(&xrc, &eye_pose); 640 - m_relation_chain_push_relation(&xrc, &relation); 643 + m_relation_chain_push_relation(&xrc, &head_relation); 641 644 m_relation_chain_push_pose_if_not_identity(&xrc, &base_space_pose); 642 645 m_relation_chain_resolve(&xrc, &result); 643 646 ··· 885 888 { 886 889 COMP_TRACE_MARKER(); 887 890 888 - struct xrt_space_relation relation; 889 - 890 - xrt_device_get_tracked_pose( // 891 - r->c->xdev, // 892 - XRT_INPUT_GENERIC_HEAD_POSE, // 893 - r->c->frame.rendering.predicted_display_time_ns, // 894 - &relation); // 891 + struct xrt_space_relation head_relation = XRT_SPACE_RELATION_ZERO; 892 + struct xrt_fov fovs[2] = {0}; 893 + struct xrt_pose poses[2] = {0}; 895 894 896 - struct xrt_vec3 eye_relation = { 895 + struct xrt_vec3 default_eye_relation = { 897 896 0.063000f, /*! @todo get actual ipd_meters */ 898 897 0.0f, 899 898 0.0f, 900 899 }; 901 900 901 + xrt_device_get_view_poses( // 902 + r->c->xdev, // 903 + &default_eye_relation, // 904 + r->c->frame.rendering.predicted_display_time_ns, // 905 + 2, // 906 + &head_relation, // 907 + fovs, // 908 + poses); // 909 + 910 + struct xrt_pose base_space_pose = XRT_POSE_IDENTITY; 902 911 for (uint32_t i = 0; i < 2; i++) { 903 - struct xrt_fov fov = r->c->xdev->hmd->views[i].fov; 912 + const struct xrt_fov fov = fovs[i]; 913 + const struct xrt_pose eye_pose = poses[i]; 904 914 905 915 comp_layer_renderer_set_fov(r->lr, &fov, i); 906 - 907 - struct xrt_pose eye_pose = XRT_POSE_IDENTITY; 908 - xrt_device_get_view_pose(r->c->xdev, &eye_relation, i, &eye_pose); 909 916 910 917 struct xrt_space_relation result = {0}; 911 918 struct xrt_relation_chain xrc = {0}; 912 919 m_relation_chain_push_pose_if_not_identity(&xrc, &eye_pose); 913 - m_relation_chain_push_relation(&xrc, &relation); 920 + m_relation_chain_push_relation(&xrc, &head_relation); 921 + m_relation_chain_push_pose_if_not_identity(&xrc, &base_space_pose); 914 922 m_relation_chain_resolve(&xrc, &result); 915 923 916 924 out_results[i] = result.pose;