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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: WebXR Device API (https://immersive-web.github.io/webxr/)
partial interface Navigator {
[SecureContext, SameObject] readonly attribute XRSystem xr;
};
[SecureContext, Exposed=Window] interface XRSystem : EventTarget {
// Methods
Promise<boolean> isSessionSupported(XRSessionMode mode);
[NewObject] Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit options = {});
// Events
attribute EventHandler ondevicechange;
};
enum XRSessionMode {
"inline",
"immersive-vr",
"immersive-ar"
};
dictionary XRSessionInit {
sequence<DOMString> requiredFeatures;
sequence<DOMString> optionalFeatures;
};
enum XRVisibilityState {
"visible",
"visible-blurred",
"hidden",
};
[SecureContext, Exposed=Window] interface XRSession : EventTarget {
// Attributes
readonly attribute XRVisibilityState visibilityState;
readonly attribute float? frameRate;
readonly attribute Float32Array? supportedFrameRates;
[SameObject] readonly attribute XRRenderState renderState;
[SameObject] readonly attribute XRInputSourceArray inputSources;
readonly attribute FrozenArray<DOMString> enabledFeatures;
// Methods
undefined updateRenderState(optional XRRenderStateInit state = {});
Promise<undefined> updateTargetFrameRate(float rate);
[NewObject] Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type);
unsigned long requestAnimationFrame(XRFrameRequestCallback callback);
undefined cancelAnimationFrame(unsigned long handle);
Promise<undefined> end();
// Events
attribute EventHandler onend;
attribute EventHandler oninputsourceschange;
attribute EventHandler onselect;
attribute EventHandler onselectstart;
attribute EventHandler onselectend;
attribute EventHandler onsqueeze;
attribute EventHandler onsqueezestart;
attribute EventHandler onsqueezeend;
attribute EventHandler onvisibilitychange;
attribute EventHandler onframeratechange;
};
dictionary XRRenderStateInit {
double depthNear;
double depthFar;
double inlineVerticalFieldOfView;
XRWebGLLayer? baseLayer;
sequence<XRLayer>? layers;
};
[SecureContext, Exposed=Window] interface XRRenderState {
readonly attribute double depthNear;
readonly attribute double depthFar;
readonly attribute double? inlineVerticalFieldOfView;
readonly attribute XRWebGLLayer? baseLayer;
};
callback XRFrameRequestCallback = undefined (DOMHighResTimeStamp time, XRFrame frame);
[SecureContext, Exposed=Window] interface XRFrame {
[SameObject] readonly attribute XRSession session;
readonly attribute DOMHighResTimeStamp predictedDisplayTime;
XRViewerPose? getViewerPose(XRReferenceSpace referenceSpace);
XRPose? getPose(XRSpace space, XRSpace baseSpace);
};
[SecureContext, Exposed=Window] interface XRSpace : EventTarget {
};
enum XRReferenceSpaceType {
"viewer",
"local",
"local-floor",
"bounded-floor",
"unbounded"
};
[SecureContext, Exposed=Window]
interface XRReferenceSpace : XRSpace {
[NewObject] XRReferenceSpace getOffsetReferenceSpace(XRRigidTransform originOffset);
attribute EventHandler onreset;
};
[SecureContext, Exposed=Window]
interface XRBoundedReferenceSpace : XRReferenceSpace {
readonly attribute FrozenArray<DOMPointReadOnly> boundsGeometry;
};
enum XREye {
"none",
"left",
"right"
};
[SecureContext, Exposed=Window] interface XRView {
readonly attribute XREye eye;
readonly attribute Float32Array projectionMatrix;
[SameObject] readonly attribute XRRigidTransform transform;
readonly attribute double? recommendedViewportScale;
undefined requestViewportScale(double? scale);
};
[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 XRRigidTransform {
constructor(optional DOMPointInit position = {}, optional DOMPointInit orientation = {});
[SameObject] readonly attribute DOMPointReadOnly position;
[SameObject] readonly attribute DOMPointReadOnly orientation;
readonly attribute Float32Array matrix;
[SameObject] readonly attribute XRRigidTransform inverse;
};
[SecureContext, Exposed=Window] interface XRPose {
[SameObject] readonly attribute XRRigidTransform transform;
[SameObject] readonly attribute DOMPointReadOnly? linearVelocity;
[SameObject] readonly attribute DOMPointReadOnly? angularVelocity;
readonly attribute boolean emulatedPosition;
};
[SecureContext, Exposed=Window] interface XRViewerPose : XRPose {
[SameObject] readonly attribute FrozenArray<XRView> views;
};
enum XRHandedness {
"none",
"left",
"right"
};
enum XRTargetRayMode {
"gaze",
"tracked-pointer",
"screen"
};
[SecureContext, Exposed=Window]
interface XRInputSource {
readonly attribute XRHandedness handedness;
readonly attribute XRTargetRayMode targetRayMode;
[SameObject] readonly attribute XRSpace targetRaySpace;
[SameObject] readonly attribute XRSpace? gripSpace;
[SameObject] readonly attribute FrozenArray<DOMString> profiles;
};
[SecureContext, Exposed=Window]
interface XRInputSourceArray {
iterable<XRInputSource>;
readonly attribute unsigned long length;
getter XRInputSource(unsigned long index);
};
[SecureContext, Exposed=Window]
interface XRLayer : EventTarget {};
typedef (WebGLRenderingContext or
WebGL2RenderingContext) XRWebGLRenderingContext;
dictionary XRWebGLLayerInit {
boolean antialias = true;
boolean depth = true;
boolean stencil = false;
boolean alpha = true;
boolean ignoreDepthValues = false;
double framebufferScaleFactor = 1.0;
};
[SecureContext, Exposed=Window]
interface XRWebGLLayer: XRLayer {
constructor(XRSession session,
XRWebGLRenderingContext context,
optional XRWebGLLayerInit layerInit = {});
// Attributes
readonly attribute boolean antialias;
readonly attribute boolean ignoreDepthValues;
attribute float? fixedFoveation;
[SameObject] readonly attribute WebGLFramebuffer? framebuffer;
readonly attribute unsigned long framebufferWidth;
readonly attribute unsigned long framebufferHeight;
// Methods
XRViewport? getViewport(XRView view);
// Static Methods
static double getNativeFramebufferScaleFactor(XRSession session);
};
partial dictionary WebGLContextAttributes {
boolean xrCompatible = false;
};
partial interface mixin WebGLRenderingContextBase {
[NewObject] Promise<undefined> makeXRCompatible();
};
[SecureContext, Exposed=Window]
interface XRSessionEvent : Event {
constructor(DOMString type, XRSessionEventInit eventInitDict);
[SameObject] readonly attribute XRSession session;
};
dictionary XRSessionEventInit : EventInit {
required XRSession session;
};
[SecureContext, Exposed=Window]
interface XRInputSourceEvent : Event {
constructor(DOMString type, XRInputSourceEventInit eventInitDict);
[SameObject] readonly attribute XRFrame frame;
[SameObject] readonly attribute XRInputSource inputSource;
};
dictionary XRInputSourceEventInit : EventInit {
required XRFrame frame;
required XRInputSource inputSource;
};
[SecureContext, Exposed=Window]
interface XRInputSourcesChangeEvent : Event {
constructor(DOMString type, XRInputSourcesChangeEventInit eventInitDict);
[SameObject] readonly attribute XRSession session;
[SameObject] readonly attribute FrozenArray<XRInputSource> added;
[SameObject] readonly attribute FrozenArray<XRInputSource> removed;
};
dictionary XRInputSourcesChangeEventInit : EventInit {
required XRSession session;
required FrozenArray<XRInputSource> added;
required FrozenArray<XRInputSource> removed;
};
[SecureContext, Exposed=Window]
interface XRReferenceSpaceEvent : Event {
constructor(DOMString type, XRReferenceSpaceEventInit eventInitDict);
[SameObject] readonly attribute XRReferenceSpace referenceSpace;
[SameObject] readonly attribute XRRigidTransform? transform;
};
dictionary XRReferenceSpaceEventInit : EventInit {
required XRReferenceSpace referenceSpace;
XRRigidTransform? transform = null;
};
dictionary XRSessionSupportedPermissionDescriptor: PermissionDescriptor {
XRSessionMode mode;
};
dictionary XRPermissionDescriptor: PermissionDescriptor {
XRSessionMode mode;
sequence<DOMString> requiredFeatures;
sequence<DOMString> optionalFeatures;
};
[Exposed=Window]
interface XRPermissionStatus: PermissionStatus {
attribute FrozenArray<DOMString> granted;
};
|