blob: 5f8be46c46c1ee4b2c341e9ebba15661df237182 [file] [log] [blame]
// Copyright 2016 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.
enum VREye {
"left",
"right"
};
// https://w3c.github.io/webvr/#interface-vrdisplay
[
ActiveScriptWrappable,
OriginTrialEnabled=WebVR
] interface VRDisplay : EventTarget {
// An identifier for this device unique across VRDisplays.
readonly attribute unsigned long displayId;
// A user-readable name identifying the device.
[MeasureAs=VRDisplayDisplayName] readonly attribute DOMString displayName;
readonly attribute boolean isPresenting;
// [Constant]?
readonly attribute VRDisplayCapabilities capabilities;
readonly attribute VRStageParameters stageParameters;
[MeasureAs=VRDisplayGetFrameData] boolean getFrameData(VRFrameData frameData);
attribute double depthNear;
attribute double depthFar;
VREyeParameters getEyeParameters(VREye whichEye);
long requestAnimationFrame(FrameRequestCallback callback);
void cancelAnimationFrame(long handle);
// Begin presenting to the VRDisplay. Must be called in response to a user
// gesture. Repeat calls while already presenting will update the layer
// being displayed.
[CallWith=ScriptState] Promise<void> requestPresent(sequence<VRLayerInit> layers);
// Stops presenting to the VRDisplay.
[CallWith=ScriptState] Promise<void> exitPresent();
// Get the sources currently being presented.
sequence<VRLayerInit> getLayers();
// The layer provided to the `VRDisplay` will be captured and presented
// in the HMD. Calling this function has the same effect on the source
// canvas as any other operation that uses its source image, and canvases
// created without preserveDrawingBuffer set to true will be cleared.
void submitFrame();
};