/
webxr.idl
236 lines (187 loc) · 6.36 KB
/
webxr.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
// Source: WebXR Device API (https://immersive-web.github.io/webxr/)
[SecureContext, Exposed=Window] interface XR : EventTarget {
// Methods
Promise<XRDevice?> requestDevice();
// Events
attribute EventHandler ondevicechange;
};
[SecureContext]
partial interface Navigator {
[SameObject] readonly attribute XR xr;
};
[SecureContext, Exposed=Window] interface XRDevice {
// Methods
Promise<void> supportsSession(optional XRSessionCreationOptions options);
Promise<XRSession> requestSession(optional XRSessionCreationOptions options);
};
dictionary XRSessionCreationOptions {
boolean immersive = false;
XRPresentationContext outputContext;
};
enum XREnvironmentBlendMode {
"opaque",
"additive",
"alpha-blend",
};
[SecureContext, Exposed=Window] interface XRSession : EventTarget {
// Attributes
readonly attribute XRDevice device;
readonly attribute boolean immersive;
readonly attribute XRPresentationContext outputContext;
readonly attribute XREnvironmentBlendMode environmentBlendMode;
attribute double depthNear;
attribute double depthFar;
attribute XRLayer baseLayer;
// Methods
Promise<XRFrameOfReference> requestFrameOfReference(XRFrameOfReferenceType type, optional XRFrameOfReferenceOptions options);
FrozenArray<XRInputSource> getInputSources();
long requestAnimationFrame(XRFrameRequestCallback callback);
void cancelAnimationFrame(long handle);
Promise<void> end();
// Events
attribute EventHandler onblur;
attribute EventHandler onfocus;
attribute EventHandler onresetpose;
attribute EventHandler onend;
attribute EventHandler onselect;
attribute EventHandler onselectstart;
attribute EventHandler onselectend;
};
callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRFrame frame);
[SecureContext, Exposed=Window] interface XRFrame {
readonly attribute XRSession session;
readonly attribute FrozenArray<XRView> views;
XRDevicePose? getDevicePose(XRCoordinateSystem coordinateSystem);
XRInputPose? getInputPose(XRInputSource inputSource, XRCoordinateSystem coordinateSystem);
};
[SecureContext, Exposed=Window] interface XRCoordinateSystem : EventTarget {
Float32Array? getTransformTo(XRCoordinateSystem other);
};
enum XRFrameOfReferenceType {
"head-model",
"eye-level",
"stage",
};
dictionary XRFrameOfReferenceOptions {
boolean disableStageEmulation = false;
double stageEmulationHeight = 0.0;
};
[SecureContext, Exposed=Window] interface XRFrameOfReference : XRCoordinateSystem {
readonly attribute XRStageBounds? bounds;
readonly attribute double emulatedHeight;
attribute EventHandler onboundschange;
};
[SecureContext, Exposed=Window] interface XRStageBounds {
readonly attribute FrozenArray<DOMPointReadOnly> geometry;
};
enum XREye {
"left",
"right"
};
[SecureContext, Exposed=Window] interface XRView {
readonly attribute XREye eye;
readonly attribute Float32Array projectionMatrix;
};
[SecureContext, Exposed=Window] interface XRViewport {
readonly attribute long x;
readonly attribute long y;
readonly attribute long width;
readonly attribute long height;
};
[SecureContext, Exposed=Window] interface XRDevicePose {
readonly attribute Float32Array poseModelMatrix;
Float32Array getViewMatrix(XRView view);
};
enum XRHandedness {
"",
"left",
"right"
};
enum XRTargetRayMode {
"gaze",
"tracked-pointer",
"screen"
};
[SecureContext, Exposed=Window]
interface XRInputSource {
readonly attribute XRHandedness handedness;
readonly attribute XRTargetRayMode targetRayMode;
};
[SecureContext, Exposed=Window]
interface XRRay {
readonly attribute DOMPointReadOnly origin;
readonly attribute DOMPointReadOnly direction;
readonly attribute Float32Array transformMatrix;
};
[SecureContext, Exposed=Window]
interface XRInputPose {
readonly attribute boolean emulatedPosition;
readonly attribute XRRay targetRay;
readonly attribute Float32Array? gripMatrix;
};
[SecureContext, Exposed=Window] interface XRLayer {};
typedef (WebGLRenderingContext or
WebGL2RenderingContext) XRWebGLRenderingContext;
dictionary XRWebGLLayerInit {
boolean antialias = true;
boolean depth = true;
boolean stencil = false;
boolean alpha = true;
boolean multiview = false;
double framebufferScaleFactor = 1.0;
};
[SecureContext, Exposed=Window, Constructor(XRSession session,
XRWebGLRenderingContext context,
optional XRWebGLLayerInit layerInit)]
interface XRWebGLLayer : XRLayer {
// Attributes
readonly attribute XRWebGLRenderingContext context;
readonly attribute boolean antialias;
readonly attribute boolean depth;
readonly attribute boolean stencil;
readonly attribute boolean alpha;
readonly attribute boolean multiview;
readonly attribute WebGLFramebuffer framebuffer;
readonly attribute unsigned long framebufferWidth;
readonly attribute unsigned long framebufferHeight;
// Methods
XRViewport? getViewport(XRView view);
void requestViewportScaling(double viewportScaleFactor);
// Static Methods
static double getNativeFramebufferScaleFactor(XRSession session);
};
partial dictionary WebGLContextAttributes {
XRDevice compatibleXRDevice = null;
};
partial interface mixin WebGLRenderingContextBase {
Promise<void> setCompatibleXRDevice(XRDevice device);
};
[SecureContext, Exposed=Window] interface XRPresentationContext {
readonly attribute HTMLCanvasElement canvas;
};
[SecureContext, Exposed=Window, Constructor(DOMString type, XRSessionEventInit eventInitDict)]
interface XRSessionEvent : Event {
readonly attribute XRSession session;
};
dictionary XRSessionEventInit : EventInit {
required XRSession session;
};
[SecureContext, Exposed=Window, Constructor(DOMString type, XRInputSourceEventInit eventInitDict)]
interface XRInputSourceEvent : Event {
readonly attribute XRFrame frame;
readonly attribute XRInputSource inputSource;
};
dictionary XRInputSourceEventInit : EventInit {
required XRFrame frame;
required XRInputSource inputSource;
};
[SecureContext, Exposed=Window, Constructor(DOMString type, XRCoordinateSystemEventInit eventInitDict)]
interface XRCoordinateSystemEvent : Event {
readonly attribute XRCoordinateSystem coordinateSystem;
};
dictionary XRCoordinateSystemEventInit : EventInit {
required XRCoordinateSystem coordinateSystem;
};