XRLightProbe.onreflectionchange

The onreflectionchange property of the XRLightProbe interface is and event handler for the reflectionchange event.

Value

A function to be invoked whenever the XRLightProbe receives a reflectionchange event.

Examples

Whenever the reflectionchange event fires on a light probe, you can retrieve an updated cube map by calling XRWebGLBinding.getReflectionCubeMap(). This is less expensive than retrieving lighting information with every XRFrame.

const glBinding = new XRWebGLBinding(xrSession, gl);

lightProbe.onreflectionchange = event => {
  glCubeMap = glBinding.getReflectionCubeMap(lightProbe);
});

See the reflectionchange event page for an example using addEventListener().

Specifications

Specification
WebXR Lighting Estimation API Level 1 (WebXR Lighting Estimation API 1)
# dom-xrlightprobe-onreflectionchange

Browser compatibility

BCD tables only load in the browser

See also