The open source OpenXR runtime
0
fork

Configure Feed

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

xrt: Add xrt_device::get_view_poses function

+58
+58
src/xrt/include/xrt/xrt_device.h
··· 369 369 uint32_t view_index, 370 370 struct xrt_pose *out_pose); 371 371 372 + /*! 373 + * @brief Get the per-view pose in relation to the view space. 374 + * 375 + * On most device with coplanar displays, this just calls a helper to 376 + * process the provided eye relation, but this may also handle canted 377 + * displays as well as eye tracking. 378 + * 379 + * Does not do any device level tracking, use 380 + * xrt_device::get_tracked_pose for that. 381 + * 382 + * @param[in] xdev The device. 383 + * @param[in] default_eye_relation 384 + * The interpupillary relation as a 3D position. 385 + * Most simple stereo devices would just want to 386 + * set `out_pose->position.[x|y|z] = ipd.[x|y|z] 387 + * / 2.0f` and adjust for left vs right view. 388 + * Not to be confused with IPD that is absolute 389 + * distance, this is a full 3D translation 390 + * If a device has a more accurate/dynamic way of 391 + * knowing the eye relation, it may ignore this 392 + * input. 393 + * @param[in] view_count Number of views. 394 + * @param[out] out_pose Output poses. See default_eye_relation 395 + * argument for sample position. Be sure to also 396 + * set orientation: most likely identity 397 + * orientation unless you have canted screens. 398 + * (Caution: Even if you have eye tracking, you 399 + * won't use eye orientation here!) 400 + */ 401 + void (*get_view_poses)(struct xrt_device *xdev, 402 + const struct xrt_vec3 *default_eye_relation, 403 + uint64_t at_timestamp_ns, 404 + uint32_t view_count, 405 + struct xrt_space_relation *out_head_relation, 406 + struct xrt_fov *out_fovs, 407 + struct xrt_pose *out_poses); 408 + 372 409 bool (*compute_distortion)(struct xrt_device *xdev, int view, float u, float v, struct xrt_uv_triplet *result); 373 410 374 411 /*! ··· 440 477 struct xrt_pose *out_pose) 441 478 { 442 479 xdev->get_view_pose(xdev, eye_relation, view_index, out_pose); 480 + } 481 + 482 + /*! 483 + * Helper function for @ref xrt_device::get_view_poses. 484 + * 485 + * @out_head_relation in the device's tracking space without tracking_origin offset applied. 486 + * @out_poses are view poses relative th @out_head_relation. 487 + * 488 + * @public @memberof xrt_device 489 + */ 490 + static inline void 491 + xrt_device_get_view_poses(struct xrt_device *xdev, 492 + const struct xrt_vec3 *default_eye_relation, 493 + uint64_t at_timestamp_ns, 494 + uint32_t view_count, 495 + struct xrt_space_relation *out_head_relation, 496 + struct xrt_fov *out_fovs, 497 + struct xrt_pose *out_poses) 498 + { 499 + xdev->get_view_poses(xdev, default_eye_relation, at_timestamp_ns, view_count, out_head_relation, out_fovs, 500 + out_poses); 443 501 } 444 502 445 503 /*!