| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // https://immersive-web.github.io/webxr/#xrsession-interface |
| |
| enum XRSessionMode { |
| "inline", |
| "immersive-vr", |
| "immersive-ar", |
| }; |
| |
| enum XREnvironmentBlendMode { |
| "opaque", |
| "additive", |
| "alpha-blend", |
| }; |
| |
| enum XRVisibilityState { |
| "visible", |
| "visible-blurred", |
| "hidden", |
| }; |
| |
| enum XRInteractionMode { |
| "screen-space", |
| "world-space" |
| }; |
| |
| enum XRImageTrackingScore { |
| "untrackable", |
| "trackable", |
| }; |
| |
| enum XRReflectionFormat { |
| "srgba8", |
| "rgba16f", |
| }; |
| |
| [ |
| ActiveScriptWrappable, |
| SecureContext, |
| Exposed=Window, |
| RuntimeEnabled=WebXR |
| ] interface XRSession : EventTarget { |
| [RuntimeEnabled=WebXRARModule] readonly attribute XREnvironmentBlendMode environmentBlendMode; |
| [RuntimeEnabled=WebXRARModule] readonly attribute XRInteractionMode interactionMode; |
| readonly attribute XRVisibilityState visibilityState; |
| [SameObject] readonly attribute XRRenderState renderState; |
| [CallWith=ScriptState, MeasureAs=XRSessionGetInputSources, SameObject] readonly attribute XRInputSourceArray inputSources; |
| [SameObject] readonly attribute XRDOMOverlayState domOverlayState; |
| [RuntimeEnabled=WebXRLightEstimation] readonly attribute XRReflectionFormat preferredReflectionFormat; |
| |
| attribute EventHandler onend; |
| attribute EventHandler onselect; |
| attribute EventHandler oninputsourceschange; |
| attribute EventHandler onselectstart; |
| attribute EventHandler onselectend; |
| attribute EventHandler onvisibilitychange; |
| attribute EventHandler onsqueeze; |
| attribute EventHandler onsqueezestart; |
| attribute EventHandler onsqueezeend; |
| |
| [RaisesException] void updateRenderState(optional XRRenderStateInit init = {}); |
| |
| [CallWith=ScriptState, RaisesException] Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type); |
| |
| long requestAnimationFrame(XRFrameRequestCallback callback); |
| void cancelAnimationFrame(long handle); |
| |
| [CallWith=ScriptState, Measure, RaisesException] Promise<void> end(); |
| |
| // https://github.com/immersive-web/hit-test/blob/master/hit-testing-explainer.md |
| [RuntimeEnabled=WebXRHitTest, CallWith=ScriptState, MeasureAs=XRSessionRequestHitTestSource, RaisesException] |
| Promise<XRHitTestSource> requestHitTestSource(XRHitTestOptionsInit options); |
| [RuntimeEnabled=WebXRHitTest, CallWith=ScriptState, MeasureAs=XRSessionRequestHitTestSourceForTransientInput, RaisesException] |
| Promise<XRTransientInputHitTestSource> requestHitTestSourceForTransientInput(XRTransientInputHitTestOptionsInit options); |
| |
| [RuntimeEnabled=WebXRLightEstimation, CallWith=ScriptState, MeasureAs=XRSessionRequestLightProbe, RaisesException] |
| Promise<XRLightProbe> requestLightProbe(optional XRLightProbeInit options = {}); |
| |
| [RuntimeEnabled=WebXRImageTracking, CallWith=ScriptState, RaisesException] |
| Promise<FrozenArray<XRImageTrackingScore>> getTrackedImageScores(); |
| |
| [RuntimeEnabled=WebXRDepth, RaisesException] |
| readonly attribute XRDepthUsage? depthUsage; |
| [RuntimeEnabled=WebXRDepth, RaisesException] |
| readonly attribute XRDepthDataFormat? depthDataFormat; |
| }; |