WebXRManager.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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:ArrayCamera getCamera]()</h3>
  35. <p>
  36. Returns an instance of [page:ArrayCamera] which represents the XR camera
  37. of the active XR session. For each view it holds a separate camera object
  38. in its [page:ArrayCamera.cameras cameras] property.
  39. </p>
  40. <p>
  41. The camera's `fov` is currently not used and does not reflect the fov of
  42. the XR camera. If you need the fov on app level, you have to compute in
  43. manually from the XR camera's projection matrices.
  44. </p>
  45. <h3>[method:Group getController]( [param:Integer index] )</h3>
  46. <p>
  47. [page:Integer index] — The index of the controller. <br /><br />
  48. Returns a [page:Group] representing the so called *target ray* space of
  49. the XR controller. Use this space for visualizing 3D objects that support
  50. the user in pointing tasks like UI interaction.
  51. </p>
  52. <h3>[method:Group getControllerGrip]( [param:Integer index] )</h3>
  53. <p>
  54. [page:Integer index] — The index of the controller. <br /><br />
  55. Returns a [page:Group] representing the so called `grip` space of the XR
  56. controller. Use this space if the user is going to hold other 3D objects
  57. like a lightsaber.
  58. </p>
  59. <p>
  60. Note: If you want to show something in the user's hand AND offer a
  61. pointing ray at the same time, you'll want to attached the handheld object
  62. to the group returned by [page:.getControllerGrip]() and the ray to the
  63. group returned by [page:.getController](). The idea is to have two
  64. different groups in two different coordinate spaces for the same WebXR
  65. controller.
  66. </p>
  67. <h3>[method:Float getFoveation]()</h3>
  68. <p>
  69. Returns the amount of foveation used by the XR compositor for the
  70. projection layer.
  71. </p>
  72. <h3>[method:Group getHand]( [param:Integer index] )</h3>
  73. <p>
  74. [page:Integer index] — The index of the controller. <br /><br />
  75. Returns a [page:Group] representing the so called `hand` or `joint` space
  76. of the XR controller. Use this space for visualizing the user's hands when
  77. no physical controllers are used.
  78. </p>
  79. <h3>[method:String getReferenceSpace]()</h3>
  80. <p>Returns the reference space.</p>
  81. <h3>[method:XRSession getSession]()</h3>
  82. <p>
  83. Returns the `XRSession` object which allows a more fine-grained management
  84. of active WebXR sessions on application level.
  85. </p>
  86. <h3>[method:undefined setFoveation]( [param:Float foveation] )</h3>
  87. <p>
  88. [page:Float foveation] — The foveation to set.<br /><br />
  89. Specifies the amount of foveation used by the XR compositor for the layer.
  90. Must be a value between `0` and `1`.
  91. </p>
  92. <h3>
  93. [method:undefined setFramebufferScaleFactor]( [param:Float framebufferScaleFactor] )
  94. </h3>
  95. <p>
  96. [page:Float framebufferScaleFactor] — The framebuffer scale factor to
  97. set.<br /><br />
  98. Specifies the scaling factor to use when determining the size of the
  99. framebuffer when rendering to a XR device. The value is relative to the
  100. default XR device display resolution. Default is `1`. A value of `0.5`
  101. would specify a framebuffer with 50% of the display's native resolution.
  102. </p>
  103. <p>
  104. Note: It is not possible to change the framebuffer scale factor while
  105. presenting XR content.
  106. </p>
  107. <h3>
  108. [method:undefined setReferenceSpace]( [param:XRReferenceSpace referenceSpace] )
  109. </h3>
  110. <p>
  111. [page:XRReferenceSpace referenceSpace] — A custom reference space.<br /><br />
  112. Can be used to configure a custom reference space which overwrites the
  113. default reference space.
  114. </p>
  115. <h3>
  116. [method:undefined setReferenceSpaceType]( [param:String referenceSpaceType] )
  117. </h3>
  118. <p>
  119. [page:String referenceSpaceType] — The reference space type to set.<br /><br />
  120. Can be used to configure a spatial relationship with the user's physical
  121. environment. Depending on how the user moves in 3D space, setting an
  122. appropriate reference space can improve tracking. Default is
  123. `local-floor`. Please check out the
  124. [link:https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceType MDN]
  125. for possible values and their use cases.
  126. </p>
  127. <h3>[method:undefined updateCamera]( [param:PerspectiveCamera camera] )</h3>
  128. <p>
  129. Updates the state of the XR camera. Use this method on app level if you
  130. set [page:.cameraAutoUpdate] to `false`. The method requires the non-XR
  131. camera of the scene as a parameter. The passed in camera's transformation
  132. is automatically adjusted to the position of the XR camera when calling
  133. this method.
  134. </p>
  135. <p>
  136. Note: It is not possible to change the reference space type while
  137. presenting XR content.
  138. </p>
  139. <h2>Source</h2>
  140. <p>
  141. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  142. </p>
  143. </body>
  144. </html>