godot_webxr.h 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*************************************************************************/
  2. /* godot_webxr.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
  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. typedef void (*GodotWebXRSupportedCallback)(char *p_session_mode, int p_supported);
  37. typedef void (*GodotWebXRStartedCallback)(char *p_reference_space_type);
  38. typedef void (*GodotWebXREndedCallback)();
  39. typedef void (*GodotWebXRFailedCallback)(char *p_message);
  40. typedef void (*GodotWebXRControllerCallback)();
  41. typedef void (*GodotWebXRInputEventCallback)(char *p_signal_name, int p_controller_id);
  42. typedef void (*GodotWebXRSimpleEventCallback)(char *p_signal_name);
  43. extern int godot_webxr_is_supported();
  44. extern void godot_webxr_is_session_supported(const char *p_session_mode, GodotWebXRSupportedCallback p_callback);
  45. extern void godot_webxr_initialize(
  46. const char *p_session_mode,
  47. const char *p_required_features,
  48. const char *p_optional_features,
  49. const char *p_requested_reference_space_types,
  50. GodotWebXRStartedCallback p_on_session_started,
  51. GodotWebXREndedCallback p_on_session_ended,
  52. GodotWebXRFailedCallback p_on_session_failed,
  53. GodotWebXRControllerCallback p_on_controller_changed,
  54. GodotWebXRInputEventCallback p_on_input_event,
  55. GodotWebXRSimpleEventCallback p_on_simple_event);
  56. extern void godot_webxr_uninitialize();
  57. extern int godot_webxr_get_view_count();
  58. extern int *godot_webxr_get_render_targetsize();
  59. extern float *godot_webxr_get_transform_for_eye(int p_eye);
  60. extern float *godot_webxr_get_projection_for_eye(int p_eye);
  61. extern int godot_webxr_get_external_texture_for_eye(int p_eye);
  62. extern void godot_webxr_commit_for_eye(int p_eye);
  63. extern void godot_webxr_sample_controller_data();
  64. extern int godot_webxr_get_controller_count();
  65. extern int godot_webxr_is_controller_connected(int p_controller);
  66. extern float *godot_webxr_get_controller_transform(int p_controller);
  67. extern int *godot_webxr_get_controller_buttons(int p_controller);
  68. extern int *godot_webxr_get_controller_axes(int p_controller);
  69. extern char *godot_webxr_get_visibility_state();
  70. extern int *godot_webxr_get_bounds_geometry();
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #endif /* GODOT_WEBXR_H */