OpenXRSpatialEntityExtension.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="OpenXRSpatialEntityExtension" inherits="OpenXRExtensionWrapper" experimental="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
  3. <brief_description>
  4. OpenXR extension that handles spatial entities.
  5. </brief_description>
  6. <description>
  7. OpenXR extension that handles spatial entities and, when enabled, allows querying those spatial entities. This extension will also automatically manage [XRTracker] objects for static entities.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="add_spatial_entity">
  13. <return type="RID" />
  14. <param index="0" name="spatial_context" type="RID" />
  15. <param index="1" name="entity_id" type="int" />
  16. <param index="2" name="entity" type="int" />
  17. <description>
  18. Registers an entity that was created directly on the OpenXR runtime.
  19. </description>
  20. </method>
  21. <method name="create_spatial_context">
  22. <return type="OpenXRFutureResult" />
  23. <param index="0" name="capability_configurations" type="OpenXRSpatialCapabilityConfigurationBaseHeader[]" />
  24. <param index="1" name="next" type="OpenXRStructureBase" default="null" />
  25. <param index="2" name="user_callback" type="Callable" default="Callable()" />
  26. <description>
  27. Creates a new spatial context that handles entities for the provided capability configurations. [param capability_configurations] is an array of [OpenXRSpatialCapabilityConfigurationBaseHeader] with the needed capability configuration data.
  28. [param next] is an optional parameter that can contain additional information for creating our spatial context.
  29. [b]Note:[/b] This is an asynchronous method and returns an [OpenXRFutureResult] object with which to track the status, discarding this object will not cancel the creation process. On success [param user_callback] will be called if specified. The result data for this function is the [RID] for our spatial context.
  30. </description>
  31. </method>
  32. <method name="discover_spatial_entities">
  33. <return type="OpenXRFutureResult" />
  34. <param index="0" name="spatial_context" type="RID" />
  35. <param index="1" name="component_types" type="PackedInt64Array" />
  36. <param index="2" name="next" type="OpenXRStructureBase" default="null" />
  37. <param index="3" name="user_callback" type="Callable" default="Callable()" />
  38. <description>
  39. Starts a new discovery query, this will gather all objects tracked by the [param spatial_context] that have at least one of the component types specified in [param component_types].
  40. [param next] is an optional parameter that can contain additional information for executing the discovery query.
  41. [b]Note:[/b] This is an asynchronous method and returns an [OpenXRFutureResult] object with which to track the status, discarding this object will not cancel the discovery process. On success [param user_callback] will be called if specified. The result data for this function is the [RID] for our snapshot.
  42. </description>
  43. </method>
  44. <method name="find_spatial_entity">
  45. <return type="RID" />
  46. <param index="0" name="entity_id" type="int" />
  47. <description>
  48. Returns the [RID] for the specified spatial entity ID.
  49. </description>
  50. </method>
  51. <method name="free_spatial_context">
  52. <return type="void" />
  53. <param index="0" name="spatial_context" type="RID" />
  54. <description>
  55. Frees a spatial context previously created when calling [method create_spatial_context]. If the spatial context creation is still ongoing, the asynchronous process is cancelled.
  56. </description>
  57. </method>
  58. <method name="free_spatial_entity">
  59. <return type="void" />
  60. <param index="0" name="entity" type="RID" />
  61. <description>
  62. Frees an entity previously created when calling [method add_spatial_entity] or [method make_spatial_entity].
  63. </description>
  64. </method>
  65. <method name="free_spatial_snapshot">
  66. <return type="void" />
  67. <param index="0" name="spatial_snapshot" type="RID" />
  68. <description>
  69. Frees a spatial snapshot previously created when calling [method discover_spatial_entities]. If the spatial snapshot creation is still ongoing, the asynchronous process is cancelled.
  70. </description>
  71. </method>
  72. <method name="get_float_buffer" qualifiers="const">
  73. <return type="PackedFloat32Array" />
  74. <param index="0" name="spatial_snapshot" type="RID" />
  75. <param index="1" name="buffer_id" type="int" />
  76. <description>
  77. Returns a buffer with floats from a buffer that was retrieved when taking a snapshot.
  78. </description>
  79. </method>
  80. <method name="get_spatial_context_handle" qualifiers="const">
  81. <return type="int" />
  82. <param index="0" name="spatial_context" type="RID" />
  83. <description>
  84. Returns the OpenXR spatial context handle for this snapshot.
  85. [b]Note:[/b] This method is intended to be used from GDExtensions that implement spatial entity capability handlers.
  86. </description>
  87. </method>
  88. <method name="get_spatial_context_ready" qualifiers="const">
  89. <return type="bool" />
  90. <param index="0" name="spatial_context" type="RID" />
  91. <description>
  92. Returns [code]true[/code] if the spatial context finished its creation and is ready to be used.
  93. </description>
  94. </method>
  95. <method name="get_spatial_entity_context" qualifiers="const">
  96. <return type="RID" />
  97. <param index="0" name="entity" type="RID" />
  98. <description>
  99. Returns the spatial context for this entity.
  100. </description>
  101. </method>
  102. <method name="get_spatial_entity_id" qualifiers="const">
  103. <return type="int" />
  104. <param index="0" name="entity" type="RID" />
  105. <description>
  106. Returns the internal [code]XrSpatialEntityIdEXT[/code] associated with the entity.
  107. </description>
  108. </method>
  109. <method name="get_spatial_snapshot_context" qualifiers="const">
  110. <return type="RID" />
  111. <param index="0" name="spatial_snapshot" type="RID" />
  112. <description>
  113. Returns the spatial context related to this spatial snapshot.
  114. </description>
  115. </method>
  116. <method name="get_spatial_snapshot_handle" qualifiers="const">
  117. <return type="int" />
  118. <param index="0" name="spatial_snapshot" type="RID" />
  119. <description>
  120. Returns the OpenXR spatial snapshot handle for this snapshot.
  121. [b]Note:[/b] This method is intended to be used from GDExtensions that implement spatial entity capability handlers.
  122. </description>
  123. </method>
  124. <method name="get_string" qualifiers="const">
  125. <return type="String" />
  126. <param index="0" name="spatial_snapshot" type="RID" />
  127. <param index="1" name="buffer_id" type="int" />
  128. <description>
  129. Returns a string from a buffer that was retrieved when taking a snapshot.
  130. </description>
  131. </method>
  132. <method name="get_uint8_buffer" qualifiers="const">
  133. <return type="PackedByteArray" />
  134. <param index="0" name="spatial_snapshot" type="RID" />
  135. <param index="1" name="buffer_id" type="int" />
  136. <description>
  137. Returns a buffer with 8 bit ints from a buffer that was retrieved when taking a snapshot.
  138. </description>
  139. </method>
  140. <method name="get_uint16_buffer" qualifiers="const">
  141. <return type="PackedInt32Array" />
  142. <param index="0" name="spatial_snapshot" type="RID" />
  143. <param index="1" name="buffer_id" type="int" />
  144. <description>
  145. Returns a buffer with 16 bit ints from a buffer that was retrieved when taking a snapshot.
  146. </description>
  147. </method>
  148. <method name="get_uint32_buffer" qualifiers="const">
  149. <return type="PackedInt32Array" />
  150. <param index="0" name="spatial_snapshot" type="RID" />
  151. <param index="1" name="buffer_id" type="int" />
  152. <description>
  153. Returns a buffer with 32 bit ints from a buffer that was retrieved when taking a snapshot.
  154. </description>
  155. </method>
  156. <method name="get_vector2_buffer" qualifiers="const">
  157. <return type="PackedVector2Array" />
  158. <param index="0" name="spatial_snapshot" type="RID" />
  159. <param index="1" name="buffer_id" type="int" />
  160. <description>
  161. Returns a buffer with [Vector2] entries from a buffer that was retrieved when taking a snapshot.
  162. </description>
  163. </method>
  164. <method name="get_vector3_buffer" qualifiers="const">
  165. <return type="PackedVector3Array" />
  166. <param index="0" name="spatial_snapshot" type="RID" />
  167. <param index="1" name="buffer_id" type="int" />
  168. <description>
  169. Returns a buffer with [Vector3] entries from a buffer that was retrieved when taking a snapshot.
  170. </description>
  171. </method>
  172. <method name="make_spatial_entity">
  173. <return type="RID" />
  174. <param index="0" name="spatial_context" type="RID" />
  175. <param index="1" name="entity_id" type="int" />
  176. <description>
  177. Creates a new entity for this [param entity_id]. The [param spatial_context] should match the context that discovered the entity.
  178. </description>
  179. </method>
  180. <method name="query_snapshot">
  181. <return type="bool" />
  182. <param index="0" name="spatial_snapshot" type="RID" />
  183. <param index="1" name="component_data" type="OpenXRSpatialComponentData[]" />
  184. <param index="2" name="next" type="OpenXRStructureBase" default="null" />
  185. <description>
  186. Queries the snapshot data. This will find all entities in the snapshot that contain all requested components in [param component_data]. The objects held within [param component_data] will then be populated with the queried data. [param component_data] must always have an object of [OpenXRSpatialQueryResultData] as the first entry.
  187. [param next] is an optional parameter that can contain additional information passed when setting our query conditions.
  188. </description>
  189. </method>
  190. <method name="supports_capability">
  191. <return type="bool" />
  192. <param index="0" name="capability" type="int" enum="OpenXRSpatialEntityExtension.Capability" />
  193. <description>
  194. Returns [code]true[/code] if this spatial entity [param capability] is supported by the hardware used.
  195. </description>
  196. </method>
  197. <method name="supports_component_type">
  198. <return type="bool" />
  199. <param index="0" name="capability" type="int" enum="OpenXRSpatialEntityExtension.Capability" />
  200. <param index="1" name="component_type" type="int" enum="OpenXRSpatialEntityExtension.ComponentType" />
  201. <description>
  202. Returns [code]true[/code] if this [param capability] supports the [param component_type].
  203. </description>
  204. </method>
  205. <method name="update_spatial_entities">
  206. <return type="RID" />
  207. <param index="0" name="spatial_context" type="RID" />
  208. <param index="1" name="entities" type="RID[]" />
  209. <param index="2" name="component_types" type="PackedInt64Array" />
  210. <param index="3" name="next" type="OpenXRStructureBase" default="null" />
  211. <description>
  212. Performs a snapshot for a limited number of entities. This is NOT an asynchronous method and will return the snapshot immediately.
  213. </description>
  214. </method>
  215. </methods>
  216. <signals>
  217. <signal name="spatial_discovery_recommended">
  218. <param index="0" name="spatial_context" type="RID" />
  219. <description>
  220. Emitted when OpenXR recommends running a discovery query because entities managed by this spatial context have (likely) changed.
  221. </description>
  222. </signal>
  223. </signals>
  224. <constants>
  225. <constant name="CAPABILITY_PLANE_TRACKING" value="1000741000" enum="Capability">
  226. Plane tracking capability.
  227. </constant>
  228. <constant name="CAPABILITY_MARKER_TRACKING_QR_CODE" value="1000743000" enum="Capability">
  229. QR code based marker tracking capability.
  230. </constant>
  231. <constant name="CAPABILITY_MARKER_TRACKING_MICRO_QR_CODE" value="1000743001" enum="Capability">
  232. Micro QR code based marker tracking capability.
  233. </constant>
  234. <constant name="CAPABILITY_MARKER_TRACKING_ARUCO_MARKER" value="1000743002" enum="Capability">
  235. Aruco marker based marker tracking capability.
  236. </constant>
  237. <constant name="CAPABILITY_MARKER_TRACKING_APRIL_TAG" value="1000743003" enum="Capability">
  238. April tag based marker tracking capability.
  239. </constant>
  240. <constant name="CAPABILITY_ANCHOR" value="1000762000" enum="Capability">
  241. Anchor capability.
  242. </constant>
  243. <constant name="COMPONENT_TYPE_BOUNDED_2D" value="1" enum="ComponentType">
  244. Component that provides the 2D bounds for a spatial entity. The corresponding list structure is [code]XrSpatialComponentBounded2DListEXT[/code]; the corresponding data structure is [code]XrSpatialBounded2DDataEXT[/code].
  245. </constant>
  246. <constant name="COMPONENT_TYPE_BOUNDED_3D" value="2" enum="ComponentType">
  247. Component that provides the 3D bounds for a spatial entity. The corresponding list structure is [code]XrSpatialComponentBounded3DListEXT[/code]; the corresponding data structure is [code]XrBoxf[/code].
  248. </constant>
  249. <constant name="COMPONENT_TYPE_PARENT" value="3" enum="ComponentType">
  250. Component that provides the XrSpatialEntityIdEXT of the parent for a spatial entity. The corresponding list structure is [code]XrSpatialComponentParentListEXT[/code]; the corresponding data structure is [code]XrSpatialEntityIdEXT[/code].
  251. </constant>
  252. <constant name="COMPONENT_TYPE_MESH_3D" value="4" enum="ComponentType">
  253. Component that provides a 3D mesh for a spatial entity. The corresponding list structure is [code]XrSpatialComponentMesh3DListEXT[/code]; the corresponding data structure is [code]XrSpatialMeshDataEXT[/code].
  254. </constant>
  255. <constant name="COMPONENT_TYPE_PLANE_ALIGNMENT" value="1000741000" enum="ComponentType">
  256. Component that provides the plane alignment enum for a spatial entity. The corresponding list structure is [code]XrSpatialComponentPlaneAlignmentListEXT[/code]; the corresponding data structure is [code]XrSpatialPlaneAlignmentEXT[/code] (Added by the [code]XR_EXT_spatial_plane_tracking[/code] extension).
  257. </constant>
  258. <constant name="COMPONENT_TYPE_MESH_2D" value="1000741001" enum="ComponentType">
  259. Component that provides a 2D mesh for a spatial entity. The corresponding list structure is [code]XrSpatialComponentMesh2DListEXT[/code]; the corresponding data structure is [code]XrSpatialMeshDataEXT[/code] (Added by the [code]XR_EXT_spatial_plane_tracking[/code] extension).
  260. </constant>
  261. <constant name="COMPONENT_TYPE_POLYGON_2D" value="1000741002" enum="ComponentType">
  262. Component that provides a 2D boundary polygon for a spatial entity. The corresponding list structure is [code]XrSpatialComponentPolygon2DListEXT[/code]; the corresponding data structure is [code]XrSpatialPolygon2DDataEXT[/code] (Added by the [code]XR_EXT_spatial_plane_tracking[/code] extension).
  263. </constant>
  264. <constant name="COMPONENT_TYPE_PLANE_SEMANTIC_LABEL" value="1000741003" enum="ComponentType">
  265. Component that provides a semantic label for a plane. The corresponding list structure is [code]XrSpatialComponentPlaneSemanticLabelListEXT[/code]; the corresponding data structure is [code]XrSpatialPlaneSemanticLabelEXT[/code] (Added by the [code]XR_EXT_spatial_plane_tracking[/code] extension).
  266. </constant>
  267. <constant name="COMPONENT_TYPE_MARKER" value="1000743000" enum="ComponentType">
  268. A component describing the marker type, ID and location. The corresponding list structure is [code]XrSpatialComponentMarkerListEXT[/code]; the corresponding data structure is [code]XrSpatialMarkerDataEXT[/code] (Added by the [code]XR_EXT_spatial_marker_tracking[/code] extension).
  269. </constant>
  270. <constant name="COMPONENT_TYPE_ANCHOR" value="1000762000" enum="ComponentType">
  271. Component that provides the location for an anchor. The corresponding list structure is [code]XrSpatialComponentAnchorListEXT[/code]; the corresponding data structure is [code]XrPosef[/code] (Added by the [code]XR_EXT_spatial_anchor[/code] extension).
  272. </constant>
  273. <constant name="COMPONENT_TYPE_PERSISTENCE" value="1000763000" enum="ComponentType">
  274. Component that provides the persisted UUID for a spatial entity. The corresponding list structure is [code]XrSpatialComponentPersistenceListEXT; the corresponding data structure is [code]XrSpatialPersistenceDataEXT[/code] (Added by the [code]XR_EXT_spatial_persistence[/code] extension).
  275. </constant>
  276. </constants>
  277. </class>