godot_arvr.h 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*************************************************************************/
  2. /* godot_arvr.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 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_NATIVEARVR_H
  31. #define GODOT_NATIVEARVR_H
  32. #include <gdnative/gdnative.h>
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. // For future versions of the API we should only add new functions at the end of the structure and use the
  37. // version info to detect whether a call is available
  38. // Use these to populate version in your plugin
  39. #define GODOTVR_API_MAJOR 1
  40. #define GODOTVR_API_MINOR 0
  41. typedef struct {
  42. godot_gdnative_api_version version; /* version of our API */
  43. void *(*constructor)(godot_object *);
  44. void (*destructor)(void *);
  45. godot_string (*get_name)(const void *);
  46. godot_int (*get_capabilities)(const void *);
  47. godot_bool (*get_anchor_detection_is_enabled)(const void *);
  48. void (*set_anchor_detection_is_enabled)(void *, godot_bool);
  49. godot_bool (*is_stereo)(const void *);
  50. godot_bool (*is_initialized)(const void *);
  51. godot_bool (*initialize)(void *);
  52. void (*uninitialize)(void *);
  53. godot_vector2 (*get_render_targetsize)(const void *);
  54. godot_transform (*get_transform_for_eye)(void *, godot_int, godot_transform *);
  55. void (*fill_projection_for_eye)(void *, godot_real *, godot_int, godot_real, godot_real, godot_real);
  56. void (*commit_for_eye)(void *, godot_int, godot_rid *, godot_rect2 *);
  57. void (*process)(void *);
  58. } godot_arvr_interface_gdnative;
  59. void GDAPI godot_arvr_register_interface(const godot_arvr_interface_gdnative *p_interface);
  60. // helper functions to access ARVRServer data
  61. godot_real GDAPI godot_arvr_get_worldscale();
  62. godot_transform GDAPI godot_arvr_get_reference_frame();
  63. // helper functions for rendering
  64. void GDAPI godot_arvr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect);
  65. godot_int GDAPI godot_arvr_get_texid(godot_rid *p_render_target);
  66. // helper functions for updating ARVR controllers
  67. godot_int GDAPI godot_arvr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position);
  68. void GDAPI godot_arvr_remove_controller(godot_int p_controller_id);
  69. void GDAPI godot_arvr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position);
  70. void GDAPI godot_arvr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed);
  71. void GDAPI godot_arvr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative);
  72. godot_real GDAPI godot_arvr_get_controller_rumble(godot_int p_controller_id);
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76. #endif /* !GODOT_NATIVEARVR_H */