Table of Contents

Class XRCompositionLayer

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll
NOTE
Experimental
The XRCompositionLayer interface of the WebXR Device API is a base class that defines a set of common properties and behaviors for WebXR layer types. It is not constructable on its own.
[Value("XRCompositionLayer")]
public class XRCompositionLayer : XRLayer
Inheritance
XRCompositionLayer
Derived
Inherited Members

Remarks

Several layer types inherit from XRCompositionLayer:

XRCompositionLayer itself inherits from the general XRLayer class (which inherits from EventTarget).

-XRLayer
-EventTarget
-XREquirectLayer
-XRCubeLayer
-XRCylinderLayer
-XRProjectionLayer
-XRQuadLayer

See also on MDN

Constructors

XRCompositionLayer()

public XRCompositionLayer()

Properties

BlendTextureSourceAlpha

NOTE
Experimental
The blendTextureSourceAlpha property of the XRCompositionLayer interface is a boolean enabling the layer's texture {{Glossary("Alpha", "alpha channel")}}.
[Value("blendTextureSourceAlpha")]
public bool BlendTextureSourceAlpha { get; set; }

Property Value

bool

A boolean. true enables the alpha channel, false disables it.

Remarks

ForceMonoPresentation

[Value("forceMonoPresentation")]
public bool ForceMonoPresentation { get; set; }

Property Value

bool

Layout

NOTE
Experimental
The read-only layout property of the XRCompositionLayer interface is the layout type of the layer.
[Value("layout")]
public XRLayerLayout Layout { get; }

Property Value

XRLayerLayout

A string. Possible values:

Remarks

MipLevels

NOTE
Experimental
The read-only mipLevels property of the XRCompositionLayer interface is a layer's number of mip levels in the color and texture data. See also Mipmap on Wikipedia.
[Value("mipLevels")]
public ulong MipLevels { get; }

Property Value

ulong

A number equal or smaller to the requested mip levels when a layer has been created.

Remarks

The desired number of mip levels can be specified when creating layers. However, if the user agent can't create the requested number, it can create less. Use mipLevels to determine the actual number of mip levels for a layer.

The viewPixelWidth and viewPixelHeight need to be powers of two as they get successively halved at each mip level.

-Mipmap on Wikipedia

See also on MDN

NeedsRedraw

NOTE
Experimental
The read-only needsRedraw property of the XRCompositionLayer interface is a boolean signaling that the layer should be re-rendered in the next frame.
[Value("needsRedraw")]
public bool NeedsRedraw { get; }

Property Value

bool

A boolean. true indicates a rerendering is needed in the next frame, false indicates no re-rendering is needed.

Remarks

The need for redrawing can occur when the underlying resources of a layer are lost due to textures that might have been freed by the compositor under the hood. This might happen when the device falls asleep or when the browser switches context (to an operating system dialog or similar) and then comes back.

Redrawing is not a problem for layers which are updated with every frame. However, for layers updated infrequently, or for static layers (where you can only draw once after creation or after a redraw event), the layer's content might be lost and need to be redrawn. If the layer's resources are lost, the needsRedraw property will be true and a redraw event is fired on the layer.

-XREquirectLayer: XREquirectLayer.Redraw event
-XRCubeLayer: XRCubeLayer.Redraw event
-XRCylinderLayer: XRCylinderLayer.Redraw event
-XRQuadLayer: XRQuadLayer.Redraw event

See also on MDN

Opacity

[Value("opacity")]
public Number Opacity { get; set; }

Property Value

Number

Quality

[Value("quality")]
public XRLayerQuality Quality { get; set; }

Property Value

XRLayerQuality

Methods

Destroy()

NOTE
Experimental
The destroy() method of the XRCompositionLayer interface deletes the references to the underlying graphics library for the layer. It also sets the color textures and depth stencil texture arrays to an empty array.
[Value("destroy")]
public GlobalObject.Undefined Destroy()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks