class_arvrinterface.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/ARVRInterface.xml.
  6. .. _class_ARVRInterface:
  7. ARVRInterface
  8. =============
  9. **Inherits:** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`ARVRInterfaceGDNative<class_ARVRInterfaceGDNative>`, :ref:`MobileVRInterface<class_MobileVRInterface>`, :ref:`WebXRInterface<class_WebXRInterface>`
  11. Base class for an AR/VR interface implementation.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. This class needs to be implemented to make an AR or VR platform available to Godot and these should be implemented as C++ modules or GDNative modules (note that for GDNative the subclass ARVRScriptInterface should be used). Part of the interface is exposed to GDScript so you can detect, enable and configure an AR or VR platform.
  16. Interfaces should be written in such a way that simply enabling them will give us a working setup. You can query the available interfaces through :ref:`ARVRServer<class_ARVRServer>`.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`../tutorials/vr/index`
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +-------------------------+----------------------------------------------------------------------------------------------------+-----------+
  27. | :ref:`bool<class_bool>` | :ref:`ar_is_anchor_detection_enabled<class_ARVRInterface_property_ar_is_anchor_detection_enabled>` | ``false`` |
  28. +-------------------------+----------------------------------------------------------------------------------------------------+-----------+
  29. | :ref:`bool<class_bool>` | :ref:`interface_is_initialized<class_ARVRInterface_property_interface_is_initialized>` | ``false`` |
  30. +-------------------------+----------------------------------------------------------------------------------------------------+-----------+
  31. | :ref:`bool<class_bool>` | :ref:`interface_is_primary<class_ARVRInterface_property_interface_is_primary>` | ``false`` |
  32. +-------------------------+----------------------------------------------------------------------------------------------------+-----------+
  33. .. rst-class:: classref-reftable-group
  34. Methods
  35. -------
  36. .. table::
  37. :widths: auto
  38. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`get_camera_feed_id<class_ARVRInterface_method_get_camera_feed_id>` **(** **)** |
  40. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`get_capabilities<class_ARVRInterface_method_get_capabilities>` **(** **)** |const| |
  42. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`String<class_String>` | :ref:`get_name<class_ARVRInterface_method_get_name>` **(** **)** |const| |
  44. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`Vector2<class_Vector2>` | :ref:`get_render_targetsize<class_ARVRInterface_method_get_render_targetsize>` **(** **)** |
  46. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` | :ref:`get_tracking_status<class_ARVRInterface_method_get_tracking_status>` **(** **)** |const| |
  48. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Transform<class_Transform>` | :ref:`get_transform_for_eye<class_ARVRInterface_method_get_transform_for_eye>` **(** :ref:`Eyes<enum_ARVRInterface_Eyes>` eye, :ref:`Transform<class_Transform>` transform **)** |
  50. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`initialize<class_ARVRInterface_method_initialize>` **(** **)** |
  52. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`bool<class_bool>` | :ref:`is_stereo<class_ARVRInterface_method_is_stereo>` **(** **)** |
  54. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`uninitialize<class_ARVRInterface_method_uninitialize>` **(** **)** |
  56. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. .. rst-class:: classref-section-separator
  58. ----
  59. .. rst-class:: classref-descriptions-group
  60. Enumerations
  61. ------------
  62. .. _enum_ARVRInterface_Capabilities:
  63. .. rst-class:: classref-enumeration
  64. enum **Capabilities**:
  65. .. _class_ARVRInterface_constant_ARVR_NONE:
  66. .. rst-class:: classref-enumeration-constant
  67. :ref:`Capabilities<enum_ARVRInterface_Capabilities>` **ARVR_NONE** = ``0``
  68. No ARVR capabilities.
  69. .. _class_ARVRInterface_constant_ARVR_MONO:
  70. .. rst-class:: classref-enumeration-constant
  71. :ref:`Capabilities<enum_ARVRInterface_Capabilities>` **ARVR_MONO** = ``1``
  72. This interface can work with normal rendering output (non-HMD based AR).
  73. .. _class_ARVRInterface_constant_ARVR_STEREO:
  74. .. rst-class:: classref-enumeration-constant
  75. :ref:`Capabilities<enum_ARVRInterface_Capabilities>` **ARVR_STEREO** = ``2``
  76. This interface supports stereoscopic rendering.
  77. .. _class_ARVRInterface_constant_ARVR_AR:
  78. .. rst-class:: classref-enumeration-constant
  79. :ref:`Capabilities<enum_ARVRInterface_Capabilities>` **ARVR_AR** = ``4``
  80. This interface supports AR (video background and real world tracking).
  81. .. _class_ARVRInterface_constant_ARVR_EXTERNAL:
  82. .. rst-class:: classref-enumeration-constant
  83. :ref:`Capabilities<enum_ARVRInterface_Capabilities>` **ARVR_EXTERNAL** = ``8``
  84. This interface outputs to an external device. If the main viewport is used, the on screen output is an unmodified buffer of either the left or right eye (stretched if the viewport size is not changed to the same aspect ratio of :ref:`get_render_targetsize<class_ARVRInterface_method_get_render_targetsize>`). Using a separate viewport node frees up the main viewport for other purposes.
  85. .. rst-class:: classref-item-separator
  86. ----
  87. .. _enum_ARVRInterface_Eyes:
  88. .. rst-class:: classref-enumeration
  89. enum **Eyes**:
  90. .. _class_ARVRInterface_constant_EYE_MONO:
  91. .. rst-class:: classref-enumeration-constant
  92. :ref:`Eyes<enum_ARVRInterface_Eyes>` **EYE_MONO** = ``0``
  93. Mono output, this is mostly used internally when retrieving positioning information for our camera node or when stereo scopic rendering is not supported.
  94. .. _class_ARVRInterface_constant_EYE_LEFT:
  95. .. rst-class:: classref-enumeration-constant
  96. :ref:`Eyes<enum_ARVRInterface_Eyes>` **EYE_LEFT** = ``1``
  97. Left eye output, this is mostly used internally when rendering the image for the left eye and obtaining positioning and projection information.
  98. .. _class_ARVRInterface_constant_EYE_RIGHT:
  99. .. rst-class:: classref-enumeration-constant
  100. :ref:`Eyes<enum_ARVRInterface_Eyes>` **EYE_RIGHT** = ``2``
  101. Right eye output, this is mostly used internally when rendering the image for the right eye and obtaining positioning and projection information.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _enum_ARVRInterface_Tracking_status:
  105. .. rst-class:: classref-enumeration
  106. enum **Tracking_status**:
  107. .. _class_ARVRInterface_constant_ARVR_NORMAL_TRACKING:
  108. .. rst-class:: classref-enumeration-constant
  109. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **ARVR_NORMAL_TRACKING** = ``0``
  110. Tracking is behaving as expected.
  111. .. _class_ARVRInterface_constant_ARVR_EXCESSIVE_MOTION:
  112. .. rst-class:: classref-enumeration-constant
  113. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **ARVR_EXCESSIVE_MOTION** = ``1``
  114. Tracking is hindered by excessive motion (the player is moving faster than tracking can keep up).
  115. .. _class_ARVRInterface_constant_ARVR_INSUFFICIENT_FEATURES:
  116. .. rst-class:: classref-enumeration-constant
  117. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **ARVR_INSUFFICIENT_FEATURES** = ``2``
  118. Tracking is hindered by insufficient features, it's too dark (for camera-based tracking), player is blocked, etc.
  119. .. _class_ARVRInterface_constant_ARVR_UNKNOWN_TRACKING:
  120. .. rst-class:: classref-enumeration-constant
  121. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **ARVR_UNKNOWN_TRACKING** = ``3``
  122. We don't know the status of the tracking or this interface does not provide feedback.
  123. .. _class_ARVRInterface_constant_ARVR_NOT_TRACKING:
  124. .. rst-class:: classref-enumeration-constant
  125. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **ARVR_NOT_TRACKING** = ``4``
  126. Tracking is not functional (camera not plugged in or obscured, lighthouses turned off, etc.).
  127. .. rst-class:: classref-section-separator
  128. ----
  129. .. rst-class:: classref-descriptions-group
  130. Property Descriptions
  131. ---------------------
  132. .. _class_ARVRInterface_property_ar_is_anchor_detection_enabled:
  133. .. rst-class:: classref-property
  134. :ref:`bool<class_bool>` **ar_is_anchor_detection_enabled** = ``false``
  135. .. rst-class:: classref-property-setget
  136. - void **set_anchor_detection_is_enabled** **(** :ref:`bool<class_bool>` value **)**
  137. - :ref:`bool<class_bool>` **get_anchor_detection_is_enabled** **(** **)**
  138. On an AR interface, ``true`` if anchor detection is enabled.
  139. .. rst-class:: classref-item-separator
  140. ----
  141. .. _class_ARVRInterface_property_interface_is_initialized:
  142. .. rst-class:: classref-property
  143. :ref:`bool<class_bool>` **interface_is_initialized** = ``false``
  144. .. rst-class:: classref-property-setget
  145. - void **set_is_initialized** **(** :ref:`bool<class_bool>` value **)**
  146. - :ref:`bool<class_bool>` **is_initialized** **(** **)**
  147. ``true`` if this interface been initialized.
  148. .. rst-class:: classref-item-separator
  149. ----
  150. .. _class_ARVRInterface_property_interface_is_primary:
  151. .. rst-class:: classref-property
  152. :ref:`bool<class_bool>` **interface_is_primary** = ``false``
  153. .. rst-class:: classref-property-setget
  154. - void **set_is_primary** **(** :ref:`bool<class_bool>` value **)**
  155. - :ref:`bool<class_bool>` **is_primary** **(** **)**
  156. ``true`` if this is the primary interface.
  157. .. rst-class:: classref-section-separator
  158. ----
  159. .. rst-class:: classref-descriptions-group
  160. Method Descriptions
  161. -------------------
  162. .. _class_ARVRInterface_method_get_camera_feed_id:
  163. .. rst-class:: classref-method
  164. :ref:`int<class_int>` **get_camera_feed_id** **(** **)**
  165. If this is an AR interface that requires displaying a camera feed as the background, this method returns the feed ID in the :ref:`CameraServer<class_CameraServer>` for this interface.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_ARVRInterface_method_get_capabilities:
  169. .. rst-class:: classref-method
  170. :ref:`int<class_int>` **get_capabilities** **(** **)** |const|
  171. Returns a combination of :ref:`Capabilities<enum_ARVRInterface_Capabilities>` flags providing information about the capabilities of this interface.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_ARVRInterface_method_get_name:
  175. .. rst-class:: classref-method
  176. :ref:`String<class_String>` **get_name** **(** **)** |const|
  177. Returns the name of this interface (OpenVR, OpenHMD, ARKit, etc).
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_ARVRInterface_method_get_render_targetsize:
  181. .. rst-class:: classref-method
  182. :ref:`Vector2<class_Vector2>` **get_render_targetsize** **(** **)**
  183. Returns the resolution at which we should render our intermediate results before things like lens distortion are applied by the VR platform.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _class_ARVRInterface_method_get_tracking_status:
  187. .. rst-class:: classref-method
  188. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **get_tracking_status** **(** **)** |const|
  189. If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_ARVRInterface_method_get_transform_for_eye:
  193. .. rst-class:: classref-method
  194. :ref:`Transform<class_Transform>` **get_transform_for_eye** **(** :ref:`Eyes<enum_ARVRInterface_Eyes>` eye, :ref:`Transform<class_Transform>` transform **)**
  195. Returns the transform for an eye multiplied by ``transform``. The usual value for ``transform`` is the global_transform of the current ARVROrigin.
  196. .. rst-class:: classref-item-separator
  197. ----
  198. .. _class_ARVRInterface_method_initialize:
  199. .. rst-class:: classref-method
  200. :ref:`bool<class_bool>` **initialize** **(** **)**
  201. Call this to initialize this interface. The first interface that is initialized is identified as the primary interface and it will be used for rendering output.
  202. After initializing the interface you want to use you then need to enable the AR/VR mode of a viewport and rendering should commence.
  203. \ **Note:** You must enable the AR/VR mode on the main viewport for any device that uses the main output of Godot, such as for mobile VR.
  204. If you do this for a platform that handles its own output (such as OpenVR) Godot will show just one eye without distortion on screen. Alternatively, you can add a separate viewport node to your scene and enable AR/VR on that viewport. It will be used to output to the HMD, leaving you free to do anything you like in the main window, such as using a separate camera as a spectator camera or rendering something completely different.
  205. While currently not used, you can activate additional interfaces. You may wish to do this if you want to track controllers from other platforms. However, at this point in time only one interface can render to an HMD.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_ARVRInterface_method_is_stereo:
  209. .. rst-class:: classref-method
  210. :ref:`bool<class_bool>` **is_stereo** **(** **)**
  211. Returns ``true`` if the current output of this interface is in stereo.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_ARVRInterface_method_uninitialize:
  215. .. rst-class:: classref-method
  216. void **uninitialize** **(** **)**
  217. Turns the interface off.
  218. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  219. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  220. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  221. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`