class_arvrinterface.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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.5/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.5/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:`bool<class_bool>` | :ref:`initialize<class_ARVRInterface_method_initialize>` **(** **)** |
  50. +------------------------------------------------------------+------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`is_stereo<class_ARVRInterface_method_is_stereo>` **(** **)** |
  52. +------------------------------------------------------------+------------------------------------------------------------------------------------------------+
  53. | void | :ref:`uninitialize<class_ARVRInterface_method_uninitialize>` **(** **)** |
  54. +------------------------------------------------------------+------------------------------------------------------------------------------------------------+
  55. .. rst-class:: classref-section-separator
  56. ----
  57. .. rst-class:: classref-descriptions-group
  58. Enumerations
  59. ------------
  60. .. _enum_ARVRInterface_Capabilities:
  61. .. rst-class:: classref-enumeration
  62. enum **Capabilities**:
  63. .. _class_ARVRInterface_constant_ARVR_NONE:
  64. .. rst-class:: classref-enumeration-constant
  65. :ref:`Capabilities<enum_ARVRInterface_Capabilities>` **ARVR_NONE** = ``0``
  66. No ARVR capabilities.
  67. .. _class_ARVRInterface_constant_ARVR_MONO:
  68. .. rst-class:: classref-enumeration-constant
  69. :ref:`Capabilities<enum_ARVRInterface_Capabilities>` **ARVR_MONO** = ``1``
  70. This interface can work with normal rendering output (non-HMD based AR).
  71. .. _class_ARVRInterface_constant_ARVR_STEREO:
  72. .. rst-class:: classref-enumeration-constant
  73. :ref:`Capabilities<enum_ARVRInterface_Capabilities>` **ARVR_STEREO** = ``2``
  74. This interface supports stereoscopic rendering.
  75. .. _class_ARVRInterface_constant_ARVR_AR:
  76. .. rst-class:: classref-enumeration-constant
  77. :ref:`Capabilities<enum_ARVRInterface_Capabilities>` **ARVR_AR** = ``4``
  78. This interface supports AR (video background and real world tracking).
  79. .. _class_ARVRInterface_constant_ARVR_EXTERNAL:
  80. .. rst-class:: classref-enumeration-constant
  81. :ref:`Capabilities<enum_ARVRInterface_Capabilities>` **ARVR_EXTERNAL** = ``8``
  82. 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.
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _enum_ARVRInterface_Eyes:
  86. .. rst-class:: classref-enumeration
  87. enum **Eyes**:
  88. .. _class_ARVRInterface_constant_EYE_MONO:
  89. .. rst-class:: classref-enumeration-constant
  90. :ref:`Eyes<enum_ARVRInterface_Eyes>` **EYE_MONO** = ``0``
  91. Mono output, this is mostly used internally when retrieving positioning information for our camera node or when stereo scopic rendering is not supported.
  92. .. _class_ARVRInterface_constant_EYE_LEFT:
  93. .. rst-class:: classref-enumeration-constant
  94. :ref:`Eyes<enum_ARVRInterface_Eyes>` **EYE_LEFT** = ``1``
  95. Left eye output, this is mostly used internally when rendering the image for the left eye and obtaining positioning and projection information.
  96. .. _class_ARVRInterface_constant_EYE_RIGHT:
  97. .. rst-class:: classref-enumeration-constant
  98. :ref:`Eyes<enum_ARVRInterface_Eyes>` **EYE_RIGHT** = ``2``
  99. Right eye output, this is mostly used internally when rendering the image for the right eye and obtaining positioning and projection information.
  100. .. rst-class:: classref-item-separator
  101. ----
  102. .. _enum_ARVRInterface_Tracking_status:
  103. .. rst-class:: classref-enumeration
  104. enum **Tracking_status**:
  105. .. _class_ARVRInterface_constant_ARVR_NORMAL_TRACKING:
  106. .. rst-class:: classref-enumeration-constant
  107. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **ARVR_NORMAL_TRACKING** = ``0``
  108. Tracking is behaving as expected.
  109. .. _class_ARVRInterface_constant_ARVR_EXCESSIVE_MOTION:
  110. .. rst-class:: classref-enumeration-constant
  111. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **ARVR_EXCESSIVE_MOTION** = ``1``
  112. Tracking is hindered by excessive motion (the player is moving faster than tracking can keep up).
  113. .. _class_ARVRInterface_constant_ARVR_INSUFFICIENT_FEATURES:
  114. .. rst-class:: classref-enumeration-constant
  115. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **ARVR_INSUFFICIENT_FEATURES** = ``2``
  116. Tracking is hindered by insufficient features, it's too dark (for camera-based tracking), player is blocked, etc.
  117. .. _class_ARVRInterface_constant_ARVR_UNKNOWN_TRACKING:
  118. .. rst-class:: classref-enumeration-constant
  119. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **ARVR_UNKNOWN_TRACKING** = ``3``
  120. We don't know the status of the tracking or this interface does not provide feedback.
  121. .. _class_ARVRInterface_constant_ARVR_NOT_TRACKING:
  122. .. rst-class:: classref-enumeration-constant
  123. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **ARVR_NOT_TRACKING** = ``4``
  124. Tracking is not functional (camera not plugged in or obscured, lighthouses turned off, etc.).
  125. .. rst-class:: classref-section-separator
  126. ----
  127. .. rst-class:: classref-descriptions-group
  128. Property Descriptions
  129. ---------------------
  130. .. _class_ARVRInterface_property_ar_is_anchor_detection_enabled:
  131. .. rst-class:: classref-property
  132. :ref:`bool<class_bool>` **ar_is_anchor_detection_enabled** = ``false``
  133. .. rst-class:: classref-property-setget
  134. - void **set_anchor_detection_is_enabled** **(** :ref:`bool<class_bool>` value **)**
  135. - :ref:`bool<class_bool>` **get_anchor_detection_is_enabled** **(** **)**
  136. On an AR interface, ``true`` if anchor detection is enabled.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_ARVRInterface_property_interface_is_initialized:
  140. .. rst-class:: classref-property
  141. :ref:`bool<class_bool>` **interface_is_initialized** = ``false``
  142. .. rst-class:: classref-property-setget
  143. - void **set_is_initialized** **(** :ref:`bool<class_bool>` value **)**
  144. - :ref:`bool<class_bool>` **is_initialized** **(** **)**
  145. ``true`` if this interface been initialized.
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_ARVRInterface_property_interface_is_primary:
  149. .. rst-class:: classref-property
  150. :ref:`bool<class_bool>` **interface_is_primary** = ``false``
  151. .. rst-class:: classref-property-setget
  152. - void **set_is_primary** **(** :ref:`bool<class_bool>` value **)**
  153. - :ref:`bool<class_bool>` **is_primary** **(** **)**
  154. ``true`` if this is the primary interface.
  155. .. rst-class:: classref-section-separator
  156. ----
  157. .. rst-class:: classref-descriptions-group
  158. Method Descriptions
  159. -------------------
  160. .. _class_ARVRInterface_method_get_camera_feed_id:
  161. .. rst-class:: classref-method
  162. :ref:`int<class_int>` **get_camera_feed_id** **(** **)**
  163. 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.
  164. .. rst-class:: classref-item-separator
  165. ----
  166. .. _class_ARVRInterface_method_get_capabilities:
  167. .. rst-class:: classref-method
  168. :ref:`int<class_int>` **get_capabilities** **(** **)** |const|
  169. Returns a combination of :ref:`Capabilities<enum_ARVRInterface_Capabilities>` flags providing information about the capabilities of this interface.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_ARVRInterface_method_get_name:
  173. .. rst-class:: classref-method
  174. :ref:`String<class_String>` **get_name** **(** **)** |const|
  175. Returns the name of this interface (OpenVR, OpenHMD, ARKit, etc).
  176. .. rst-class:: classref-item-separator
  177. ----
  178. .. _class_ARVRInterface_method_get_render_targetsize:
  179. .. rst-class:: classref-method
  180. :ref:`Vector2<class_Vector2>` **get_render_targetsize** **(** **)**
  181. Returns the resolution at which we should render our intermediate results before things like lens distortion are applied by the VR platform.
  182. .. rst-class:: classref-item-separator
  183. ----
  184. .. _class_ARVRInterface_method_get_tracking_status:
  185. .. rst-class:: classref-method
  186. :ref:`Tracking_status<enum_ARVRInterface_Tracking_status>` **get_tracking_status** **(** **)** |const|
  187. 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.
  188. .. rst-class:: classref-item-separator
  189. ----
  190. .. _class_ARVRInterface_method_initialize:
  191. .. rst-class:: classref-method
  192. :ref:`bool<class_bool>` **initialize** **(** **)**
  193. 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.
  194. After initializing the interface you want to use you then need to enable the AR/VR mode of a viewport and rendering should commence.
  195. \ **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.
  196. 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.
  197. 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.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_ARVRInterface_method_is_stereo:
  201. .. rst-class:: classref-method
  202. :ref:`bool<class_bool>` **is_stereo** **(** **)**
  203. Returns ``true`` if the current output of this interface is in stereo.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_ARVRInterface_method_uninitialize:
  207. .. rst-class:: classref-method
  208. void **uninitialize** **(** **)**
  209. Turns the interface off.
  210. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  211. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  212. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  213. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`