godot_webxr.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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_SQUEEZESTART,
  40. WEBXR_INPUT_EVENT_SQUEEZEEND,
  41. };
  42. typedef void (*GodotWebXRSupportedCallback)(char *p_session_mode, int p_supported);
  43. typedef void (*GodotWebXRStartedCallback)(char *p_reference_space_type, char *p_enabled_features, char *p_environment_blend_mode);
  44. typedef void (*GodotWebXREndedCallback)();
  45. typedef void (*GodotWebXRFailedCallback)(char *p_message);
  46. typedef void (*GodotWebXRInputEventCallback)(int p_event_type, int p_input_source_id);
  47. typedef void (*GodotWebXRSimpleEventCallback)(char *p_signal_name);
  48. extern int godot_webxr_is_supported();
  49. extern void godot_webxr_is_session_supported(const char *p_session_mode, GodotWebXRSupportedCallback p_callback);
  50. extern void godot_webxr_initialize(
  51. const char *p_session_mode,
  52. const char *p_required_features,
  53. const char *p_optional_features,
  54. const char *p_requested_reference_space_types,
  55. GodotWebXRStartedCallback p_on_session_started,
  56. GodotWebXREndedCallback p_on_session_ended,
  57. GodotWebXRFailedCallback p_on_session_failed,
  58. GodotWebXRInputEventCallback p_on_input_event,
  59. GodotWebXRSimpleEventCallback p_on_simple_event);
  60. extern void godot_webxr_uninitialize();
  61. extern int godot_webxr_get_view_count();
  62. extern bool godot_webxr_get_render_target_size(int *r_size);
  63. extern bool godot_webxr_get_transform_for_view(int p_view, float *r_transform);
  64. extern bool godot_webxr_get_projection_for_view(int p_view, float *r_transform);
  65. extern unsigned int godot_webxr_get_color_texture();
  66. extern unsigned int godot_webxr_get_depth_texture();
  67. extern unsigned int godot_webxr_get_velocity_texture();
  68. extern bool godot_webxr_update_input_source(
  69. int p_input_source_id,
  70. float *r_target_pose,
  71. int *r_target_ray_mode,
  72. int *r_touch_index,
  73. int *r_has_grip_pose,
  74. float *r_grip_pose,
  75. int *r_has_standard_mapping,
  76. int *r_button_count,
  77. float *r_buttons,
  78. int *r_axes_count,
  79. float *r_axes,
  80. int *r_has_hand_data,
  81. float *r_hand_joints,
  82. float *r_hand_radii);
  83. extern char *godot_webxr_get_visibility_state();
  84. extern int godot_webxr_get_bounds_geometry(float **r_points);
  85. extern float godot_webxr_get_frame_rate();
  86. extern void godot_webxr_update_target_frame_rate(float p_frame_rate);
  87. extern int godot_webxr_get_supported_frame_rates(float **r_frame_rates);
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif // GODOT_WEBXR_H