forked from immersive-web/webxr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.idl
127 lines (92 loc) · 3.4 KB
/
index.idl
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
partial interface Navigator {
Promise<sequence<VRDisplay>> getVRDisplays();
readonly attribute sequence<VRDisplay> activeVRDisplays;
};
partial interface Window {
attribute EventHandler onvrdisplayconnected;
attribute EventHandler onvrdisplaydisconnected;
attribute EventHandler onvrdisplaypresentchange;
};
interface VRDisplay : EventTarget {
readonly attribute boolean isConnected;
readonly attribute boolean isPresenting;
[Constant] readonly attribute VRDisplayCapabilities capabilities;
readonly attribute VRStageParameters? stageParameters;
VREyeParameters getEyeParameters(VREye whichEye);
[Constant] readonly attribute unsigned long displayId;
[Constant] readonly attribute DOMString displayName;
[NewObject] VRPose getPose();
[NewObject] VRPose getImmediatePose();
void resetPose();
attribute double depthNear;
attribute double depthFar;
[Throws] long requestAnimationFrame(FrameRequestCallback callback);
[Throws] void cancelAnimationFrame(long handle);
Promise<void> requestPresent(VRLayer layer);
Promise<void> exitPresent();
sequence<VRLayer>? getLayers();
void submitFrame(optional VRPose pose);
};
typedef (HTMLCanvasElement or
OffscreenCanvas) VRSource;
dictionary VRLayer {
VRSource? source = null;
sequence<float>? leftBounds = [0.0, 0.0, 0.5, 1.0];
sequence<float>? rightBounds = [0.5, 0.0, 0.5, 1.0];
};
interface VRDisplayCapabilities {
readonly attribute boolean hasPosition;
readonly attribute boolean hasOrientation;
readonly attribute boolean hasExternalDisplay;
readonly attribute boolean canPresent;
};
interface VRStageParameters {
readonly attribute Float32Array sittingToStandingTransform;
readonly attribute float sizeX;
readonly attribute float sizeZ;
};
interface VRPose {
readonly attribute DOMHighResTimeStamp timestamp;
readonly attribute unsigned long frameID;
readonly attribute Float32Array? position;
readonly attribute Float32Array? linearVelocity;
readonly attribute Float32Array? linearAcceleration;
readonly attribute Float32Array? orientation;
readonly attribute Float32Array? angularVelocity;
readonly attribute Float32Array? angularAcceleration;
};
interface VRFieldOfViewReadOnly {
readonly attribute double upDegrees;
readonly attribute double rightDegrees;
readonly attribute double downDegrees;
readonly attribute double leftDegrees;
};
interface VRFieldOfView : VRFieldOfViewReadOnly {
inherit attribute double upDegrees;
inherit attribute double rightDegrees;
inherit attribute double downDegrees;
inherit attribute double leftDegrees;
};
dictionary VRFieldOfViewInit {
double upDegrees = 0.0;
double rightDegrees = 0.0;
double downDegrees = 0.0;
double leftDegrees = 0.0;
};
enum VREye {
"left",
"right"
};
interface VREyeParameters {
[Constant, Cached] readonly attribute Float32Array offset;
[Constant, Cached] readonly attribute VRFieldOfView fieldOfView;
[Constant, Cached] readonly attribute unsigned long renderWidth;
[Constant, Cached] readonly attribute unsigned long renderHeight;
};
partial interface Gamepad {
[Constant] readonly attribute unsigned long displayId;
};