API

Class WebXRLayers

Exposes the WebXR Layers API.

Hierarchy (View Summary)

Index
dependsOn?: string[]

The dependencies of this feature, if any

disableAutoAttach: boolean = false

Should auto-attach be disabled?

isDisposed: boolean = false

Is this feature disposed?

onFeatureAttachObservable: Observable<IWebXRFeature> = ...

Observers registered here will be executed when the feature is attached

onFeatureDetachObservable: Observable<IWebXRFeature> = ...

Observers registered here will be executed when the feature is detached

Name: "xr-layers" = WebXRFeatureName.LAYERS

The module's name

Version: 1

The (Babylon) version of this module. This is an integer representing the implementation version. This number does not correspond to the WebXR specs version

  • Experimental

    This will support full screen ADT when used with WebXR Layers. This API might change in the future. Note that no interaction will be available with the ADT when using this method

    Parameters

    • texture: DynamicTexture

      the texture to display in the layer

    • options: { distanceFromHeadset: number } = ...

      optional parameters for the layer

    Returns Nullable<WebXRCompositionLayerWrapper<XRCompositionLayer, WebXRLayerType>>

    a composition layer containing the texture, or null when WebGPU quad layers are unavailable

  • Add a new layer to the already-existing list of layers

    Parameters

    • wrappedLayer: WebXRLayerWrapper<WebXRSupportedLayerType>

      the new layer to add to the existing ones

    Returns void

  • Creates a new XRProjectionLayer.

    Parameters

    • params: XRProjectionLayerInit = DefaultXRProjectionLayerInit

      an object providing configuration options for the new XRProjectionLayer.

    • multiview: boolean = ...

      whether the projection layer should render with multiview. Will be tru automatically if the extension initialized with multiview.

    Returns WebXRProjectionLayerWrapper

    the projection layer

  • Creates a new XRWebGLLayer.

    Parameters

    • params: XRWebGLLayerInit = DefaultXRWebGLLayerInit

      an object providing configuration options for the new XRWebGLLayer

    Returns WebXRWebGLLayerWrapper

    the XRWebGLLayer

  • Checks whether the active runtime exposes the factory needed for a layer type. This is a capability check only; creation can still fail when an initialization dictionary is invalid.

    Parameters

    • layerType: any

      the concrete WebXR layer type

    • source: WebXRLayerSource = "graphics"

      whether to check a graphics-backed or media-backed layer

    Returns boolean

    whether the requested factory is available

  • Removes a non-projection layer from the current XR session.

    Parameters

    • wrappedLayer: WebXRLayerWrapper<WebXRSupportedLayerType>

      the layer wrapper to remove

    • dispose: boolean = true

      whether to dispose the wrapper and destroy its native composition layer

    Returns boolean

    whether the layer was present and removed

  • Sets the layers to be used by the XR session. Note that you must call this function with any layers you wish to render to since it adds them to the XR session's render state (replacing any layers that were added in a previous call to setXRSessionLayers or updateRenderState). This method also sets up the session manager's render target texture provider as the first layer in the array, which feeds the WebXR camera(s) attached to the session.

    Parameters

    • wrappedLayers: WebXRLayerWrapper<WebXRSupportedLayerType>[] = ...

      An array of WebXRLayerWrapper, usually returned from the WebXRLayers createLayer functions.

    Returns void