WebXRManager.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <p class="desc">
  12. This class represents an abstraction of the WebXR Device API and is
  13. internally used by [page:WebGLRenderer]. [name] also provides a public
  14. interface that allows users to enable/disable XR and perform XR related
  15. tasks like for instance retrieving controllers.
  16. </p>
  17. <h2>Properties</h2>
  18. <h3>[property:Boolean cameraAutoUpdate]</h3>
  19. <p>
  20. Whether the manager's XR camera should be automatically updated or not.
  21. Default is `true`.
  22. </p>
  23. <h3>[property:Boolean enabled]</h3>
  24. <p>
  25. This flag notifies the renderer to be ready for XR rendering. Default is
  26. `false`. Set it to `true` if you are going to use XR in your app.
  27. </p>
  28. <h3>[property:Boolean isPresenting]</h3>
  29. <p>
  30. Whether XR presentation is active or not. Default is `false`. This flag is
  31. read-only and automatically set by [name].
  32. </p>
  33. <h2>Methods</h2>
  34. <h3>[method:XRWebGLLayer getBaseLayer]()</h3>
  35. <p>
  36. Returns the current base layer. This is an
  37. [link:https://developer.mozilla.org/en-US/docs/Web/API/XRProjectionLayer XRProjectionLayer]
  38. when the targeted XR device supports the
  39. [link:https://www.w3.org/TR/webxrlayers-1/ WebXR Layers API], or an
  40. [link:https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLLayer XRWebGLLayer]
  41. if it doesn't.
  42. </p>
  43. <h3>[method:XRWebGLBinding getBinding]()</h3>
  44. <p>
  45. Returns the current
  46. [link:https://developer.mozilla.org/en-US/docs/Web/API/XRWebGLBinding XRWebGLBinding].<br /><br />
  47. This method will create a new `XRWebGLBinding` if the browser is able to and one hasn't been created yet.
  48. </p>
  49. <h3>[method:ArrayCamera getCamera]()</h3>
  50. <p>
  51. Returns an instance of [page:ArrayCamera] which represents the XR camera
  52. of the active XR session. For each view it holds a separate camera object
  53. in its [page:ArrayCamera.cameras cameras] property.
  54. </p>
  55. <p>
  56. The camera's `fov` is currently not used and does not reflect the fov of
  57. the XR camera. If you need the fov on app level, you have to compute in
  58. manually from the XR camera's projection matrices.
  59. </p>
  60. <h3>[method:Texture getCameraTexture]( [param:XRCamera xrCamera] )</h3>
  61. <p>
  62. [page:XRCamera xrCamera] — The
  63. [link:https://immersive-web.github.io/raw-camera-access/#xr-camera-section XRCamera]
  64. to query.<br /><br />
  65. Returns an opaque texture from the queried `XRCamera`.
  66. Only available during the current animation loop.<br /><br />
  67. See the [example:webxr_ar_camera_access webxr / ar / camera_access] example.
  68. </p>
  69. <h3>[method:Group getController]( [param:Integer index] )</h3>
  70. <p>
  71. [page:Integer index] — The index of the controller. <br /><br />
  72. Returns a [page:Group] representing the so called *target ray* space of
  73. the XR controller. Use this space for visualizing 3D objects that support
  74. the user in pointing tasks like UI interaction.
  75. </p>
  76. <h3>[method:Group getControllerGrip]( [param:Integer index] )</h3>
  77. <p>
  78. [page:Integer index] — The index of the controller. <br /><br />
  79. Returns a [page:Group] representing the so called `grip` space of the XR
  80. controller. Use this space if the user is going to hold other 3D objects
  81. like a lightsaber.
  82. </p>
  83. <p>
  84. Note: If you want to show something in the user's hand AND offer a
  85. pointing ray at the same time, you'll want to attached the handheld object
  86. to the group returned by [page:.getControllerGrip]() and the ray to the
  87. group returned by [page:.getController](). The idea is to have two
  88. different groups in two different coordinate spaces for the same WebXR
  89. controller.
  90. </p>
  91. <h3>[method:Mesh getDepthSensingMesh]()</h3>
  92. <p>
  93. Returns a plane mesh that visualizes the depth sensing texture
  94. if one is available, and `null` otherwise.
  95. </p>
  96. <h3>[method:ExternalTexture getDepthTexture]()</h3>
  97. <p>
  98. Returns a texture representing the computed depth of the
  99. user's environment if available, and `null` otherwise.
  100. </p>
  101. <h3>[method:Float getFoveation]()</h3>
  102. <p>
  103. Returns the amount of foveation used by the XR compositor for the
  104. projection layer.
  105. </p>
  106. <h3>[method:XRFrame getFrame]()</h3>
  107. <p>
  108. Returns the current [link:https://developer.mozilla.org/en-US/docs/Web/API/XRFrame XRFrame].
  109. Will return `null` if used without an ongoing XR session.
  110. </p>
  111. <h3>[method:Group getHand]( [param:Integer index] )</h3>
  112. <p>
  113. [page:Integer index] — The index of the controller. <br /><br />
  114. Returns a [page:Group] representing the so called `hand` or `joint` space
  115. of the XR controller. Use this space for visualizing the user's hands when
  116. no physical controllers are used.
  117. </p>
  118. <h3>[method:String getReferenceSpace]()</h3>
  119. <p>Returns the reference space.</p>
  120. <h3>[method:XRSession getSession]()</h3>
  121. <p>
  122. Returns the `XRSession` object which allows a more fine-grained management
  123. of active WebXR sessions on application level.
  124. </p>
  125. <h3>[method:Boolean hasDepthSensing]()</h3>
  126. <p>
  127. Returns `true` if depth sensing data has been provided by the XR device.
  128. </p>
  129. <h3>[method:undefined setFoveation]( [param:Float foveation] )</h3>
  130. <p>
  131. [page:Float foveation] — The foveation to set.<br /><br />
  132. Specifies the amount of foveation used by the XR compositor for the layer.
  133. Must be a value between `0` and `1`.
  134. </p>
  135. <h3>
  136. [method:undefined setFramebufferScaleFactor]( [param:Float framebufferScaleFactor] )
  137. </h3>
  138. <p>
  139. [page:Float framebufferScaleFactor] — The framebuffer scale factor to
  140. set.<br /><br />
  141. Specifies the scaling factor to use when determining the size of the
  142. framebuffer when rendering to a XR device. The value is relative to the
  143. default XR device display resolution. Default is `1`. A value of `0.5`
  144. would specify a framebuffer with 50% of the display's native resolution.
  145. </p>
  146. <p>
  147. Note: It is not possible to change the framebuffer scale factor while
  148. presenting XR content.
  149. </p>
  150. <h3>
  151. [method:undefined setReferenceSpace]( [param:XRReferenceSpace referenceSpace] )
  152. </h3>
  153. <p>
  154. [page:XRReferenceSpace referenceSpace] — A custom reference space.<br /><br />
  155. Can be used to configure a custom reference space which overwrites the
  156. default reference space.
  157. </p>
  158. <h3>
  159. [method:undefined setReferenceSpaceType]( [param:String referenceSpaceType] )
  160. </h3>
  161. <p>
  162. [page:String referenceSpaceType] — The reference space type to set.<br /><br />
  163. Can be used to configure a spatial relationship with the user's physical
  164. environment. Depending on how the user moves in 3D space, setting an
  165. appropriate reference space can improve tracking. Default is
  166. `local-floor`. Please check out the
  167. [link:https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceType MDN]
  168. for possible values and their use cases.
  169. </p>
  170. <h3>[method:undefined updateCamera]( [param:PerspectiveCamera camera] )</h3>
  171. <p>
  172. Updates the state of the XR camera. Use this method on app level if you
  173. set [page:.cameraAutoUpdate] to `false`. The method requires the non-XR
  174. camera of the scene as a parameter. The passed in camera's transformation
  175. is automatically adjusted to the position of the XR camera when calling
  176. this method.
  177. </p>
  178. <p>
  179. Note: It is not possible to change the reference space type while
  180. presenting XR content.
  181. </p>
  182. <h2>Source</h2>
  183. <p>
  184. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  185. </p>
  186. </body>
  187. </html>
粤ICP备19079148号