Back to Content

XRCubeLayer

files/en-us/web/api/xrcubelayer/index.md

latest1.9 KB
Original Source

{{securecontext_header}}{{APIRef("WebXR Device API")}}{{SeeCompatTable}}

The XRCubeLayer interface of the WebXR Device API is a layer that renders directly from a cubemap and projects it onto the inside faces of a cube.

XRCubeLayer requires the layers feature to be enabled for the {{domxref("XRSession")}}. You can request it in {{domxref("XRSystem.requestSession()")}}.

To create a new XRCubeLayer, call {{domxref("XRWebGLBinding.createCubeLayer()")}}.

To present layers to the XR device, add them to the layers render state using {{domxref("XRSession.updateRenderState()")}}.

{{InheritanceDiagram}}

Instance properties

Inherits properties from its parent, {{domxref("XRCompositionLayer")}}.

  • {{domxref("XRCubeLayer.space")}} {{Experimental_Inline}}
    • : An {{domxref("XRSpace")}} representing the layer's spatial relationship with the user's physical environment.
  • {{domxref("XRCubeLayer.orientation")}} {{Experimental_Inline}}
    • : A {{domxref("DOMPointReadOnly")}} representing the orientation relative to the space property.

Instance methods

Inherits methods from its parents, {{domxref("XRCompositionLayer")}} and {{domxref("EventTarget")}}.

Events

  • {{domxref("XRCubeLayer.redraw_event", "redraw")}} {{Experimental_Inline}}
    • : Sent to the XRCubeLayer object when the underlying resources of the layer are lost or when the XR Compositor can no longer reproject the layer. If this event is sent, authors should redraw the content of the layer in the next XR animation frame.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("XRLayer")}}
  • {{domxref("EventTarget")}}
  • {{domxref("XRCompositionLayer")}}
  • {{domxref("XREquirectLayer")}}
  • {{domxref("XRQuadLayer")}}
  • {{domxref("XRCylinderLayer")}}
  • {{domxref("XRProjectionLayer")}}