OLD | NEW |
---|---|
(Empty) | |
1 // Archived version of the WebVR spec from | |
Rick Byers
2016/12/20 18:37:28
Is there a difference between the "archived" versi
| |
2 // https://w3c.github.io/webvr/archive/prerelease/1.1/index.html | |
3 | |
4 interface VRDisplay : EventTarget { | |
5 readonly attribute boolean isConnected; | |
6 readonly attribute boolean isPresenting; | |
7 | |
8 /** | |
9 * Dictionary of capabilities describing the VRDisplay. | |
10 */ | |
11 [SameObject] readonly attribute VRDisplayCapabilities capabilities; | |
12 | |
13 /** | |
14 * If this VRDisplay supports room-scale experiences, the optional | |
15 * stage attribute contains details on the room-scale parameters. | |
16 * The stageParameters attribute can not change between null | |
17 * and non-null once the VRDisplay is enumerated; however, | |
18 * the values within VRStageParameters may change after | |
19 * any call to VRDisplay.submitFrame as the user may re-configure | |
20 * their environment at any time. | |
21 */ | |
22 readonly attribute VRStageParameters? stageParameters; | |
23 | |
24 /** | |
25 * Return the current VREyeParameters for the given eye. | |
26 */ | |
27 VREyeParameters getEyeParameters(VREye whichEye); | |
28 | |
29 /** | |
30 * An identifier for this distinct VRDisplay. Used as an | |
31 * association point in the Gamepad API. | |
32 */ | |
33 readonly attribute unsigned long displayId; | |
34 | |
35 /** | |
36 * A display name, a user-readable name identifying it. | |
37 */ | |
38 readonly attribute DOMString displayName; | |
39 | |
40 /** | |
41 * Populates the passed VRFrameData with the information required to render | |
42 * the current frame. | |
43 */ | |
44 boolean getFrameData(VRFrameData frameData); | |
45 | |
46 /** | |
47 * Return a VRPose containing the future predicted pose of the VRDisplay | |
48 * when the current frame will be presented. The value returned will not | |
49 * change until JavaScript has returned control to the browser. | |
50 * | |
51 * The VRPose will contain the position, orientation, velocity, | |
52 * and acceleration of each of these properties. | |
53 */ | |
54 [NewObject] VRPose getPose(); | |
55 | |
56 /** | |
57 * Reset the pose for this display, treating its current position and | |
58 * orientation as the "origin/zero" values. VRPose.position, | |
59 * VRPose.orientation, and VRStageParameters.sittingToStandingTransform may be | |
60 * updated when calling resetPose(). This should be called in only | |
61 * sitting-space experiences. | |
62 */ | |
63 void resetPose(); | |
64 | |
65 /** | |
66 * z-depth defining the near plane of the eye view frustum | |
67 * enables mapping of values in the render target depth | |
68 * attachment to scene coordinates. Initially set to 0.01. | |
69 */ | |
70 attribute double depthNear; | |
71 | |
72 /** | |
73 * z-depth defining the far plane of the eye view frustum | |
74 * enables mapping of values in the render target depth | |
75 * attachment to scene coordinates. Initially set to 10000.0. | |
76 */ | |
77 attribute double depthFar; | |
78 | |
79 /** | |
80 * The callback passed to `requestAnimationFrame` will be called | |
81 * any time a new frame should be rendered. When the VRDisplay is | |
82 * presenting the callback will be called at the native refresh | |
83 * rate of the HMD. When not presenting this function acts | |
84 * identically to how window.requestAnimationFrame acts. Content should | |
85 * make no assumptions of frame rate or vsync behavior as the HMD runs | |
86 * asynchronously from other displays and at differing refresh rates. | |
87 */ | |
88 long requestAnimationFrame(FrameRequestCallback callback); | |
89 | |
90 /** | |
91 * Passing the value returned by `requestAnimationFrame` to | |
92 * `cancelAnimationFrame` will unregister the callback. | |
93 */ | |
94 void cancelAnimationFrame(long handle); | |
95 | |
96 /** | |
97 * Begin presenting to the VRDisplay. Must be called in response to a user ges ture. | |
98 * Repeat calls while already presenting will update the VRLayers being displa yed. | |
99 * If the number of values in the leftBounds/rightBounds arrays is not 0 or 4 for any of the passed layers the promise is rejected | |
100 * If the source of any of the layers is not present (null), the promise is re jected. | |
101 */ | |
102 Promise<void> requestPresent(sequence<VRLayer> layers); | |
103 | |
104 /** | |
105 * Stops presenting to the VRDisplay. | |
106 */ | |
107 Promise<void> exitPresent(); | |
108 | |
109 /** | |
110 * Get the layers currently being presented. | |
111 */ | |
112 sequence<VRLayer> getLayers(); | |
113 | |
114 /** | |
115 * The VRLayer provided to the VRDisplay will be captured and presented | |
116 * in the HMD. Calling this function has the same effect on the source | |
117 * canvas as any other operation that uses its source image, and canvases | |
118 * created without preserveDrawingBuffer set to true will be cleared. | |
119 */ | |
120 void submitFrame(); | |
121 }; | |
122 | |
123 typedef (HTMLCanvasElement or | |
124 OffscreenCanvas) VRSource; | |
125 | |
126 dictionary VRLayer { | |
127 VRSource? source = null; | |
128 | |
129 sequence<float> leftBounds = []; | |
130 sequence<float> rightBounds = []; | |
131 }; | |
132 | |
133 interface VRDisplayCapabilities { | |
134 readonly attribute boolean hasPosition; | |
135 readonly attribute boolean hasOrientation; | |
136 readonly attribute boolean hasExternalDisplay; | |
137 readonly attribute boolean canPresent; | |
138 readonly attribute unsigned long maxLayers; | |
139 }; | |
140 | |
141 enum VREye { | |
142 "left", | |
143 "right" | |
144 }; | |
145 | |
146 interface VRFieldOfView { | |
147 readonly attribute double upDegrees; | |
148 readonly attribute double rightDegrees; | |
149 readonly attribute double downDegrees; | |
150 readonly attribute double leftDegrees; | |
151 }; | |
152 | |
153 interface VRPose { | |
154 readonly attribute Float32Array? position; | |
155 readonly attribute Float32Array? linearVelocity; | |
156 readonly attribute Float32Array? linearAcceleration; | |
157 | |
158 readonly attribute Float32Array? orientation; | |
159 readonly attribute Float32Array? angularVelocity; | |
160 readonly attribute Float32Array? angularAcceleration; | |
161 }; | |
162 | |
163 [Constructor] | |
164 interface VRFrameData { | |
165 readonly attribute DOMHighResTimeStamp timestamp; | |
166 | |
167 readonly attribute Float32Array leftProjectionMatrix; | |
168 readonly attribute Float32Array leftViewMatrix; | |
169 | |
170 readonly attribute Float32Array rightProjectionMatrix; | |
171 readonly attribute Float32Array rightViewMatrix; | |
172 | |
173 readonly attribute VRPose pose; | |
174 }; | |
175 | |
176 interface VREyeParameters { | |
177 readonly attribute Float32Array offset; | |
178 | |
179 [SameObject] readonly attribute VRFieldOfView fieldOfView; | |
180 | |
181 readonly attribute unsigned long renderWidth; | |
182 readonly attribute unsigned long renderHeight; | |
183 }; | |
184 | |
185 interface VRStageParameters { | |
186 readonly attribute Float32Array sittingToStandingTransform; | |
187 | |
188 readonly attribute float sizeX; | |
189 readonly attribute float sizeZ; | |
190 }; | |
191 | |
192 partial interface Navigator { | |
193 Promise<sequence<VRDisplay>> getVRDisplays(); | |
194 readonly attribute FrozenArray<VRDisplay> activeVRDisplays; | |
195 readonly attribute boolean vrEnabled; | |
196 }; | |
197 | |
198 enum VRDisplayEventReason { | |
199 "mounted", | |
200 "navigation", | |
201 "requested", | |
202 "unmounted" | |
203 }; | |
204 | |
205 [Constructor(DOMString type, VRDisplayEventInit eventInitDict)] | |
206 interface VRDisplayEvent : Event { | |
207 readonly attribute VRDisplay display; | |
208 readonly attribute VRDisplayEventReason? reason; | |
209 }; | |
210 | |
211 dictionary VRDisplayEventInit : EventInit { | |
212 required VRDisplay display; | |
213 VRDisplayEventReason reason; | |
214 }; | |
215 | |
216 partial interface Window { | |
217 attribute EventHandler onvrdisplayconnect; | |
218 attribute EventHandler onvrdisplaydisconnect; | |
219 attribute EventHandler onvrdisplayactivate; | |
220 attribute EventHandler onvrdisplaydeactivate; | |
221 attribute EventHandler onvrdisplayblur; | |
222 attribute EventHandler onvrdisplayfocus; | |
223 attribute EventHandler onvrdisplaypresentchange; | |
224 }; | |
225 | |
226 partial interface HTMLIFrameElement { | |
227 attribute boolean allowvr; | |
228 }; | |
229 | |
230 partial interface Gamepad { | |
231 readonly attribute unsigned long displayId; | |
232 }; | |
OLD | NEW |