2
0

openxr_api_extension.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**************************************************************************/
  2. /* openxr_api_extension.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_EXTENSION_H
  31. #define OPENXR_API_EXTENSION_H
  32. #include "openxr_api.h"
  33. #include "core/object/ref_counted.h"
  34. #include "core/os/os.h"
  35. #include "core/os/thread_safe.h"
  36. #include "core/variant/native_ptr.h"
  37. class OpenXRAPIExtension : public RefCounted {
  38. GDCLASS(OpenXRAPIExtension, RefCounted);
  39. protected:
  40. _THREAD_SAFE_CLASS_
  41. static void _bind_methods();
  42. public:
  43. uint64_t get_instance();
  44. uint64_t get_system_id();
  45. uint64_t get_session();
  46. // Helper method to convert an XrPosef to a Transform3D.
  47. Transform3D transform_from_pose(GDExtensionConstPtr<const void> p_pose);
  48. bool xr_result(uint64_t result, String format, Array args = Array());
  49. static bool openxr_is_enabled(bool p_check_run_in_editor = true);
  50. //TODO workaround as GDExtensionPtr<void> return type results in build error in godot-cpp
  51. uint64_t get_instance_proc_addr(String p_name);
  52. String get_error_string(uint64_t result);
  53. String get_swapchain_format_name(int64_t p_swapchain_format);
  54. bool is_initialized();
  55. bool is_running();
  56. uint64_t get_play_space();
  57. int64_t get_next_frame_time();
  58. bool can_render();
  59. OpenXRAPIExtension();
  60. };
  61. #endif // OPENXR_API_EXTENSION_H