WebXR Lighting Estimation API: Difference between revisions

From WebXR Wiki
Jump to navigation Jump to search
(Add boilerplate information)
(Add short summary and WebIDL)
 
Line 7: Line 7:
  |group = WG
  |group = WG
}}
}}
The WebXR Lighting Estimation API enables support for exposing estimates of environmental lighting conditions to WebXR sessions.
==WebIDL==
<syntaxhighlight lang="idl>
[SecureContext, Exposed=Window]
interface XRLightProbe : EventTarget {
  readonly attribute XRSpace probeSpace;
  attribute EventHandler onreflectionchange;
};
enum XRReflectionFormat {
  "srgba8",
  "rgba16f",
};
[SecureContext, Exposed=Window]
interface XRLightEstimate {
  readonly attribute Float32Array sphericalHarmonicsCoefficients;
  readonly attribute DOMPointReadOnly primaryLightDirection;
  readonly attribute DOMPointReadOnly primaryLightIntensity;
};
dictionary XRLightProbeInit {
  XRReflectionFormat reflectionFormat = "srgba8";
};
partial interface XRSession {
  Promise<XRLightProbe> requestLightProbe(optional XRLightProbeInit options = {});
  readonly attribute XRReflectionFormat preferredReflectionFormat;
};
partial interface XRFrame {
  XRLightEstimate? getLightEstimate(XRLightProbe lightProbe);
};
partial interface XRWebGLBinding {
  WebGLTexture? getReflectionCubeMap(XRLightProbe lightProbe);
};
</syntaxhighlight>


== External Links ==
== External Links ==

Latest revision as of 00:38, 1 March 2023

WebXR Lighting Estimation API
StatusWD
Last Updated3 June 2022
Editor(s)Brandon Jones
Former Editor(s)Kearwood Gilbert
CG or WG?WG

The WebXR Lighting Estimation API enables support for exposing estimates of environmental lighting conditions to WebXR sessions.

WebIDL[edit]

[SecureContext, Exposed=Window]
interface XRLightProbe : EventTarget {
  readonly attribute XRSpace probeSpace;
  attribute EventHandler onreflectionchange;
};

enum XRReflectionFormat {
  "srgba8",
  "rgba16f",
};

[SecureContext, Exposed=Window]
interface XRLightEstimate {
  readonly attribute Float32Array sphericalHarmonicsCoefficients;
  readonly attribute DOMPointReadOnly primaryLightDirection;
  readonly attribute DOMPointReadOnly primaryLightIntensity;
};

dictionary XRLightProbeInit {
  XRReflectionFormat reflectionFormat = "srgba8";
};

partial interface XRSession {
  Promise<XRLightProbe> requestLightProbe(optional XRLightProbeInit options = {});
  readonly attribute XRReflectionFormat preferredReflectionFormat;
};

partial interface XRFrame {
  XRLightEstimate? getLightEstimate(XRLightProbe lightProbe);
};

partial interface XRWebGLBinding {
  WebGLTexture? getReflectionCubeMap(XRLightProbe lightProbe);
};

External Links[edit]