summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/vr/vr_display.idl
blob: 207643036bae17bd6fa574012ebb83b0eec0b58f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// 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,
    RuntimeEnabled=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 requestPresent(sequence<VRLayerInit> layers);

    // Stops presenting to the VRDisplay.
    [CallWith=ScriptState] Promise 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();
};