// Copyright 2017 The Chromium Authors
// 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/#xrframe
[
SecureContext,
Exposed=Window,
RuntimeEnabled=WebXR
] interface XRFrame {
[SameObject] readonly attribute XRSession session;
[RuntimeEnabled=WebXR]
readonly attribute XRAnchorSet trackedAnchors;
[RuntimeEnabled=WebXR, CallWith=ScriptState, RaisesException, MeasureAs=XRFrameCreateAnchor]
Promise<XRAnchor> createAnchor(XRRigidTransform initial_pose, XRSpace space);
[RaisesException] XRViewerPose? getViewerPose(XRReferenceSpace referenceSpace);
[RaisesException] XRPose? getPose(XRSpace space, XRSpace relativeTo);
[RuntimeEnabled=WebXR, RaisesException]
FrozenArray<XRHitTestResult> getHitTestResults(XRHitTestSource hitTestSource);
[RuntimeEnabled=WebXR, RaisesException]
FrozenArray<XRTransientInputHitTestResult> getHitTestResultsForTransientInput(XRTransientInputHitTestSource hitTestSource);
[RuntimeEnabled=WebXR, RaisesException, MeasureAs=XRFrameGetLightEstimate]
XRLightEstimate? getLightEstimate(XRLightProbe lightProbe);
[RuntimeEnabled=WebXR, RaisesException, MeasureAs=XRFrameGetDepthInformation]
XRCPUDepthInformation? getDepthInformation(XRView view);
[RuntimeEnabled=WebXRImageTracking, RaisesException, MeasureAs=XRFrameGetImageTrackingResults]
FrozenArray<XRImageTrackingResult> getImageTrackingResults();
[RuntimeEnabled=WebXRHandInput, RaisesException, MeasureAs=XRFrameGetJointPose]
XRJointPose? getJointPose(XRJointSpace joint, XRSpace baseSpace);
[RuntimeEnabled=WebXRHandInput, RaisesException, MeasureAs=XRFrameFillJointRadii]
boolean fillJointRadii(sequence<XRJointSpace> jointSpaces, Float32Array radii);
[RuntimeEnabled=WebXRHandInput, RaisesException, MeasureAs=XRFrameFillPoses]
boolean fillPoses(sequence<XRSpace> spaces, XRSpace baseSpace, Float32Array transforms);
// More details about the real-world understanding APIs can be found here:
// https://github.com/immersive-web/real-world-geometry/blob/master/plane-detection-explainer.md
[RuntimeEnabled=WebXRPlaneDetection, RaisesException, MeasureAs=XRFrameDetectedPlanes]
readonly attribute XRPlaneSet? detectedPlanes;
};