WebXRManager.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <!DOCTYPE html>
  2. <html lang="zh">
  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 internally used by [page:WebGLRenderer].
  13. [name] also provides a public interface that allows users to enable/disable XR and perform XR related tasks like
  14. for instance retrieving controllers.
  15. </p>
  16. <h2>Properties</h2>
  17. <h3>[property:Boolean enabled]</h3>
  18. <p>
  19. This flag notifies the renderer to be ready for XR rendering. Default is *false*. Set it to *true* if you are going
  20. to use XR in your app.
  21. </p>
  22. <h3>[property:Boolean isPresenting]</h3>
  23. <p>
  24. Whether XR presentation is active or not. Default is *false*. This flag is read-only and automatically set by [name].
  25. </p>
  26. <h2>Methods</h2>
  27. <h3>[method:ArrayCamera getCamera]( [param:PerspectiveCamera camera] )</h3>
  28. <p>
  29. Returns an instance of [page:ArrayCamera] which represents the XR camera of the active XR session.
  30. For each view it holds a separate camera object in its [page:ArrayCamera.cameras cameras] property.
  31. The method requires the non-XR camera of the scene as a parameter.
  32. </p>
  33. <h3>[method:Group getController]( [param:Integer index] )</h3>
  34. <p>
  35. [page:Integer index] — The index of the controller. <br /><br />
  36. Returns a [page:Group] representing the so called *target ray* space of the XR controller.
  37. Use this space for visualizing 3D objects that support the user in pointing tasks like UI interaction.
  38. </p>
  39. <h3>[method:Group getControllerGrip]( [param:Integer index] )</h3>
  40. <p>
  41. [page:Integer index] — The index of the controller. <br /><br />
  42. Returns a [page:Group] representing the so called *grip* space of the XR controller.
  43. Use this space if the user is going to hold other 3D objects like a lightsaber.
  44. </p>
  45. <p>
  46. Note: If you want to show something in the user's hand AND offer a pointing ray at the same time, you'll want to attached the handheld object to the
  47. group returned by [page:.getControllerGrip]() and the ray to the group returned by [page:.getController](). The idea is to have two different groups
  48. in two different coordinate spaces for the same WebXR controller.
  49. </p>
  50. <h3>[method:Group getHand]( [param:Integer index] )</h3>
  51. <p>
  52. [page:Integer index] — The index of the controller. <br /><br />
  53. Returns a [page:Group] representing the so called *hand* or *joint* space of the XR controller.
  54. Use this space for visualizing the user's hands when no physical controllers are used.
  55. </p>
  56. <h3>[method:String getReferenceSpace]()</h3>
  57. <p>
  58. Returns the reference space.
  59. </p>
  60. <h3>[method:XRSession getSession]()</h3>
  61. <p>
  62. Returns the *XRSession* object which allows a more fine-grained management of active WebXR sessions on application level.
  63. </p>
  64. <h3>[method:void setFramebufferScaleFactor]( [param:Float framebufferScaleFactor] )</h3>
  65. <p>
  66. [page:Float framebufferScaleFactor] — The framebuffer scale factor to set.<br /><br />
  67. Specifies the scaling factor to use when determining the size of the framebuffer when rendering to a XR device.
  68. The value is relative to the default XR device display resolution. Default is *1*. A value of *0.5* would specify
  69. a framebuffer with 50% of the display's native resolution.
  70. </p>
  71. <p>
  72. Note: It is not possible to change the framebuffer scale factor while presenting XR content.
  73. </p>
  74. <h3>[method:void setReferenceSpaceType]( [param:String referenceSpaceType] )</h3>
  75. <p>
  76. [page:String referenceSpaceType] — The reference space type to set.<br /><br />
  77. Can be used to configure a spatial relationship with the user's physical environment. Depending on how the user moves in 3D space, setting an
  78. appropriate reference space can improve tracking. Default is *local-floor*.
  79. Please check out the [link:https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceType MDN] for possible values and their use cases.
  80. </p>
  81. <p>
  82. Note: It is not possible to change the reference space type while presenting XR content.
  83. </p>
  84. <h2>Source</h2>
  85. <p>
  86. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  87. </p>
  88. </body>
  89. </html>