Capítulo 794 de 859
The XR manager is built on top of the WebXR Device API to manage XR sessions with renderer backends.
Constructor
| Signature |
|---|
new XRManager( renderer : Renderer, multiview : boolean ) |
Properties
| Property | Description |
|---|---|
.cameraAutoUpdate : boolean | Whether the XR camera should automatically be updated or not. |
.enabled : boolean | This flag globally enables XR rendering. |
.isPresenting : boolean (readonly) | Whether the XR device is currently presenting or not. |
Methods
| Method | Description |
|---|---|
.createCylinderLayer( radius : number, centralAngle : number, aspectratio : number, translation : Vector3, quaternion : Quaternion, pixelwidth : number, pixelheight : number, rendercall : function, attributes : Object ) : Mesh | This method can be used in XR applications to create a cylindrical layer that presents a separate rendered scene. |
.createQuadLayer( width : number, height : number, translation : Vector3, quaternion : Quaternion, pixelwidth : number, pixelheight : number, rendercall : function, attributes : Object ) : Mesh | This method can be used in XR applications to create a quadratic layer that presents a separate rendered scene. |
.foveateBoundTexture( renderTarget : RenderTarget ) | Applies WebXR fixed foveation to the internal post-processing render target used by the first XR render pass before compositing into a projection layer. |
| `.getBaseLayer() : XRWebGLLayer | XRProjectionLayer` |
.getBinding() : XRWebGLBinding | Returns the current XR binding. |
.getCamera() : ArrayCamera | Returns the XR camera. |
.getController( index : number ) : Group | Returns an instance of THREE.Group that represents the transformation of a XR controller in target ray space. The requested controller is defined by the given index. |
.getControllerGrip( index : number ) : Group | Returns an instance of THREE.Group that represents the transformation of a XR controller in grip space. The requested controller is defined by the given index. |
| `.getEnvironmentBlendMode() : 'opaque' | 'additive' |
| `.getFoveation() : number | undefined` |
.getFrame() : XRFrame | Returns the current XR frame. |
.getFramebufferScaleFactor() : number | Returns the framebuffer scale factor. |
.getHand( index : number ) : Group | Returns an instance of THREE.Group that represents the transformation of a XR controller in hand space. The requested controller is defined by the given index. |
.getReferenceSpace() : XRReferenceSpace | Returns the XR reference space. |
.getReferenceSpaceType() : XRReferenceSpaceType | Returns the reference space type. |
.getSession() : XRSession | Returns the current XR session. |
.getWebGPUBinding() : XRGPUBinding | Returns the current XR WebGPU binding. |
.renderLayers() | Renders the XR layers that have been previously added to the scene. |
.setFoveation( foveation : number ) | Sets the foveation value. |
.setFramebufferScaleFactor( factor : number ) | Sets the framebuffer scale factor. |
.setReferenceSpace( space : XRReferenceSpace ) | Sets a custom XR reference space. |
.setReferenceSpaceType( type : XRReferenceSpaceType ) | Sets the reference space type. |
.setSession( session : XRSession ) : Promise (async) | After a XR session has been requested usually with one of the *Button modules, it is injected into the renderer with this method. This method triggers the start of the actual XR rendering. |
.updateCamera( camera : PerspectiveCamera ) | This method is called by the renderer per frame and updates the XR camera and it sub cameras based on the given camera. The given camera is the "user" camera created on application level and used for… |
.useMultiview() : boolean | Returns true if the engine renders to a multiview target. |