Blender  V3.3
GHOST_Xr_intern.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #pragma once
8 
9 #include <memory>
10 #include <vector>
11 
13 
14 #define CHECK_XR(call, error_msg) \
15  { \
16  XrResult _res = call; \
17  if (XR_FAILED(_res)) { \
18  throw GHOST_XrException(error_msg, _res); \
19  } \
20  } \
21  (void)0
22 
27 #define CHECK_XR_ASSERT(call) \
28  { \
29  XrResult _res = call; \
30  assert(_res == XR_SUCCESS); \
31  (void)_res; \
32  } \
33  (void)0
34 
35 inline void copy_ghost_pose_to_openxr_pose(const GHOST_XrPose &ghost_pose, XrPosef &r_oxr_pose)
36 {
37  /* Set and convert to OpenXR coordinate space. */
38  r_oxr_pose.position.x = ghost_pose.position[0];
39  r_oxr_pose.position.y = ghost_pose.position[1];
40  r_oxr_pose.position.z = ghost_pose.position[2];
41  r_oxr_pose.orientation.w = ghost_pose.orientation_quat[0];
42  r_oxr_pose.orientation.x = ghost_pose.orientation_quat[1];
43  r_oxr_pose.orientation.y = ghost_pose.orientation_quat[2];
44  r_oxr_pose.orientation.z = ghost_pose.orientation_quat[3];
45 }
46 
47 inline void copy_openxr_pose_to_ghost_pose(const XrPosef &oxr_pose, GHOST_XrPose &r_ghost_pose)
48 {
49  /* Set and convert to Blender coordinate space. */
50  r_ghost_pose.position[0] = oxr_pose.position.x;
51  r_ghost_pose.position[1] = oxr_pose.position.y;
52  r_ghost_pose.position[2] = oxr_pose.position.z;
53  r_ghost_pose.orientation_quat[0] = oxr_pose.orientation.w;
54  r_ghost_pose.orientation_quat[1] = oxr_pose.orientation.x;
55  r_ghost_pose.orientation_quat[2] = oxr_pose.orientation.y;
56  r_ghost_pose.orientation_quat[3] = oxr_pose.orientation.z;
57 }
void copy_openxr_pose_to_ghost_pose(const XrPosef &oxr_pose, GHOST_XrPose &r_ghost_pose)
void copy_ghost_pose_to_openxr_pose(const GHOST_XrPose &ghost_pose, XrPosef &r_oxr_pose)