25static inline XrSpaceLocationFlags
29 bool valid_ori = (relation_flags & XRT_SPACE_RELATION_ORIENTATION_VALID_BIT) != 0;
30 bool tracked_ori = (relation_flags & XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT) != 0;
31 bool valid_pos = (relation_flags & XRT_SPACE_RELATION_POSITION_VALID_BIT) != 0;
32 bool tracked_pos = (relation_flags & XRT_SPACE_RELATION_POSITION_TRACKED_BIT) != 0;
34 bool linear_vel = (relation_flags & XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT) != 0;
35 bool angular_vel = (relation_flags & XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT) != 0;
38 XrSpaceLocationFlags location_flags = (XrSpaceLocationFlags)0;
40 location_flags |= XR_SPACE_LOCATION_ORIENTATION_VALID_BIT;
43 location_flags |= XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT;
46 location_flags |= XR_SPACE_LOCATION_POSITION_VALID_BIT;
49 location_flags |= XR_SPACE_LOCATION_POSITION_TRACKED_BIT;
52 location_flags |= XR_SPACE_VELOCITY_LINEAR_VALID_BIT;
55 location_flags |= XR_SPACE_VELOCITY_ANGULAR_VALID_BIT;
58 return location_flags;
61static inline XrReferenceSpaceType
65 case OXR_SPACE_TYPE_REFERENCE_VIEW:
return XR_REFERENCE_SPACE_TYPE_VIEW;
66 case OXR_SPACE_TYPE_REFERENCE_LOCAL:
return XR_REFERENCE_SPACE_TYPE_LOCAL;
67 case OXR_SPACE_TYPE_REFERENCE_LOCAL_FLOOR:
return XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT;
68 case OXR_SPACE_TYPE_REFERENCE_STAGE:
return XR_REFERENCE_SPACE_TYPE_STAGE;
69 case OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT:
return XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT;
70 case OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO:
return XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO;
71 case OXR_SPACE_TYPE_REFERENCE_LOCALIZATION_MAP_ML:
return XR_REFERENCE_SPACE_TYPE_LOCALIZATION_MAP_ML;
73 case OXR_SPACE_TYPE_ACTION:
return XR_REFERENCE_SPACE_TYPE_MAX_ENUM;
74 case OXR_SPACE_TYPE_XDEV_POSE:
return XR_REFERENCE_SPACE_TYPE_MAX_ENUM;
77 return XR_REFERENCE_SPACE_TYPE_MAX_ENUM;
81xr_ref_space_to_oxr(XrReferenceSpaceType space_type)
84 case XR_REFERENCE_SPACE_TYPE_VIEW:
return OXR_SPACE_TYPE_REFERENCE_VIEW;
85 case XR_REFERENCE_SPACE_TYPE_LOCAL:
return OXR_SPACE_TYPE_REFERENCE_LOCAL;
86 case XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT:
return OXR_SPACE_TYPE_REFERENCE_LOCAL_FLOOR;
87 case XR_REFERENCE_SPACE_TYPE_STAGE:
return OXR_SPACE_TYPE_REFERENCE_STAGE;
88 case XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT:
return OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT;
89 case XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO:
return OXR_SPACE_TYPE_REFERENCE_COMBINED_EYE_VARJO;
90 case XR_REFERENCE_SPACE_TYPE_LOCALIZATION_MAP_ML:
return OXR_SPACE_TYPE_REFERENCE_LOCALIZATION_MAP_ML;
92 case XR_REFERENCE_SPACE_TYPE_MAX_ENUM:
return (
enum oxr_space_type) - 1;
99static inline const char *
100xr_ref_space_to_string(XrReferenceSpaceType space_type)
102 switch (space_type) {
103 case XR_REFERENCE_SPACE_TYPE_VIEW:
return "XR_REFERENCE_SPACE_TYPE_VIEW";
104 case XR_REFERENCE_SPACE_TYPE_LOCAL:
return "XR_REFERENCE_SPACE_TYPE_LOCAL";
105 case XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT:
return "XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT";
106 case XR_REFERENCE_SPACE_TYPE_STAGE:
return "XR_REFERENCE_SPACE_TYPE_STAGE";
107 case XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT:
return "XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT";
108 case XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO:
return "XR_REFERENCE_SPACE_TYPE_COMBINED_EYE_VARJO";
109 case XR_REFERENCE_SPACE_TYPE_MAX_ENUM:
return "XR_REFERENCE_SPACE_TYPE_MAX_ENUM";
110 default:
return "UNKNOWN REFERENCE SPACE";
117 switch (space_type) {
118 case OXR_SPACE_TYPE_REFERENCE_VIEW:
return XRT_SPACE_REFERENCE_TYPE_VIEW;
119 case OXR_SPACE_TYPE_REFERENCE_LOCAL:
return XRT_SPACE_REFERENCE_TYPE_LOCAL;
120 case OXR_SPACE_TYPE_REFERENCE_LOCAL_FLOOR:
return XRT_SPACE_REFERENCE_TYPE_LOCAL_FLOOR;
121 case OXR_SPACE_TYPE_REFERENCE_STAGE:
return XRT_SPACE_REFERENCE_TYPE_STAGE;
122 case OXR_SPACE_TYPE_REFERENCE_UNBOUNDED_MSFT:
return XRT_SPACE_REFERENCE_TYPE_UNBOUNDED;
142xr_ref_space_to_xrt(XrReferenceSpaceType space_type)
144 switch (space_type) {
145 case XR_REFERENCE_SPACE_TYPE_VIEW:
return XRT_SPACE_REFERENCE_TYPE_VIEW;
146 case XR_REFERENCE_SPACE_TYPE_LOCAL:
return XRT_SPACE_REFERENCE_TYPE_LOCAL;
147 case XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT:
return XRT_SPACE_REFERENCE_TYPE_LOCAL_FLOOR;
148 case XR_REFERENCE_SPACE_TYPE_STAGE:
return XRT_SPACE_REFERENCE_TYPE_STAGE;
149 case XR_REFERENCE_SPACE_TYPE_UNBOUNDED_MSFT:
return XRT_SPACE_REFERENCE_TYPE_UNBOUNDED;
165static inline const char *
176 default:
return "XRT_INPUT_UNKNOWN";
182xr_perf_level_to_xrt(XrPerfSettingsLevelEXT level)
185 case XR_PERF_SETTINGS_LEVEL_POWER_SAVINGS_EXT:
return XRT_PERF_SET_LEVEL_POWER_SAVINGS;
186 case XR_PERF_SETTINGS_LEVEL_SUSTAINED_LOW_EXT:
return XRT_PERF_SET_LEVEL_SUSTAINED_LOW;
187 case XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT:
return XRT_PERF_SET_LEVEL_SUSTAINED_HIGH;
188 case XR_PERF_SETTINGS_LEVEL_BOOST_EXT:
return XRT_PERF_SET_LEVEL_BOOST;
189 default: assert(
false);
return 0;
194xr_perf_domain_to_xrt(XrPerfSettingsDomainEXT domain)
197 case XR_PERF_SETTINGS_DOMAIN_CPU_EXT:
return XRT_PERF_DOMAIN_CPU;
198 case XR_PERF_SETTINGS_DOMAIN_GPU_EXT:
return XRT_PERF_DOMAIN_GPU;
199 default: assert(
false);
return 0;
203static inline XrPerfSettingsDomainEXT
207 case XRT_PERF_DOMAIN_CPU:
return XR_PERF_SETTINGS_DOMAIN_CPU_EXT;
208 case XRT_PERF_DOMAIN_GPU:
return XR_PERF_SETTINGS_DOMAIN_GPU_EXT;
209 default: assert(
false);
return 0;
213static inline XrPerfSettingsSubDomainEXT
214xrt_perf_sub_domain_to_xr(
enum xrt_perf_sub_domain subDomain)
217 case XRT_PERF_SUB_DOMAIN_COMPOSITING:
return XR_PERF_SETTINGS_SUB_DOMAIN_COMPOSITING_EXT;
218 case XRT_PERF_SUB_DOMAIN_RENDERING:
return XR_PERF_SETTINGS_SUB_DOMAIN_RENDERING_EXT;
219 case XRT_PERF_SUB_DOMAIN_THERMAL:
return XR_PERF_SETTINGS_SUB_DOMAIN_THERMAL_EXT;
220 default: assert(
false);
return 0;
224static inline XrPerfSettingsNotificationLevelEXT
228 case XRT_PERF_NOTIFY_LEVEL_NORMAL:
return XR_PERF_SETTINGS_NOTIF_LEVEL_NORMAL_EXT;
229 case XRT_PERF_NOTIFY_LEVEL_WARNING:
return XR_PERF_SETTINGS_NOTIF_LEVEL_WARNING_EXT;
230 case XRT_PERF_NOTIFY_LEVEL_IMPAIRED:
return XR_PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED_EXT;
231 default: assert(
false);
return 0;
oxr_space_type
Internal enum for the type of space, lets us reason about action spaces.
Definition: oxr_defines.h:102
xrt_input_type
Base type of this inputs.
Definition: xrt_defines.h:805
xrt_reference_space_type
Type of a OpenXR mapped reference space, maps to the semantic spaces on the xrt_space_overseer struct...
Definition: xrt_defines.h:599
#define XRT_SPACE_REFERENCE_TYPE_INVALID
An invalid xrt_reference_space_type, since it's invalid it's not listed in the enum.
Definition: xrt_defines.h:620
xrt_space_relation_flags
Flags of which components of a xrt_space_relation is valid.
Definition: xrt_defines.h:629
@ XRT_INPUT_TYPE_POSE
A tracked pose.
Definition: xrt_defines.h:818
@ XRT_INPUT_TYPE_VEC2_MINUS_ONE_TO_ONE
Vec2 input, components in [-1, 1].
Definition: xrt_defines.h:812
@ XRT_INPUT_TYPE_VEC3_MINUS_ONE_TO_ONE
Vec3 input, components in [-1, 1].
Definition: xrt_defines.h:814
@ XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE
Float input in [-1, 1].
Definition: xrt_defines.h:810
@ XRT_INPUT_TYPE_BOOLEAN
Boolean (digital, binary) input.
Definition: xrt_defines.h:816
@ XRT_INPUT_TYPE_VEC1_ZERO_TO_ONE
Float input in [0, 1].
Definition: xrt_defines.h:808
Common defines and enums for XRT.
xrt_perf_notify_level
Performance level.
Definition: xrt_defines.h:1956
xrt_perf_domain
Domain type.
Definition: xrt_defines.h:1929
xrt_perf_set_level
Performance level.
Definition: xrt_defines.h:1945
Include all of the openxr headers in one place.
Header defining xrt space and space overseer.
Include all of the Vulkan headers in one place, and cope with any "messy" includes implied by it.