arvr_interface_gdnative.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**************************************************************************/
  2. /* arvr_interface_gdnative.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 ARVR_INTERFACE_GDNATIVE_H
  31. #define ARVR_INTERFACE_GDNATIVE_H
  32. #include "modules/gdnative/gdnative.h"
  33. #include "servers/arvr/arvr_interface.h"
  34. /**
  35. @authors Hinsbart & Karroffel & Mux213
  36. This subclass of our AR/VR interface forms a bridge to GDNative.
  37. */
  38. class ARVRInterfaceGDNative : public ARVRInterface {
  39. GDCLASS(ARVRInterfaceGDNative, ARVRInterface);
  40. void cleanup();
  41. protected:
  42. const godot_arvr_interface_gdnative *interface;
  43. void *data;
  44. static void _bind_methods();
  45. public:
  46. /** general interface information **/
  47. ARVRInterfaceGDNative();
  48. ~ARVRInterfaceGDNative();
  49. void set_interface(const godot_arvr_interface_gdnative *p_interface);
  50. virtual StringName get_name() const;
  51. virtual int get_capabilities() const;
  52. virtual bool is_initialized() const;
  53. virtual bool initialize();
  54. virtual void uninitialize();
  55. /** specific to AR **/
  56. virtual bool get_anchor_detection_is_enabled() const;
  57. virtual void set_anchor_detection_is_enabled(bool p_enable);
  58. virtual int get_camera_feed_id();
  59. /** rendering and internal **/
  60. virtual Size2 get_render_targetsize();
  61. virtual bool is_stereo();
  62. virtual Transform get_transform_for_eye(ARVRInterface::Eyes p_eye, const Transform &p_cam_transform);
  63. // and a CameraMatrix version to ARVRServer
  64. virtual CameraMatrix get_projection_for_eye(ARVRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far);
  65. virtual unsigned int get_external_texture_for_eye(ARVRInterface::Eyes p_eye);
  66. virtual unsigned int get_external_depth_for_eye(ARVRInterface::Eyes p_eye);
  67. virtual void commit_for_eye(ARVRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect);
  68. virtual void process();
  69. virtual void notification(int p_what);
  70. };
  71. #endif // ARVR_INTERFACE_GDNATIVE_H