godot_webxr.h 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**************************************************************************/
  2. /* godot_webxr.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 GODOT_WEBXR_H
  31. #define GODOT_WEBXR_H
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #include "stddef.h"
  36. enum WebXRInputEvent {
  37. WEBXR_INPUT_EVENT_SELECTSTART,
  38. WEBXR_INPUT_EVENT_SELECTEND,
  39. WEBXR_INPUT_EVENT_SELECT,
  40. WEBXR_INPUT_EVENT_SQUEEZESTART,
  41. WEBXR_INPUT_EVENT_SQUEEZEEND,
  42. WEBXR_INPUT_EVENT_SQUEEZE,
  43. };
  44. typedef void (*GodotWebXRSupportedCallback)(char *p_session_mode, int p_supported);
  45. typedef void (*GodotWebXRStartedCallback)(char *p_reference_space_type);
  46. typedef void (*GodotWebXREndedCallback)();
  47. typedef void (*GodotWebXRFailedCallback)(char *p_message);
  48. typedef void (*GodotWebXRControllerCallback)();
  49. typedef void (*GodotWebXRInputEventCallback)(int p_event_type, int p_controller_id);
  50. typedef void (*GodotWebXRSimpleEventCallback)(char *p_signal_name);
  51. extern int godot_webxr_is_supported();
  52. extern void godot_webxr_is_session_supported(const char *p_session_mode, GodotWebXRSupportedCallback p_callback);
  53. extern void godot_webxr_initialize(
  54. const char *p_session_mode,
  55. const char *p_required_features,
  56. const char *p_optional_features,
  57. const char *p_requested_reference_space_types,
  58. GodotWebXRStartedCallback p_on_session_started,
  59. GodotWebXREndedCallback p_on_session_ended,
  60. GodotWebXRFailedCallback p_on_session_failed,
  61. GodotWebXRControllerCallback p_on_controller_changed,
  62. GodotWebXRInputEventCallback p_on_input_event,
  63. GodotWebXRSimpleEventCallback p_on_simple_event);
  64. extern void godot_webxr_uninitialize();
  65. extern int godot_webxr_get_view_count();
  66. extern int *godot_webxr_get_render_targetsize();
  67. extern float *godot_webxr_get_transform_for_eye(int p_eye);
  68. extern float *godot_webxr_get_projection_for_eye(int p_eye);
  69. extern void godot_webxr_commit_for_eye(int p_eye, unsigned int p_texture_id);
  70. extern void godot_webxr_sample_controller_data();
  71. extern int godot_webxr_get_controller_count();
  72. extern int godot_webxr_is_controller_connected(int p_controller);
  73. extern float *godot_webxr_get_controller_transform(int p_controller);
  74. extern int *godot_webxr_get_controller_buttons(int p_controller, bool p_xr_standard_mapping);
  75. extern int *godot_webxr_get_controller_axes(int p_controller, bool p_xr_standard_mapping);
  76. extern int godot_webxr_get_controller_target_ray_mode(int p_controller);
  77. extern char *godot_webxr_get_visibility_state();
  78. extern int *godot_webxr_get_bounds_geometry();
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif // GODOT_WEBXR_H