openxr_api.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. /**************************************************************************/
  2. /* openxr_api.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef OPENXR_API_H
  31. #define OPENXR_API_H
  32. #include "core/error/error_macros.h"
  33. #include "core/math/projection.h"
  34. #include "core/math/transform_3d.h"
  35. #include "core/math/vector2.h"
  36. #include "core/os/memory.h"
  37. #include "core/string/print_string.h"
  38. #include "core/string/ustring.h"
  39. #include "core/templates/rb_map.h"
  40. #include "core/templates/rid_owner.h"
  41. #include "core/templates/vector.h"
  42. #include "servers/xr/xr_pose.h"
  43. #include "thirdparty/openxr/src/common/xr_linear.h"
  44. #include <openxr/openxr.h>
  45. #include "action_map/openxr_action.h"
  46. #include "extensions/openxr_composition_layer_provider.h"
  47. #include "extensions/openxr_extension_wrapper.h"
  48. #include "util.h"
  49. // Note, OpenXR code that we wrote for our plugin makes use of C++20 notation for initialising structs which ensures zeroing out unspecified members.
  50. // Godot is currently restricted to C++17 which doesn't allow this notation. Make sure critical fields are set.
  51. // forward declarations, we don't want to include these fully
  52. class OpenXRVulkanExtension;
  53. class OpenXRInterface;
  54. class OpenXRAPI {
  55. private:
  56. // our singleton
  57. static OpenXRAPI *singleton;
  58. // Registered extension wrappers
  59. static Vector<OpenXRExtensionWrapper *> registered_extension_wrappers;
  60. // linked XR interface
  61. OpenXRInterface *xr_interface = nullptr;
  62. // layers
  63. uint32_t num_layer_properties = 0;
  64. XrApiLayerProperties *layer_properties = nullptr;
  65. // extensions
  66. uint32_t num_supported_extensions = 0;
  67. XrExtensionProperties *supported_extensions = nullptr;
  68. Vector<CharString> enabled_extensions;
  69. // composition layer providers
  70. Vector<OpenXRCompositionLayerProvider *> composition_layer_providers;
  71. // view configuration
  72. uint32_t num_view_configuration_types = 0;
  73. XrViewConfigurationType *supported_view_configuration_types = nullptr;
  74. // reference spaces
  75. uint32_t num_reference_spaces = 0;
  76. XrReferenceSpaceType *supported_reference_spaces = nullptr;
  77. // swapchains (note these are platform dependent)
  78. uint32_t num_swapchain_formats = 0;
  79. int64_t *supported_swapchain_formats = nullptr;
  80. // configuration
  81. XrFormFactor form_factor = XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY;
  82. XrViewConfigurationType view_configuration = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO;
  83. XrReferenceSpaceType reference_space = XR_REFERENCE_SPACE_TYPE_STAGE;
  84. // XrEnvironmentBlendMode environment_blend_mode = XR_ENVIRONMENT_BLEND_MODE_OPAQUE;
  85. bool submit_depth_buffer = false; // if set to true we submit depth buffers to OpenXR if a suitable extension is enabled.
  86. // state
  87. XrInstance instance = XR_NULL_HANDLE;
  88. XrSystemId system_id = 0;
  89. String system_name;
  90. uint32_t vendor_id = 0;
  91. XrSystemTrackingProperties tracking_properties;
  92. XrSession session = XR_NULL_HANDLE;
  93. XrSessionState session_state = XR_SESSION_STATE_UNKNOWN;
  94. bool running = false;
  95. XrFrameState frame_state = { XR_TYPE_FRAME_STATE, NULL, 0, 0, false };
  96. OpenXRGraphicsExtensionWrapper *graphics_extension = nullptr;
  97. XrSystemGraphicsProperties graphics_properties;
  98. uint32_t view_count = 0;
  99. XrViewConfigurationView *view_configuration_views = nullptr;
  100. XrView *views = nullptr;
  101. XrCompositionLayerProjectionView *projection_views = nullptr;
  102. XrCompositionLayerDepthInfoKHR *depth_views = nullptr; // Only used by Composition Layer Depth Extension if available
  103. enum OpenXRSwapChainTypes {
  104. OPENXR_SWAPCHAIN_COLOR,
  105. OPENXR_SWAPCHAIN_DEPTH,
  106. // OPENXR_SWAPCHAIN_VELOCITY,
  107. OPENXR_SWAPCHAIN_MAX
  108. };
  109. struct OpenXRSwapChainInfo {
  110. XrSwapchain swapchain = XR_NULL_HANDLE;
  111. void *swapchain_graphics_data = nullptr;
  112. uint32_t image_index = 0;
  113. bool image_acquired = false;
  114. };
  115. OpenXRSwapChainInfo swapchains[OPENXR_SWAPCHAIN_MAX];
  116. XrSpace play_space = XR_NULL_HANDLE;
  117. XrSpace view_space = XR_NULL_HANDLE;
  118. bool view_pose_valid = false;
  119. XRPose::TrackingConfidence head_pose_confidence = XRPose::XR_TRACKING_CONFIDENCE_NONE;
  120. bool load_layer_properties();
  121. bool load_supported_extensions();
  122. bool is_extension_supported(const String &p_extension) const;
  123. bool is_extension_enabled(const String &p_extension) const;
  124. bool openxr_loader_init();
  125. bool resolve_instance_openxr_symbols();
  126. #ifdef ANDROID_ENABLED
  127. // On Android we keep tracker of our external OpenXR loader
  128. void *openxr_loader_library_handle = nullptr;
  129. #endif
  130. // function pointers
  131. #ifdef ANDROID_ENABLED
  132. // On non-Android platforms we use the OpenXR symbol linked into the engine binary.
  133. PFN_xrGetInstanceProcAddr xrGetInstanceProcAddr = nullptr;
  134. #endif
  135. EXT_PROTO_XRRESULT_FUNC3(xrAcquireSwapchainImage, (XrSwapchain), swapchain, (const XrSwapchainImageAcquireInfo *), acquireInfo, (uint32_t *), index)
  136. EXT_PROTO_XRRESULT_FUNC3(xrApplyHapticFeedback, (XrSession), session, (const XrHapticActionInfo *), hapticActionInfo, (const XrHapticBaseHeader *), hapticFeedback)
  137. EXT_PROTO_XRRESULT_FUNC2(xrAttachSessionActionSets, (XrSession), session, (const XrSessionActionSetsAttachInfo *), attachInfo)
  138. EXT_PROTO_XRRESULT_FUNC2(xrBeginFrame, (XrSession), session, (const XrFrameBeginInfo *), frameBeginInfo)
  139. EXT_PROTO_XRRESULT_FUNC2(xrBeginSession, (XrSession), session, (const XrSessionBeginInfo *), beginInfo)
  140. EXT_PROTO_XRRESULT_FUNC3(xrCreateAction, (XrActionSet), actionSet, (const XrActionCreateInfo *), createInfo, (XrAction *), action)
  141. EXT_PROTO_XRRESULT_FUNC3(xrCreateActionSet, (XrInstance), instance, (const XrActionSetCreateInfo *), createInfo, (XrActionSet *), actionSet)
  142. EXT_PROTO_XRRESULT_FUNC3(xrCreateActionSpace, (XrSession), session, (const XrActionSpaceCreateInfo *), createInfo, (XrSpace *), space)
  143. EXT_PROTO_XRRESULT_FUNC2(xrCreateInstance, (const XrInstanceCreateInfo *), createInfo, (XrInstance *), instance)
  144. EXT_PROTO_XRRESULT_FUNC3(xrCreateReferenceSpace, (XrSession), session, (const XrReferenceSpaceCreateInfo *), createInfo, (XrSpace *), space)
  145. EXT_PROTO_XRRESULT_FUNC3(xrCreateSession, (XrInstance), instance, (const XrSessionCreateInfo *), createInfo, (XrSession *), session)
  146. EXT_PROTO_XRRESULT_FUNC3(xrCreateSwapchain, (XrSession), session, (const XrSwapchainCreateInfo *), createInfo, (XrSwapchain *), swapchain)
  147. EXT_PROTO_XRRESULT_FUNC1(xrDestroyAction, (XrAction), action)
  148. EXT_PROTO_XRRESULT_FUNC1(xrDestroyActionSet, (XrActionSet), actionSet)
  149. EXT_PROTO_XRRESULT_FUNC1(xrDestroyInstance, (XrInstance), instance)
  150. EXT_PROTO_XRRESULT_FUNC1(xrDestroySession, (XrSession), session)
  151. EXT_PROTO_XRRESULT_FUNC1(xrDestroySpace, (XrSpace), space)
  152. EXT_PROTO_XRRESULT_FUNC1(xrDestroySwapchain, (XrSwapchain), swapchain)
  153. EXT_PROTO_XRRESULT_FUNC2(xrEndFrame, (XrSession), session, (const XrFrameEndInfo *), frameEndInfo)
  154. EXT_PROTO_XRRESULT_FUNC1(xrEndSession, (XrSession), session)
  155. EXT_PROTO_XRRESULT_FUNC3(xrEnumerateApiLayerProperties, (uint32_t), propertyCapacityInput, (uint32_t *), propertyCountOutput, (XrApiLayerProperties *), properties)
  156. EXT_PROTO_XRRESULT_FUNC4(xrEnumerateInstanceExtensionProperties, (const char *), layerName, (uint32_t), propertyCapacityInput, (uint32_t *), propertyCountOutput, (XrExtensionProperties *), properties)
  157. EXT_PROTO_XRRESULT_FUNC4(xrEnumerateReferenceSpaces, (XrSession), session, (uint32_t), spaceCapacityInput, (uint32_t *), spaceCountOutput, (XrReferenceSpaceType *), spaces)
  158. EXT_PROTO_XRRESULT_FUNC4(xrEnumerateSwapchainFormats, (XrSession), session, (uint32_t), formatCapacityInput, (uint32_t *), formatCountOutput, (int64_t *), formats)
  159. EXT_PROTO_XRRESULT_FUNC5(xrEnumerateViewConfigurations, (XrInstance), instance, (XrSystemId), systemId, (uint32_t), viewConfigurationTypeCapacityInput, (uint32_t *), viewConfigurationTypeCountOutput, (XrViewConfigurationType *), viewConfigurationTypes)
  160. EXT_PROTO_XRRESULT_FUNC6(xrEnumerateViewConfigurationViews, (XrInstance), instance, (XrSystemId), systemId, (XrViewConfigurationType), viewConfigurationType, (uint32_t), viewCapacityInput, (uint32_t *), viewCountOutput, (XrViewConfigurationView *), views)
  161. EXT_PROTO_XRRESULT_FUNC3(xrGetActionStateBoolean, (XrSession), session, (const XrActionStateGetInfo *), getInfo, (XrActionStateBoolean *), state)
  162. EXT_PROTO_XRRESULT_FUNC3(xrGetActionStateFloat, (XrSession), session, (const XrActionStateGetInfo *), getInfo, (XrActionStateFloat *), state)
  163. EXT_PROTO_XRRESULT_FUNC3(xrGetActionStateVector2f, (XrSession), session, (const XrActionStateGetInfo *), getInfo, (XrActionStateVector2f *), state)
  164. EXT_PROTO_XRRESULT_FUNC3(xrGetCurrentInteractionProfile, (XrSession), session, (XrPath), topLevelUserPath, (XrInteractionProfileState *), interactionProfile)
  165. EXT_PROTO_XRRESULT_FUNC2(xrGetInstanceProperties, (XrInstance), instance, (XrInstanceProperties *), instanceProperties)
  166. EXT_PROTO_XRRESULT_FUNC3(xrGetSystem, (XrInstance), instance, (const XrSystemGetInfo *), getInfo, (XrSystemId *), systemId)
  167. EXT_PROTO_XRRESULT_FUNC3(xrGetSystemProperties, (XrInstance), instance, (XrSystemId), systemId, (XrSystemProperties *), properties)
  168. EXT_PROTO_XRRESULT_FUNC4(xrLocateSpace, (XrSpace), space, (XrSpace), baseSpace, (XrTime), time, (XrSpaceLocation *), location)
  169. EXT_PROTO_XRRESULT_FUNC6(xrLocateViews, (XrSession), session, (const XrViewLocateInfo *), viewLocateInfo, (XrViewState *), viewState, (uint32_t), viewCapacityInput, (uint32_t *), viewCountOutput, (XrView *), views)
  170. EXT_PROTO_XRRESULT_FUNC5(xrPathToString, (XrInstance), instance, (XrPath), path, (uint32_t), bufferCapacityInput, (uint32_t *), bufferCountOutput, (char *), buffer)
  171. EXT_PROTO_XRRESULT_FUNC2(xrPollEvent, (XrInstance), instance, (XrEventDataBuffer *), eventData)
  172. EXT_PROTO_XRRESULT_FUNC2(xrReleaseSwapchainImage, (XrSwapchain), swapchain, (const XrSwapchainImageReleaseInfo *), releaseInfo)
  173. EXT_PROTO_XRRESULT_FUNC3(xrResultToString, (XrInstance), instance, (XrResult), value, (char *), buffer)
  174. EXT_PROTO_XRRESULT_FUNC3(xrStringToPath, (XrInstance), instance, (const char *), pathString, (XrPath *), path)
  175. EXT_PROTO_XRRESULT_FUNC2(xrSuggestInteractionProfileBindings, (XrInstance), instance, (const XrInteractionProfileSuggestedBinding *), suggestedBindings)
  176. EXT_PROTO_XRRESULT_FUNC2(xrSyncActions, (XrSession), session, (const XrActionsSyncInfo *), syncInfo)
  177. EXT_PROTO_XRRESULT_FUNC3(xrWaitFrame, (XrSession), session, (const XrFrameWaitInfo *), frameWaitInfo, (XrFrameState *), frameState)
  178. EXT_PROTO_XRRESULT_FUNC2(xrWaitSwapchainImage, (XrSwapchain), swapchain, (const XrSwapchainImageWaitInfo *), waitInfo)
  179. // instance
  180. bool create_instance();
  181. bool get_system_info();
  182. bool load_supported_view_configuration_types();
  183. bool is_view_configuration_supported(XrViewConfigurationType p_configuration_type) const;
  184. bool load_supported_view_configuration_views(XrViewConfigurationType p_configuration_type);
  185. void destroy_instance();
  186. // session
  187. bool create_session();
  188. bool load_supported_reference_spaces();
  189. bool is_reference_space_supported(XrReferenceSpaceType p_reference_space);
  190. bool setup_spaces();
  191. bool load_supported_swapchain_formats();
  192. bool is_swapchain_format_supported(int64_t p_swapchain_format);
  193. bool create_swapchains();
  194. void destroy_session();
  195. // swapchains
  196. bool create_swapchain(XrSwapchainUsageFlags p_usage_flags, int64_t p_swapchain_format, uint32_t p_width, uint32_t p_height, uint32_t p_sample_count, uint32_t p_array_size, XrSwapchain &r_swapchain, void **r_swapchain_graphics_data);
  197. bool acquire_image(OpenXRSwapChainInfo &p_swapchain);
  198. bool release_image(OpenXRSwapChainInfo &p_swapchain);
  199. // action map
  200. struct Tracker { // Trackers represent tracked physical objects such as controllers, pucks, etc.
  201. String name; // Name for this tracker (i.e. "/user/hand/left")
  202. XrPath toplevel_path; // OpenXR XrPath for this tracker
  203. RID active_profile_rid; // RID of the active profile for this tracker
  204. };
  205. RID_Owner<Tracker, true> tracker_owner;
  206. RID get_tracker_rid(XrPath p_path);
  207. struct ActionSet { // Action sets define a set of actions that can be enabled together
  208. String name; // Name for this action set (i.e. "godot_action_set")
  209. bool is_attached; // If true our action set has been attached to the session and can no longer be modified
  210. XrActionSet handle; // OpenXR handle for this action set
  211. };
  212. RID_Owner<ActionSet, true> action_set_owner;
  213. struct ActionTracker { // Links and action to a tracker
  214. RID tracker_rid; // RID of the tracker
  215. XrSpace space; // Optional space for pose actions
  216. bool was_location_valid; // If true the last position we obtained was valid
  217. };
  218. struct Action { // Actions define the inputs and outputs in OpenXR
  219. RID action_set_rid; // RID of the action set this action belongs to
  220. String name; // Name for this action (i.e. "aim_pose")
  221. XrActionType action_type; // Type of action (bool, float, etc.)
  222. Vector<ActionTracker> trackers; // The trackers this action can be used with
  223. XrAction handle; // OpenXR handle for this action
  224. };
  225. RID_Owner<Action, true> action_owner;
  226. RID get_action_rid(XrAction p_action);
  227. struct InteractionProfile { // Interaction profiles define suggested bindings between the physical inputs on controller types and our actions
  228. String name; // Name of the interaction profile (i.e. "/interaction_profiles/valve/index_controller")
  229. XrPath path; // OpenXR path for this profile
  230. Vector<XrActionSuggestedBinding> bindings; // OpenXR action bindings
  231. };
  232. RID_Owner<InteractionProfile, true> interaction_profile_owner;
  233. RID get_interaction_profile_rid(XrPath p_path);
  234. XrPath get_interaction_profile_path(RID p_interaction_profile);
  235. // state changes
  236. bool poll_events();
  237. bool on_state_idle();
  238. bool on_state_ready();
  239. bool on_state_synchronized();
  240. bool on_state_visible();
  241. bool on_state_focused();
  242. bool on_state_stopping();
  243. bool on_state_loss_pending();
  244. bool on_state_exiting();
  245. // convencience
  246. void copy_string_to_char_buffer(const String p_string, char *p_buffer, int p_buffer_len);
  247. public:
  248. XrInstance get_instance() const { return instance; };
  249. XrSystemId get_system_id() const { return system_id; };
  250. XrSession get_session() const { return session; };
  251. // helper method to convert an XrPosef to a Transform3D
  252. Transform3D transform_from_pose(const XrPosef &p_pose);
  253. // helper method to get a valid Transform3D from an openxr space location
  254. XRPose::TrackingConfidence transform_from_location(const XrSpaceLocation &p_location, Transform3D &r_transform);
  255. XRPose::TrackingConfidence transform_from_location(const XrHandJointLocationEXT &p_location, Transform3D &r_transform);
  256. void parse_velocities(const XrSpaceVelocity &p_velocity, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity);
  257. bool xr_result(XrResult result, const char *format, Array args = Array()) const;
  258. bool is_top_level_path_supported(const String &p_toplevel_path);
  259. bool is_interaction_profile_supported(const String &p_ip_path);
  260. bool interaction_profile_supports_io_path(const String &p_ip_path, const String &p_io_path);
  261. static bool openxr_is_enabled(bool p_check_run_in_editor = true);
  262. _FORCE_INLINE_ static OpenXRAPI *get_singleton() { return singleton; }
  263. XrResult try_get_instance_proc_addr(const char *p_name, PFN_xrVoidFunction *p_addr);
  264. XrResult get_instance_proc_addr(const char *p_name, PFN_xrVoidFunction *p_addr);
  265. String get_error_string(XrResult result);
  266. String get_swapchain_format_name(int64_t p_swapchain_format) const;
  267. void set_xr_interface(OpenXRInterface *p_xr_interface);
  268. static void register_extension_wrapper(OpenXRExtensionWrapper *p_extension_wrapper);
  269. static void register_extension_metadata();
  270. static void cleanup_extension_wrappers();
  271. void set_form_factor(XrFormFactor p_form_factor);
  272. XrFormFactor get_form_factor() const { return form_factor; }
  273. void set_view_configuration(XrViewConfigurationType p_view_configuration);
  274. XrViewConfigurationType get_view_configuration() const { return view_configuration; }
  275. void set_reference_space(XrReferenceSpaceType p_reference_space);
  276. XrReferenceSpaceType get_reference_space() const { return reference_space; }
  277. void set_submit_depth_buffer(bool p_submit_depth_buffer);
  278. bool get_submit_depth_buffer() const { return submit_depth_buffer; }
  279. bool is_initialized();
  280. bool is_running();
  281. bool initialize(const String &p_rendering_driver);
  282. bool initialize_session();
  283. void finish();
  284. XrSpace get_play_space() const { return play_space; }
  285. XrTime get_next_frame_time() { return frame_state.predictedDisplayTime + frame_state.predictedDisplayPeriod; }
  286. bool can_render() { return instance != XR_NULL_HANDLE && session != XR_NULL_HANDLE && running && view_pose_valid && frame_state.shouldRender; }
  287. Size2 get_recommended_target_size();
  288. XRPose::TrackingConfidence get_head_center(Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity);
  289. bool get_view_transform(uint32_t p_view, Transform3D &r_transform);
  290. bool get_view_projection(uint32_t p_view, double p_z_near, double p_z_far, Projection &p_camera_matrix);
  291. bool process();
  292. void pre_render();
  293. bool pre_draw_viewport(RID p_render_target);
  294. RID get_color_texture();
  295. RID get_depth_texture();
  296. void post_draw_viewport(RID p_render_target);
  297. void end_frame();
  298. // Display refresh rate
  299. float get_display_refresh_rate() const;
  300. void set_display_refresh_rate(float p_refresh_rate);
  301. Array get_available_display_refresh_rates() const;
  302. // action map
  303. String get_default_action_map_resource_name();
  304. RID tracker_create(const String p_name);
  305. String tracker_get_name(RID p_tracker);
  306. void tracker_check_profile(RID p_tracker, XrSession p_session = XR_NULL_HANDLE);
  307. void tracker_free(RID p_tracker);
  308. RID action_set_create(const String p_name, const String p_localized_name, const int p_priority);
  309. String action_set_get_name(RID p_action_set);
  310. bool action_set_attach(RID p_action_set);
  311. void action_set_free(RID p_action_set);
  312. RID action_create(RID p_action_set, const String p_name, const String p_localized_name, OpenXRAction::ActionType p_action_type, const Vector<RID> &p_trackers);
  313. String action_get_name(RID p_action);
  314. void action_free(RID p_action);
  315. RID interaction_profile_create(const String p_name);
  316. String interaction_profile_get_name(RID p_interaction_profile);
  317. void interaction_profile_clear_bindings(RID p_interaction_profile);
  318. bool interaction_profile_add_binding(RID p_interaction_profile, RID p_action, const String p_path);
  319. bool interaction_profile_suggest_bindings(RID p_interaction_profile);
  320. void interaction_profile_free(RID p_interaction_profile);
  321. bool sync_action_sets(const Vector<RID> p_active_sets);
  322. bool get_action_bool(RID p_action, RID p_tracker);
  323. float get_action_float(RID p_action, RID p_tracker);
  324. Vector2 get_action_vector2(RID p_action, RID p_tracker);
  325. XRPose::TrackingConfidence get_action_pose(RID p_action, RID p_tracker, Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity);
  326. bool trigger_haptic_pulse(RID p_action, RID p_tracker, float p_frequency, float p_amplitude, XrDuration p_duration_ns);
  327. void register_composition_layer_provider(OpenXRCompositionLayerProvider *provider);
  328. void unregister_composition_layer_provider(OpenXRCompositionLayerProvider *provider);
  329. OpenXRAPI();
  330. ~OpenXRAPI();
  331. };
  332. #endif // OPENXR_API_H