diff --git a/index.bs b/index.bs index 8fa3c34b..848210c3 100644 --- a/index.bs +++ b/index.bs @@ -72,11 +72,6 @@ interface VRDisplay : EventTarget { */ readonly attribute VRStageParameters? stageParameters; - /** - * Return the current VREyeParameters for the given eye. - */ - VREyeParameters getEyeParameters(VREye whichEye); - /** * An identifier for this distinct VRDisplay. Used as an * association point in the Gamepad API. @@ -94,16 +89,6 @@ interface VRDisplay : EventTarget { */ boolean getFrameData(VRFrameData frameData); - /** - * Return a VRPose containing the future predicted pose of the VRDisplay - * when the current frame will be presented. The value returned will not - * change until JavaScript has returned control to the browser. - * - * The VRPose will contain the position, orientation, velocity, - * and acceleration of each of these properties. - */ - [NewObject] VRPose getPose(); - /** * Reset the pose for this display, treating its current position and * orientation as the "origin/zero" values. VRPose.position, @@ -127,6 +112,26 @@ interface VRDisplay : EventTarget { */ attribute double depthFar; + /** + * Maximum effective width of the VRLayer source, in pixels. + */ + readonly attribute unsigned long maximumRenderWidth; + + /** + * Maximum effective height of the VRLayer source, in pixels. + */ + readonly attribute unsigned long maximumRenderHeight; + + /** + * Recommended width of the VRLayer source, in pixels. + */ + readonly attribute unsigned long recommendedRenderWidth; + + /** + * Recommended height of the VRLayer source, in pixels. + */ + readonly attribute unsigned long recommendedRenderHeight; + /** * The callback passed to `requestAnimationFrame` will be called * any time a new frame should be rendered. When the VRDisplay is @@ -183,19 +188,11 @@ The {{isPresenting}} attribute MUST return the {{VRDisplay}}'s presentation stat capabilities The {{capabilities}} attribute MUST return the {{VRDisplay}}'s {{VRDisplayCapabilities}} object, a dictionary of capabilities describing the {{VRDisplay}}. -getEyeParameters() -Returns the current {{VREyeParameters}} for the given eye. The eye parameters MAY change at any time due to external factors, such as the user changing the IPD with hardware controls. - getFrameData() Populates the provided {{VRFrameData}} object with the {{VRPose}} and view and projection matricies for the current frame. These values describe the position, orientation, acceleration, and velocity of the {{VRDisplay}} that should be used when rendering the next frame of a scene. The User Agent MAY optionally use predictive techniques to estimate what these values will be at the time that the next frame will be displayed to the user. Subsequent calls to {{getFrameData()}} MUST provide the same values until the next call to {{submitFrame()}}. Returns true if the the provided {{VRFrameData}} object was successfully updated, false otherwise. -getPose() -(Deprecated) Returns a {{VRPose}} describing the position, orientation, acceleration, and velocity of the {{VRDisplay}} that should be used when rendering the next frame of a scene. The User Agent MAY optionally use predictive techniques to estimate what the pose will be at the time that the next frame will be displayed to the user. Subsequent calls to {{getPose()}} MUST return a {{VRPose}} with the same values until the next call to {{submitFrame()}}. - -This function is deprecated but is preserved for backwards compatibility. Using it MAY incur warnings from the User Agent. Prefer using {{getFrameData()}}, which also provides a {{VRPose}}, instead. - resetPose() -Reset the pose for the {{VRDisplay}}, treating its current position and orientation as the "origin/zero" values. Future values returned from {{getFrameData()}} or {{getPose()}} will describe positions relative to the {{VRDisplay}}'s position when {{resetPose()}} was last called and will treat the display's yaw when {{resetPose()}} was last called as the forward orientation. The {{VRDisplay}}'s reported roll and pitch do not change when {{resetPose()}} is called as they are relative to gravity. Calling {{resetPose()}} may change the {{sittingToStandingTransform}} matrix of the {{VRStageParameters}}. +Reset the pose for the {{VRDisplay}}, treating its current position and orientation as the "origin/zero" values. Future values returned from {{getFrameData()}} will describe positions relative to the {{VRDisplay}}'s position when {{resetPose()}} was last called and will treat the display's yaw when {{resetPose()}} was last called as the forward orientation. The {{VRDisplay}}'s reported roll and pitch do not change when {{resetPose()}} is called as they are relative to gravity. Calling {{resetPose()}} may change the {{sittingToStandingTransform}} matrix of the {{VRStageParameters}}. requestAnimationFrame() Functionally equivalent to window.requestAnimationFrame when the {{VRDisplay}} is not presenting. When the {{VRDisplay}} is presenting the callback is called at the native refresh rate of the {{VRDisplay}}. @@ -215,6 +212,23 @@ Returns an array with the {{VRLayer}} currently being presented. MUST return an submitFrame() Captures the current state of the {{VRLayer}} currently being presented and displays it on the {{VRDisplay}}. It is assumed that the frame was rendered using the {{VRPose}} and matrices provided by the last call to {{getFrameData()}}. If {{getFrameData()}} was not called prior to calling {{submitFrame()}} the user agent MAY warn the user of potentially malformed visuals or prevent the frame from being shown at all. +depthNear +Z-depth defining the near plane of the eye view frustum. Enables mapping of values in the render target depth attachment to scene coordinates. Initially set to 0.01. + +depthFar +Z-depth defining the far plane of the eye view frustum. Enables mapping of values in the render target depth attachment to scene coordinates. Initially set to 10000.0. + +maximumRenderWidth +Width of the {{VRLayer}} source in pixels at which the final image presented to the user will have a 1:1 pixel ratio at the center of the user's view after any distortion the {{VRDisplay}} will apply. Applications should use a {{VRLayer}} source with this width to achive maximum quality. The width reported MUST be large enough to contain both the left and right eye viewports in the default side-by-side orientaion. + +maximumRenderHeight +Height of the {{VRLayer}} source in pixels at which the final image presented to the user will have a 1:1 pixel ratio at the center of the user's view after any distortion the {{VRDisplay}} will apply. Applications should use a {{VRLayer}} source with this height to achive maximum quality. + +recommendedRenderWidth +Recommended width of the {{VRLayer}} source in pixels that will provide a good balance of quality and performance for most applications. The width reported MAY be the same as the {{maximumRenderWidth}} or MAY be lower if the underlying platform recommends it for performance reasons. The width reported MUST be large enough to contain both the left and right eye viewports in the default side-by-side orientaion. + +recommendedRenderHeight +Recommended height of the {{VRLayer}} source in pixels that will provide a good balance of quality and performance for most applications. The height reported MAY be the same as the {{maximumRenderHeight}} or MAY be lower if the underlying platform recommends it for performance reasons.
The following code demonstrates presenting a simple rendering loop to a {{VRDisplay}}. @@ -310,39 +324,16 @@ The {{hasOrientation}} attribute MUST return whether the {{VRDisplay}} is capabl The {{hasExternalDisplay}} attribute MUST return whether the {{VRDisplay}} is separate from the device's primary display. If presenting VR content will obscure other content on the device, this should be false. When false, the application should not attempt to mirror VR content or update non-VR UI because that content will not be visible. canPresent -The {{canPresent}} attribute MUST return whether the {{VRDisplay}} is capable of presenting content to an HMD or similar device. Can be used to indicate "magic window" devices that are capable of 6DoF tracking but for which {{VRDisplay}}.{{requestPresent()}} is not meaningful. If false then calls to {{VRDisplay}}.{{requestPresent()}} should always fail, and {{VRDisplay}}.{{getEyeParameters()}} should return null. +The {{canPresent}} attribute MUST return whether the {{VRDisplay}} is capable of presenting content to an HMD or similar device. Can be used to indicate "magic window" devices that are capable of 6DoF tracking but for which {{VRDisplay}}.{{requestPresent()}} is not meaningful. If false then calls to {{VRDisplay}}.{{requestPresent()}} should always fail. maxLayers Indicates the maximum length of the array that {{requestPresent()}} will accept. MUST be 1 if {{canPresent}} is true, 0 otherwise. Note: Future revisions of this spec may allow multiple layers to enable more complex rendering effects such as compositing WebGL and DOM elements together. That functionality is not allowed by this revision of the spec. - -## VREye ## {#interface-vreye} - -
-enum VREye {
-  "left",
-  "right"
-};
-
- -## VRFieldOfView ## {#interface-interface-vrfieldofview} - -(Deprecated) The {{VRFieldOfView}} interface represents a field of view, as given by 4 degrees describing the view from a center point. - -
-interface VRFieldOfView {
-  readonly attribute double upDegrees;
-  readonly attribute double rightDegrees;
-  readonly attribute double downDegrees;
-  readonly attribute double leftDegrees;
-};
-
- ## VRPose ## {#interface-vrpose} -The VRPose interface represents a sensor's state at a given timestamp. +The VRPose interface describes a position, orientation, and motion in space.
 interface VRPose {
@@ -353,6 +344,8 @@ interface VRPose {
   readonly attribute Float32Array? orientation;
   readonly attribute Float32Array? angularVelocity;
   readonly attribute Float32Array? angularAcceleration;
+
+  readonly attribute Float32Array poseMatrix;
 };
 
@@ -402,54 +395,10 @@ Angular acceleration of the sensor given in radians per second squared. MAY be null if the sensor is incapable of providing angular acceleration. When not null MUST be a three-element array. -
-The following code snippet creates a WebGL-compatible matrix from a -{{VRPose}}: +poseMatrix +A 4x4 matrix describing the tranform defined by the position and orientation of +the pose, given as a 16 element array in column major order. -
-function poseToMatrix (pose) {
-    var out = new Float32Array(16);
-
-    // If the orientation or position are null, provide defaults.
-    var q = pose.orientation ? pose.orientation : [0, 0, 0, 1];
-    var v = pose.position ? pose.position : [0, 0, 0];
-
-    // Compute some values for the quaternion math.
-    var x2 = q[0] + q[0];
-    var y2 = q[1] + q[1];
-    var z2 = q[2] + q[2];
-
-    var xx = q[0] * x2;
-    var xy = q[0] * y2;
-    var xz = q[0] * z2;
-    var yy = q[1] * y2;
-    var yz = q[1] * z2;
-    var zz = q[2] * z2;
-    var wx = q[3] * x2;
-    var wy = q[3] * y2;
-    var wz = q[3] * z2;
-
-    out[0] = 1 - (yy + zz);
-    out[1] = xy + wz;
-    out[2] = xz - wy;
-    out[3] = 0;
-    out[4] = xy - wz;
-    out[5] = 1 - (xx + zz);
-    out[6] = yz + wx;
-    out[7] = 0;
-    out[8] = xz + wy;
-    out[9] = yz - wx;
-    out[10] = 1 - (xx + yy);
-    out[11] = 0;
-    out[12] = v[0];
-    out[13] = v[1];
-    out[14] = v[2];
-    out[15] = 1;
-
-    return out;
-}
-
-
## VRFrameData ## {#interface-vrframedata} @@ -461,9 +410,11 @@ interface VRFrameData { readonly attribute DOMHighResTimeStamp timestamp; readonly attribute Float32Array leftProjectionMatrix; + readonly attribute Float32Array leftPoseToEyeMatrix; readonly attribute Float32Array leftViewMatrix; readonly attribute Float32Array rightProjectionMatrix; + readonly attribute Float32Array rightPoseToEyeMatrix; readonly attribute Float32Array rightViewMatrix; readonly attribute VRPose pose; @@ -483,59 +434,24 @@ starts at 0 the first time {{getFrameData()}} is invoked for a given leftProjectionMatrix A 4x4 matrix describing the projection to be used for the left eye's rendering, given as a 16 element array in column major order. This value may be passed directly to WebGL's uniformMatrix4fv function. It is highly recommended that applications use this matrix without modification. Failure to use this projection matrix when rendering may cause the presented frame to be distorted or badly aligned, resulting in varying degrees of user discomfort. +leftPoseToEyeMatrix +A 4x4 matrix describing the view transform from the {{pose}} to the left eye, given as a 16 element array in column major order. + leftViewMatrix A 4x4 matrix describing the view transform to be used for the left eye's rendering, given as a 16 element array in column major order. Represents the inverse of the model matrix of the left eye in sitting space. This value may be passed directly to WebGL's uniformMatrix4fv function. It is highly recommended that applications use this matrix when rendering. rightProjectionMatrix A 4x4 matrix describing the projection to be used for the right eye's rendering, given as a 16 element array in column major order. This value may be passed directly to WebGL's uniformMatrix4fv function. It is highly recommended that applications use this matrix without modification. Failure to use this projection matrix when rendering may cause the presented frame to be distorted or badly aligned, resulting in varying degrees of user discomfort. +rightPoseToEyeMatrix +A 4x4 matrix describing the view transform from the {{pose}} to the right eye, given as a 16 element array in column major order. + rightViewMatrix A 4x4 matrix describing the view transform to be used for the right eye's rendering, given as a 16 element array in column major order. Represents the inverse of the model matrix of the right eye in sitting space. This value may be passed directly to WebGL's uniformMatrix4fv function. It is highly recommended that applications use this matrix when rendering. pose The {{VRPose}} of the {{VRDisplay}} at {{timestamp}}. -## VREyeParameters ## {#interface-vreyeparameters} - -The {{VREyeParameters}} interface represents all the information required to correctly render a scene for a given eye. - -
-interface VREyeParameters {
-  readonly attribute Float32Array offset;
-
-  [SameObject] readonly attribute VRFieldOfView fieldOfView;
-
-  readonly attribute unsigned long renderWidth;
-  readonly attribute unsigned long renderHeight;
-};
-
- -### Attributes ### {#vreyeparameters-attributes} - -offset -A three component vector describing the offset from the center point between the users eyes to the center of the eye in meters. The x component of this vector SHOULD represent half of the user's interpupillary distance (IPD), but MAY also represent the vector from the center point of the headset to the center point of the lens for the given eye. Values in the x component for left eye MUST be negative; values in the x component for right eye MUST be positive. This information should not be used to construct a view matrix, prefer using the view matricies provided in {{VRFrameData}} instead. - -fieldOfView -(Deprecated) The current field of view for the eye. SHOULD conservatively cover the entire viewable frustum of the eye. The application should not use these values to construct a projection matrix, as it may not take into account all aspects of the {{VRDisplay}} optics. Prefer using the projection matrices provided in {{VRFrameData}} instead. - -renderWidth -Describes the recommended render target width of each eye viewport, in pixels. If multiple eyes are rendered in a single render target, then the render target should be made large enough to fit both viewports. The {{renderWidth}} for the left eye and right eye MUST NOT overlap, and the {{renderWidth}} for the right eye MUST be to the right of the {{renderWidth}} for the left eye. - -renderHeight -Describes the recommended render target height of each eye viewport, in pixels. If multiple eyes are rendered in a single render target, then the render target should be made large enough to fit both viewports. The {{renderWidth}} for the left eye and right eye MUST NOT overlap, and the {{renderWidth}} for the right eye MUST be to the right of the {{renderWidth}} for the left eye. - -
-Many HMDs will distort the rendered image to counteract undesired effects introduced by the headset optics. Because of this the optimal resolution of the canvas will often be larger than the HMD's physical resolution to ensure that the final image presented to the user has a 1:1 pixel ratio at the center of the user's view. The optimal canvas resolution can be calculated from the {{renderWidth}} and {{renderHeight}} for both eyes as follows: - -
-var leftEye = vrDisplay.getEyeParameters("left");
-var rightEye = vrDisplay.getEyeParameters("right");
-
-canvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;
-canvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);
-
-
- ## VRStageParameters ## {#interface-vrstageparameters} @@ -678,9 +594,9 @@ A user agent MAY dispatch this event type to indicate that something has occured A user agent MAY dispatch this event type to indicate that something has occured which suggests the {{VRDisplay}} should exit presentation. For example, if the {{VRDisplay}} is capable of detecting when the user has taken it off, this event SHOULD fire when they do so with the reason "unmounted". onvrdisplayblur -A user agent MAY dispatch this event type to indicate that presentation to the display by the page is paused by the user agent, OS, or VR hardware. While a {{VRDisplay}} is blurred it does not lose it's presenting status ({{isPresenting}} continues to report true) but {{getFrameData()}} returns false without updating the provided {{VRFrameData}} and {{getPose()}} returns null. This is to prevent tracking while the user interacts with potentially sensitive UI. For example: A user agent SHOULD blur the presenting application when the user is typing a URL into the browser with a virtual keyboard, otherwise the presenting page may be able to guess the URL the user is entering by tracking their head motions. +A user agent MAY dispatch this event type to indicate that presentation to the display by the page is paused by the user agent, OS, or VR hardware. While a {{VRDisplay}} is blurred it does not lose it's presenting status ({{isPresenting}} continues to report true) but {{getFrameData()}} returns false without updating the provided {{VRFrameData}}. This is to prevent tracking while the user interacts with potentially sensitive UI. For example: A user agent SHOULD blur the presenting application when the user is typing a URL into the browser with a virtual keyboard, otherwise the presenting page may be able to guess the URL the user is entering by tracking their head motions. -onvrdisplayfocus +onvrdisplayfocus A user agent MAY dispatch this event type to indicate that presentation to the display by the page has resumed after being blurred. onvrdisplaypresentchange diff --git a/index.html b/index.html index 12f97c3a..6a2cc443 100644 --- a/index.html +++ b/index.html @@ -1421,7 +1421,7 @@

WebVR

-

Editor’s Draft,

+

Editor’s Draft,

This version: @@ -1435,6 +1435,8 @@

(Mozilla)
Participate:
File an issue (open issues) +
Mailing list archive +
W3C’s #webvr IRC

@@ -1482,49 +1484,42 @@

Table of Contents

  1. 2.3.1 Attributes
-
  • 2.4 VREye -
  • 2.5 VRFieldOfView
  • - 2.6 VRPose + 2.4 VRPose
      -
    1. 2.6.1 Attributes +
    2. 2.4.1 Attributes
  • - 2.7 VRFrameData + 2.5 VRFrameData
      -
    1. 2.7.1 Attributes +
    2. 2.5.1 Attributes
  • - 2.8 VREyeParameters + 2.6 VRStageParameters
      -
    1. 2.8.1 Attributes +
    2. 2.6.1 Attributes
  • - 2.9 VRStageParameters + 2.7 Navigator Interface extension
      -
    1. 2.9.1 Attributes +
    2. 2.7.1 Attributes
  • - 2.10 Navigator Interface extension + 2.8 VRDisplayEventReason
      -
    1. 2.10.1 Attributes +
    2. 2.8.1 Reasons
  • - 2.11 VRDisplayEventReason + 2.9 VRDisplayEvent
      -
    1. 2.11.1 Reasons +
    2. 2.9.1 Attributes
    +
  • 2.10 Window Interface extension +
  • 2.11 allowvr iframe attribute
  • - 2.12 VRDisplayEvent + 2.12 Gamepad Interface extension
      -
    1. 2.12.1 Attributes -
    -
  • 2.13 Window Interface extension -
  • 2.14 allowvr iframe attribute -
  • - 2.15 Gamepad Interface extension -
      -
    1. 2.15.1 Attributes +
    2. 2.12.1 Attributes
  • 3 Security Considerations @@ -1574,11 +1569,6 @@

    readonly attribute VRStageParameters? stageParameters; - /** - * Return the current VREyeParameters for the given eye. - */ - VREyeParameters getEyeParameters(VREye whichEye); - /** * An identifier for this distinct VRDisplay. Used as an * association point in the Gamepad API. @@ -1596,16 +1586,6 @@

    boolean getFrameData(VRFrameData frameData); - /** - * Return a VRPose containing the future predicted pose of the VRDisplay - * when the current frame will be presented. The value returned will not - * change until JavaScript has returned control to the browser. - * - * The VRPose will contain the position, orientation, velocity, - * and acceleration of each of these properties. - */ - [NewObject] VRPose getPose(); - /** * Reset the pose for this display, treating its current position and * orientation as the "origin/zero" values. VRPose.position, @@ -1620,14 +1600,34 @@

    attribute double depthNear; + attribute double depthNear; /** * z-depth defining the far plane of the eye view frustum * enables mapping of values in the render target depth * attachment to scene coordinates. Initially set to 10000.0. */ - attribute double depthFar; + attribute double depthFar; + + /** + * Maximum effective width of the VRLayer source, in pixels. + */ + readonly attribute unsigned long maximumRenderWidth; + + /** + * Maximum effective height of the VRLayer source, in pixels. + */ + readonly attribute unsigned long maximumRenderHeight; + + /** + * Recommended width of the VRLayer source, in pixels. + */ + readonly attribute unsigned long recommendedRenderWidth; + + /** + * Recommended height of the VRLayer source, in pixels. + */ + readonly attribute unsigned long recommendedRenderHeight; /** * The callback passed to `requestAnimationFrame` will be called @@ -1677,19 +1677,22 @@

    isConnected The isConnected attribute MUST return the VRDisplay's connected state.

    isPresenting The isPresenting attribute MUST return the VRDisplay's presentation state.

    capabilities The capabilities attribute MUST return the VRDisplay's VRDisplayCapabilities object, a dictionary of capabilities describing the VRDisplay.

    -

    getEyeParameters() Returns the current VREyeParameters for the given eye. The eye parameters MAY change at any time due to external factors, such as the user changing the IPD with hardware controls.

    -

    getFrameData() Populates the provided VRFrameData object with the VRPose and view and projection matricies for the current frame. These values describe the position, orientation, acceleration, and velocity of the VRDisplay that should be used when rendering the next frame of a scene. The User Agent MAY optionally use predictive techniques to estimate what these values will be at the time that the next frame will be displayed to the user. Subsequent calls to getFrameData() MUST provide the same values until the next call to submitFrame(). Returns true if the the provided VRFrameData object was successfully updated, false otherwise.

    -

    getPose() (Deprecated) Returns a VRPose describing the position, orientation, acceleration, and velocity of the VRDisplay that should be used when rendering the next frame of a scene. The User Agent MAY optionally use predictive techniques to estimate what the pose will be at the time that the next frame will be displayed to the user. Subsequent calls to getPose() MUST return a VRPose with the same values until the next call to submitFrame().

    -

    This function is deprecated but is preserved for backwards compatibility. Using it MAY incur warnings from the User Agent. Prefer using getFrameData(), which also provides a VRPose, instead.

    -

    resetPose() Reset the pose for the VRDisplay, treating its current position and orientation as the "origin/zero" values. Future values returned from getFrameData() or getPose() will describe positions relative to the VRDisplay's position when resetPose() was last called and will treat the display’s yaw when resetPose() was last called as the forward orientation. The VRDisplay's reported roll and pitch do not change when resetPose() is called as they are relative to gravity. Calling resetPose() may change the sittingToStandingTransform matrix of the VRStageParameters.

    -

    requestAnimationFrame() Functionally equivalent to window.requestAnimationFrame when the VRDisplay is not presenting. When the VRDisplay is presenting the callback is called at the native refresh rate of the VRDisplay.

    +

    getFrameData() Populates the provided VRFrameData object with the VRPose and view and projection matricies for the current frame. These values describe the position, orientation, acceleration, and velocity of the VRDisplay that should be used when rendering the next frame of a scene. The User Agent MAY optionally use predictive techniques to estimate what these values will be at the time that the next frame will be displayed to the user. Subsequent calls to getFrameData() MUST provide the same values until the next call to submitFrame(). Returns true if the the provided VRFrameData object was successfully updated, false otherwise.

    +

    resetPose() Reset the pose for the VRDisplay, treating its current position and orientation as the "origin/zero" values. Future values returned from getFrameData() will describe positions relative to the VRDisplay's position when resetPose() was last called and will treat the display’s yaw when resetPose() was last called as the forward orientation. The VRDisplay's reported roll and pitch do not change when resetPose() is called as they are relative to gravity. Calling resetPose() may change the sittingToStandingTransform matrix of the VRStageParameters.

    +

    requestAnimationFrame() Functionally equivalent to window.requestAnimationFrame when the VRDisplay is not presenting. When the VRDisplay is presenting the callback is called at the native refresh rate of the VRDisplay.

    cancelAnimationFrame() Passing the value returned by requestAnimationFrame() to will unregister the callback.

    -

    requestPresent() Begins presenting the contents of the specified VRLayer array on the VRDisplay and fulfills the returned promise when presentation has begun. If canPresent is false the promise MUST be rejected. If the VRLayer array contains more than maxLayers elements the promise MUST be rejected. If requestPresent() is called outside of a user gesture the promise MUST be rejected. The user agent MAY reject the promise for any other reason. If the VRDisplay is already presenting when requestPresent() is called the VRDisplay SHOULD update the VRLayer list being presented. If a call to requestPresent() is rejected while the VRDisplay is already presenting the VRDisplay MUST end presentation.

    -

    exitPresent() Ends presentation to the VRDisplay and fulfills the returned promise when fully exited. If the VRDisplay is not presenting the promise MUST be rejected.

    -

    getLayers() Returns an array with the VRLayer currently being presented. MUST return an empty array if the VRDisplay is not currently presenting. If the VRDisplay is presenting MUST return an array containing the VRLayers last passed to requestPresent().

    -

    submitFrame() Captures the current state of the VRLayer currently being presented and displays it on the VRDisplay. It is assumed that the frame was rendered using the VRPose and matrices provided by the last call to getFrameData(). If getFrameData() was not called prior to calling submitFrame() the user agent MAY warn the user of potentially malformed visuals or prevent the frame from being shown at all.

    +

    requestPresent() Begins presenting the contents of the specified VRLayer array on the VRDisplay and fulfills the returned promise when presentation has begun. If canPresent is false the promise MUST be rejected. If the VRLayer array contains more than maxLayers elements the promise MUST be rejected. If requestPresent() is called outside of a user gesture the promise MUST be rejected. The user agent MAY reject the promise for any other reason. If the VRDisplay is already presenting when requestPresent() is called the VRDisplay SHOULD update the VRLayer list being presented. If a call to requestPresent() is rejected while the VRDisplay is already presenting the VRDisplay MUST end presentation.

    +

    exitPresent() Ends presentation to the VRDisplay and fulfills the returned promise when fully exited. If the VRDisplay is not presenting the promise MUST be rejected.

    +

    getLayers() Returns an array with the VRLayer currently being presented. MUST return an empty array if the VRDisplay is not currently presenting. If the VRDisplay is presenting MUST return an array containing the VRLayers last passed to requestPresent().

    +

    submitFrame() Captures the current state of the VRLayer currently being presented and displays it on the VRDisplay. It is assumed that the frame was rendered using the VRPose and matrices provided by the last call to getFrameData(). If getFrameData() was not called prior to calling submitFrame() the user agent MAY warn the user of potentially malformed visuals or prevent the frame from being shown at all.

    +

    depthNear Z-depth defining the near plane of the eye view frustum. Enables mapping of values in the render target depth attachment to scene coordinates. Initially set to 0.01.

    +

    depthFar Z-depth defining the far plane of the eye view frustum. Enables mapping of values in the render target depth attachment to scene coordinates. Initially set to 10000.0.

    +

    maximumRenderWidth Width of the VRLayer source in pixels at which the final image presented to the user will have a 1:1 pixel ratio at the center of the user’s view after any distortion the VRDisplay will apply. Applications should use a VRLayer source with this width to achive maximum quality. The width reported MUST be large enough to contain both the left and right eye viewports in the default side-by-side orientaion.

    +

    maximumRenderHeight Height of the VRLayer source in pixels at which the final image presented to the user will have a 1:1 pixel ratio at the center of the user’s view after any distortion the VRDisplay will apply. Applications should use a VRLayer source with this height to achive maximum quality.

    +

    recommendedRenderWidth Recommended width of the VRLayer source in pixels that will provide a good balance of quality and performance for most applications. The width reported MAY be the same as the maximumRenderWidth or MAY be lower if the underlying platform recommends it for performance reasons. The width reported MUST be large enough to contain both the left and right eye viewports in the default side-by-side orientaion.

    +

    recommendedRenderHeight Recommended height of the VRLayer source in pixels that will provide a good balance of quality and performance for most applications. The height reported MAY be the same as the maximumRenderHeight or MAY be lower if the underlying platform recommends it for performance reasons.

    - The following code demonstrates presenting a simple rendering loop to a VRDisplay. + The following code demonstrates presenting a simple rendering loop to a VRDisplay.
    var frameData = new VRFrameData();
     
     // Render a single frame of VR data.
    @@ -1725,7 +1728,7 @@ 

    2.2. VRLayer

    -

    The VRLayer interface is provided to a VRDisplay and presented in the HMD.

    +

    The VRLayer interface is provided to a VRDisplay and presented in the HMD.

    typedef (HTMLCanvasElement or
              OffscreenCanvas) VRSource;
     
    @@ -1737,11 +1740,11 @@ 

    2.2.1. Attributes

    -

    source The source attribute defines the canvas whose contents will be presented by the VRDisplay when VRDisplay.submitFrame() is called.

    +

    source The source attribute defines the canvas whose contents will be presented by the VRDisplay when VRDisplay.submitFrame() is called.

    leftBounds The leftBounds attribute contains four values defining the texture bounds within the source canvas to present to the eye in UV space: [0] left offset of the bounds (0.0 - 1.0); [1] top offset of the bounds (0.0 - 1.0); [2] width of the bounds (0.0 - 1.0); [3] height of the bounds (0.0 - 1.0). The leftBounds MUST default to [0.0, 0.0, 0.5, 1.0].

    rightBounds The rightBounds attribute contains four values defining the texture bounds rectangle within the source canvas to present to the eye in UV space: [0] left offset of the bounds (0.0 - 1.0); [1] top offset of the bounds (0.0 - 1.0); [2] width of the bounds (0.0 - 1.0); [3] height of the bounds (0.0 - 1.0). The rightBounds MUST default to [0.5, 0.0, 0.5, 1.0].

    2.3. VRDisplayCapabilities

    -

    The VRDisplayCapabilities interface describes the capabilities of a VRDisplay. These are expected to be static per-device/per-user.

    +

    The VRDisplayCapabilities interface describes the capabilities of a VRDisplay. These are expected to be static per-device/per-user.

    interface VRDisplayCapabilities {
       readonly attribute boolean hasPosition;
       readonly attribute boolean hasOrientation;
    @@ -1751,29 +1754,14 @@ 

    2.3.1. Attributes

    -

    hasPosition The hasPosition attribute MUST return whether the VRDisplay is capable of tracking its position.

    -

    hasOrientation The hasOrientation attribute MUST return whether the VRDisplay is capable of tracking its orientation.

    -

    hasExternalDisplay The hasExternalDisplay attribute MUST return whether the VRDisplay is separate from the device’s primary display. If presenting VR content will obscure other content on the device, this should be false. When false, the application should not attempt to mirror VR content or update non-VR UI because that content will not be visible.

    -

    canPresent The canPresent attribute MUST return whether the VRDisplay is capable of presenting content to an HMD or similar device. Can be used to indicate "magic window" devices that are capable of 6DoF tracking but for which VRDisplay.requestPresent() is not meaningful. If false then calls to VRDisplay.requestPresent() should always fail, and VRDisplay.getEyeParameters() should return null.

    +

    hasPosition The hasPosition attribute MUST return whether the VRDisplay is capable of tracking its position.

    +

    hasOrientation The hasOrientation attribute MUST return whether the VRDisplay is capable of tracking its orientation.

    +

    hasExternalDisplay The hasExternalDisplay attribute MUST return whether the VRDisplay is separate from the device’s primary display. If presenting VR content will obscure other content on the device, this should be false. When false, the application should not attempt to mirror VR content or update non-VR UI because that content will not be visible.

    +

    canPresent The canPresent attribute MUST return whether the VRDisplay is capable of presenting content to an HMD or similar device. Can be used to indicate "magic window" devices that are capable of 6DoF tracking but for which VRDisplay.requestPresent() is not meaningful. If false then calls to VRDisplay.requestPresent() should always fail.

    maxLayers Indicates the maximum length of the array that requestPresent() will accept. MUST be 1 if canPresent is true, 0 otherwise.

    Note: Future revisions of this spec may allow multiple layers to enable more complex rendering effects such as compositing WebGL and DOM elements together. That functionality is not allowed by this revision of the spec.

    -

    2.4. VREye

    -
    enum VREye {
    -  "left",
    -  "right"
    -};
    -
    -

    2.5. VRFieldOfView

    -

    (Deprecated) The VRFieldOfView interface represents a field of view, as given by 4 degrees describing the view from a center point.

    -
    interface VRFieldOfView {
    -  readonly attribute double upDegrees;
    -  readonly attribute double rightDegrees;
    -  readonly attribute double downDegrees;
    -  readonly attribute double leftDegrees;
    -};
    -
    -

    2.6. VRPose

    -

    The VRPose interface represents a sensor’s state at a given timestamp.

    +

    2.4. VRPose

    +

    The VRPose interface describes a position, orientation, and motion in space.

    interface VRPose {
       readonly attribute Float32Array? position;
       readonly attribute Float32Array? linearVelocity;
    @@ -1782,9 +1770,11 @@ 

    readonly attribute Float32Array? orientation; readonly attribute Float32Array? angularVelocity; readonly attribute Float32Array? angularAcceleration; + + readonly attribute Float32Array poseMatrix; };

    -

    2.6.1. Attributes

    +

    2.4.1. Attributes

    position Position of the VRDisplay as a 3D vector. Position is given in meters from an origin point, which is either the position the sensor was first read at or the position of the sensor at the point that resetPose() was last called. @@ -1820,103 +1810,39 @@

    angularAcceleration Angular acceleration of the sensor given in radians per second squared. MAY be null if the sensor is incapable of providing angular acceleration. When not null MUST be a three-element array.

    -
    - The following code snippet creates a WebGL-compatible matrix from a VRPose: -
    function poseToMatrix (pose) {
    -    var out = new Float32Array(16);
    -
    -    // If the orientation or position are null, provide defaults.
    -    var q = pose.orientation ? pose.orientation : [0, 0, 0, 1];
    -    var v = pose.position ? pose.position : [0, 0, 0];
    -
    -    // Compute some values for the quaternion math.
    -    var x2 = q[0] + q[0];
    -    var y2 = q[1] + q[1];
    -    var z2 = q[2] + q[2];
    -
    -    var xx = q[0] * x2;
    -    var xy = q[0] * y2;
    -    var xz = q[0] * z2;
    -    var yy = q[1] * y2;
    -    var yz = q[1] * z2;
    -    var zz = q[2] * z2;
    -    var wx = q[3] * x2;
    -    var wy = q[3] * y2;
    -    var wz = q[3] * z2;
    -
    -    out[0] = 1 - (yy + zz);
    -    out[1] = xy + wz;
    -    out[2] = xz - wy;
    -    out[3] = 0;
    -    out[4] = xy - wz;
    -    out[5] = 1 - (xx + zz);
    -    out[6] = yz + wx;
    -    out[7] = 0;
    -    out[8] = xz + wy;
    -    out[9] = yz - wx;
    -    out[10] = 1 - (xx + yy);
    -    out[11] = 0;
    -    out[12] = v[0];
    -    out[13] = v[1];
    -    out[14] = v[2];
    -    out[15] = 1;
    -
    -    return out;
    -}
    -
    -
    -

    2.7. VRFrameData

    +

    poseMatrix A 4x4 matrix describing the tranform defined by the position and orientation of +the pose, given as a 16 element array in column major order.

    +

    2.5. VRFrameData

    The VRFrameData interface represents all the information needed to render a single frame of a VR scene.

    [Constructor]
     interface VRFrameData {
       readonly attribute DOMHighResTimeStamp timestamp;
     
       readonly attribute Float32Array leftProjectionMatrix;
    +  readonly attribute Float32Array leftPoseToEyeMatrix;
       readonly attribute Float32Array leftViewMatrix;
     
       readonly attribute Float32Array rightProjectionMatrix;
    +  readonly attribute Float32Array rightPoseToEyeMatrix;
       readonly attribute Float32Array rightViewMatrix;
     
    -  readonly attribute VRPose pose;
    +  readonly attribute VRPose pose;
     };
     
    -

    2.7.1. Attributes

    +

    2.5.1. Attributes

    timestamp Monotonically increasing value that allows the author to determine if position state data been updated from the hardware. Since values are monotonically increasing, they can be compared to determine the ordering of updates, as newer values will always be greater than or equal to older values. The timestamp -starts at 0 the first time getFrameData() is invoked for a given VRDisplay.

    +starts at 0 the first time getFrameData() is invoked for a given VRDisplay.

    leftProjectionMatrix A 4x4 matrix describing the projection to be used for the left eye’s rendering, given as a 16 element array in column major order. This value may be passed directly to WebGL’s uniformMatrix4fv function. It is highly recommended that applications use this matrix without modification. Failure to use this projection matrix when rendering may cause the presented frame to be distorted or badly aligned, resulting in varying degrees of user discomfort.

    +

    leftPoseToEyeMatrix A 4x4 matrix describing the view transform from the pose to the left eye, given as a 16 element array in column major order.

    leftViewMatrix A 4x4 matrix describing the view transform to be used for the left eye’s rendering, given as a 16 element array in column major order. Represents the inverse of the model matrix of the left eye in sitting space. This value may be passed directly to WebGL’s uniformMatrix4fv function. It is highly recommended that applications use this matrix when rendering.

    rightProjectionMatrix A 4x4 matrix describing the projection to be used for the right eye’s rendering, given as a 16 element array in column major order. This value may be passed directly to WebGL’s uniformMatrix4fv function. It is highly recommended that applications use this matrix without modification. Failure to use this projection matrix when rendering may cause the presented frame to be distorted or badly aligned, resulting in varying degrees of user discomfort.

    +

    rightPoseToEyeMatrix A 4x4 matrix describing the view transform from the pose to the right eye, given as a 16 element array in column major order.

    rightViewMatrix A 4x4 matrix describing the view transform to be used for the right eye’s rendering, given as a 16 element array in column major order. Represents the inverse of the model matrix of the right eye in sitting space. This value may be passed directly to WebGL’s uniformMatrix4fv function. It is highly recommended that applications use this matrix when rendering.

    -

    pose The VRPose of the VRDisplay at timestamp.

    -

    2.8. VREyeParameters

    -

    The VREyeParameters interface represents all the information required to correctly render a scene for a given eye.

    -
    interface VREyeParameters {
    -  readonly attribute Float32Array offset;
    -
    -  [SameObject] readonly attribute VRFieldOfView fieldOfView;
    -
    -  readonly attribute unsigned long renderWidth;
    -  readonly attribute unsigned long renderHeight;
    -};
    -
    -

    2.8.1. Attributes

    -

    offset Offset from the center point between the users eyes to the center of the eye in meters. This value SHOULD represent half of the user’s interpupillary distance (IPD), but MAY also represent the distance from the center point of the headset to the center point of the lens for the given eye. Values for the left eye MUST be negative; values for the right eye MUST be positive. This information should not be used to construct a view matrix, prefer using the view matricies provided in VRFrameData instead.

    -

    fieldOfView (Deprecated) The current field of view for the eye. SHOULD conservatively cover the entire viewable frustum of the eye. The application should not use these values to construct a projection matrix, as it may not take into account all aspects of the VRDisplay optics. Prefer using the projection matrices provided in VRFrameData instead.

    -

    renderWidth Describes the recommended render target width of each eye viewport, in pixels. If multiple eyes are rendered in a single render target, then the render target should be made large enough to fit both viewports. The renderWidth for the left eye and right eye MUST NOT overlap, and the renderWidth for the right eye MUST be to the right of the renderWidth for the left eye.

    -

    renderHeight Describes the recommended render target height of each eye viewport, in pixels. If multiple eyes are rendered in a single render target, then the render target should be made large enough to fit both viewports. The renderWidth for the left eye and right eye MUST NOT overlap, and the renderWidth for the right eye MUST be to the right of the renderWidth for the left eye.

    -
    - Many HMDs will distort the rendered image to counteract undesired effects introduced by the headset optics. Because of this the optimal resolution of the canvas will often be larger than the HMD’s physical resolution to ensure that the final image presented to the user has a 1:1 pixel ratio at the center of the user’s view. The optimal canvas resolution can be calculated from the renderWidth and renderHeight for both eyes as follows: -
    var leftEye = vrDisplay.getEyeParameters("left");
    -var rightEye = vrDisplay.getEyeParameters("right");
    -
    -canvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;
    -canvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);
    -
    -
    -

    2.9. VRStageParameters

    +

    pose The VRPose of the VRDisplay at timestamp.

    +

    2.6. VRStageParameters

    The VRStageParameters interface represents the values describing the the stage/play area for devices that support room-scale experiences.

    interface VRStageParameters {
       readonly attribute Float32Array sittingToStandingTransform;
    @@ -1925,23 +1851,23 @@ 

    readonly attribute float sizeZ; };

    -

    2.9.1. Attributes

    -

    sittingToStandingTransform The sittingToStandingTransform attribute is a 16-element array containing the components of a 4x4 affine transformation matrix in column-major order. This matrix transforms the sitting-space view matrices of VRFrameData to standing-space. Multiplying the inverse of this matrix with the leftViewMatrix or rightViewMatrix will result in a standing space view matrix for the respective eye.

    +

    2.6.1. Attributes

    +

    sittingToStandingTransform The sittingToStandingTransform attribute is a 16-element array containing the components of a 4x4 affine transformation matrix in column-major order. This matrix transforms the sitting-space view matrices of VRFrameData to standing-space. Multiplying the inverse of this matrix with the leftViewMatrix or rightViewMatrix will result in a standing space view matrix for the respective eye.

    sizeX Width of the play-area bounds in meters. The bounds are defined as an axis-aligned rectangle on the floor. The center of the rectangle is at (0,0,0) in standing-space coordinates. These bounds are defined for safety purposes. Content should not require the user to move beyond these bounds; however, it is possible for the user to ignore the bounds resulting in position values outside of this rectangle.

    sizeZ Depth of the play-area bounds in meters. The bounds are defined as an axis-aligned rectangle on the floor. The center of the rectangle is at (0,0,0) in standing-space coordinates. These bounds are defined for safety purposes. Content should not require the user to move beyond these bounds; however, it is possible for the user to ignore the bounds resulting in position values outside of this rectangle.

    -

    2.10. Navigator Interface extension

    +

    2.7. Navigator Interface extension

    partial interface Navigator {
    -  Promise<sequence<VRDisplay>> getVRDisplays();
    -  readonly attribute FrozenArray<VRDisplay> activeVRDisplays;
    +  Promise<sequence<VRDisplay>> getVRDisplays();
    +  readonly attribute FrozenArray<VRDisplay> activeVRDisplays;
       readonly attribute boolean vrEnabled;
     };
     
    - -

    getVRDisplays() Return a Promise which resolves to a list of available VRDisplays. The Promise MUST be rejected if the Document object is inside an iframe that does not have the allowvr attribute set.

    -

    activeVRDisplays activeVRDisplays includes every VRDisplay that is currently presenting.

    + +

    getVRDisplays() Return a Promise which resolves to a list of available VRDisplays. The Promise MUST be rejected if the Document object is inside an iframe that does not have the allowvr attribute set.

    +

    activeVRDisplays activeVRDisplays includes every VRDisplay that is currently presenting.

    vrEnabled The vrEnabled attribute’s getter must return true if the context object is allowed to use the feature indicated by attribute name allowvr and VR is supported, and false otherwise.

    - The following code finds the first available VRDisplay. + The following code finds the first available VRDisplay.
    var vrDisplay;
     
     navigator.getVRDisplays().then(function (displays) {
    @@ -1954,7 +1880,7 @@ 
    -

    2.11. VRDisplayEventReason

    +

    2.8. VRDisplayEventReason

    enum VRDisplayEventReason {
       "navigation",
       "mounted",
    @@ -1962,27 +1888,27 @@ 

    "unmounted" };

    -

    2.11.1. Reasons

    +

    2.8.1. Reasons

    navigation The page has been navigated to from a context that allows this page to begin presenting immediately, such as from another site that was already in VR presentation mode.

    -

    mounted The VRDisplay has detected that the user has put it on.

    +

    mounted The VRDisplay has detected that the user has put it on.

    requested The user agent MAY request start VR presentation mode. This allows user agents to include a consistent UI to enter VR across diferent sites.

    -

    unmounted The VRDisplay has detected that the user has taken it off.

    -

    2.12. VRDisplayEvent

    -
    [Constructor(VRDisplayEventInit eventInitDict)]
    +   

    unmounted The VRDisplay has detected that the user has taken it off.

    +

    2.9. VRDisplayEvent

    +
    [Constructor(DOMString type, VRDisplayEventInit eventInitDict)]
     interface VRDisplayEvent : Event {
    -  readonly attribute VRDisplay display;
    +  readonly attribute VRDisplay display;
       readonly attribute VRDisplayEventReason? reason;
     };
     
     dictionary VRDisplayEventInit : EventInit {
    -  required VRDisplay display;
    +  required VRDisplay display;
       VRDisplayEventReason reason;
     };
     
    -

    2.12.1. Attributes

    -

    display The VRDisplay associated with this event.

    +

    2.9.1. Attributes

    +

    display The VRDisplay associated with this event.

    reason VRDisplayEventReason describing why this event has has been fired.

    -

    2.13. Window Interface extension

    +

    2.10. Window Interface extension

    partial interface Window {
       attribute EventHandler onvrdisplayconnect;
       attribute EventHandler onvrdisplaydisconnect;
    @@ -1994,19 +1920,19 @@ 

    User agents implementing this specification MUST provide the following new DOM events. The corresponding events must be of type VRDisplayEvent and must fire on the window object. Registration for and firing of the events must follow the usual behavior of DOM4 Events.

    -

    onvrdisplayconnect A user agent MAY dispatch this event type to indicate that a VRDisplay has been connected.

    -

    onvrdisplaydisconnect A user agent MAY dispatch this event type to indicate that a VRDisplay has been disconnected.

    -

    onvrdisplayactivate A user agent MAY dispatch this event type to indicate that something has occured which suggests the VRDisplay should be presented to. For example, if the VRDisplay is capable of detecting when the user has put it on, this event SHOULD fire when they do so with the reason "mounted".

    -

    onvrdisplaydeactivate A user agent MAY dispatch this event type to indicate that something has occured which suggests the VRDisplay should exit presentation. For example, if the VRDisplay is capable of detecting when the user has taken it off, this event SHOULD fire when they do so with the reason "unmounted".

    -

    onvrdisplayblur A user agent MAY dispatch this event type to indicate that presentation to the display by the page is paused by the user agent, OS, or VR hardware. While a VRDisplay is blurred it does not lose it’s presenting status (isPresenting continues to report true) but getFrameData() returns false without updating the provided VRFrameData and getPose() returns null. This is to prevent tracking while the user interacts with potentially sensitive UI. For example: A user agent SHOULD blur the presenting application when the user is typing a URL into the browser with a virtual keyboard, otherwise the presenting page may be able to guess the URL the user is entering by tracking their head motions.

    -

    onvrdisplayfocus A user agent MAY dispatch this event type to indicate that presentation to the display by the page has resumed after being blurred.

    -

    onvrdisplaypresentchange A user agent MUST dispatch this event type to indicate that a VRDisplay has begun or ended VR presentation. This event should not fire on subsequent calls to requestPresent() after the VRDisplay has already begun VR presentation.

    -

    2.14. allowvr iframe attribute

    +

    onvrdisplayconnect A user agent MAY dispatch this event type to indicate that a VRDisplay has been connected.

    +

    onvrdisplaydisconnect A user agent MAY dispatch this event type to indicate that a VRDisplay has been disconnected.

    +

    onvrdisplayactivate A user agent MAY dispatch this event type to indicate that something has occured which suggests the VRDisplay should be presented to. For example, if the VRDisplay is capable of detecting when the user has put it on, this event SHOULD fire when they do so with the reason "mounted".

    +

    onvrdisplaydeactivate A user agent MAY dispatch this event type to indicate that something has occured which suggests the VRDisplay should exit presentation. For example, if the VRDisplay is capable of detecting when the user has taken it off, this event SHOULD fire when they do so with the reason "unmounted".

    +

    onvrdisplayblur A user agent MAY dispatch this event type to indicate that presentation to the display by the page is paused by the user agent, OS, or VR hardware. While a VRDisplay is blurred it does not lose it’s presenting status (isPresenting continues to report true) but getFrameData() returns false without updating the provided VRFrameData. This is to prevent tracking while the user interacts with potentially sensitive UI. For example: A user agent SHOULD blur the presenting application when the user is typing a URL into the browser with a virtual keyboard, otherwise the presenting page may be able to guess the URL the user is entering by tracking their head motions.

    +

    onvrdisplayfocus A user agent MAY dispatch this event type to indicate that presentation to the display by the page has resumed after being blurred.

    +

    onvrdisplaypresentchange A user agent MUST dispatch this event type to indicate that a VRDisplay has begun or ended VR presentation. This event should not fire on subsequent calls to requestPresent() after the VRDisplay has already begun VR presentation.

    +

    2.11. allowvr iframe attribute

    partial interface HTMLIFrameElement {
       attribute boolean allowvr;
     };
     
    -

    The allowvr attribute is a boolean attribute. When specified, it indicates that Document objects in the iframe element’s browsing context are to be allowed to access VR devices (if it’s not blocked for other reasons, e.g. there is another ancestor iframe without this attribute set). Document objects in an iframe element without this attribute should reject calls to getVRDisplays() and should not fire any VRDisplayEvent.

    +

    The allowvr attribute is a boolean attribute. When specified, it indicates that Document objects in the iframe element’s browsing context are to be allowed to access VR devices (if it’s not blocked for other reasons, e.g. there is another ancestor iframe without this attribute set). Document objects in an iframe element without this attribute should reject calls to getVRDisplays() and should not fire any VRDisplayEvent.

    Example of declaring an iframe that is allowed to access VR features.
    <body>
    @@ -2015,18 +1941,18 @@ 

    </body>

    -

    2.15. Gamepad Interface extension

    +

    2.12. Gamepad Interface extension

    partial interface Gamepad {
       readonly attribute unsigned long displayId;
     };
     
    -

    2.15.1. Attributes

    -

    displayId Return the displayId of the VRDisplay this Gamepad is associated with. A Gamepad is considered to be associated with a VRDisplay if it reports a pose that is in the same space as the VRDisplay pose. If the Gamepad is not associated with a VRDisplay should return 0.

    +

    2.12.1. Attributes

    +

    displayId Return the displayId of the VRDisplay this Gamepad is associated with. A Gamepad is considered to be associated with a VRDisplay if it reports a pose that is in the same space as the VRDisplay pose. If the Gamepad is not associated with a VRDisplay should return 0.

    3. Security Considerations

    While not directly affecting the API interface and Web IDL, WebVR implementations should maintain the user’s expectations of privacy, security, and comfort on the Web by adhering to the following guidelines:

    • -

      Trusted UI must be drawn by an independent rendering context who’s state is isolated from that of the WebGL contexts provided as a VRLayer source to a VRDisplay.

      +

      Trusted UI must be drawn by an independent rendering context who’s state is isolated from that of the WebGL contexts provided as a VRLayer source to a VRDisplay.

    • A "VR Compositor" runs asynchronously from content, responsible for compositing the trusted and untrusted content. If content is not performant or does not submit frames, or terminates unexpectedly the browser should be able to continue presenting a responsive front-end.

    • @@ -2034,13 +1960,13 @@

      3.
    • When navigating between pages in VR the browser should display trusted UI elements informing the user of the security information of the site they are navigating to which is normally presented by the 2D UI, such as the URL and encryption status.

    • -

      The VRDisplay pose and other VR inputs are only updated for the focused page.

      +

      The VRDisplay pose and other VR inputs are only updated for the focused page.

    • The Gamepad API will be updated such that the gamepad inputs are only updated for the focused page.

    • -

      Non-focused tabs are allowed to enumerate Gamepads and VRDisplays but will see last received state or default values.

      +

      Non-focused tabs are allowed to enumerate Gamepads and VRDisplays but will see last received state or default values.

    • -

      To prevent CORS-related vulnerabilities, each page will see a new instance of objects returned by the WebVR API, such as VRDisplay. Attributes such as the VRLayer.source set by one page must not be able to be read by another.

      +

      To prevent CORS-related vulnerabilities, each page will see a new instance of objects returned by the WebVR API, such as VRDisplay. Attributes such as the VRLayer.source set by one page must not be able to be read by another.

    4. Acknowledgements

    @@ -2193,141 +2119,136 @@

    Index

    Terms defined by this specification

    Terms defined by reference

    @@ -2363,8 +2283,8 @@

    N
    Ian Hickson. HTML Standard. Living Standard. URL: https://html.spec.whatwg.org/multipage/
    [RFC2119]
    S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119 -
    [WebIDL-1] -
    Cameron McCormack; Boris Zbarsky. WebIDL Level 1. 15 September 2016. PR. URL: https://heycam.github.io/webidl/ +
    [WebIDL] +
    Cameron McCormack; Boris Zbarsky; Tobie Langel. Web IDL. URL: https://heycam.github.io/webidl/
    [WHATWG-DOM]
    Anne van Kesteren. DOM Standard. Living Standard. URL: https://dom.spec.whatwg.org/ @@ -2389,11 +2309,6 @@

    I */ readonly attribute VRStageParameters? stageParameters; - /** - * Return the current VREyeParameters for the given eye. - */ - VREyeParameters getEyeParameters(VREye whichEye); - /** * An identifier for this distinct VRDisplay. Used as an * association point in the Gamepad API. @@ -2411,16 +2326,6 @@

    I */ boolean getFrameData(VRFrameData frameData); - /** - * Return a VRPose containing the future predicted pose of the VRDisplay - * when the current frame will be presented. The value returned will not - * change until JavaScript has returned control to the browser. - * - * The VRPose will contain the position, orientation, velocity, - * and acceleration of each of these properties. - */ - [NewObject] VRPose getPose(); - /** * Reset the pose for this display, treating its current position and * orientation as the "origin/zero" values. VRPose.position, @@ -2435,14 +2340,34 @@

    I * enables mapping of values in the render target depth * attachment to scene coordinates. Initially set to 0.01. */ - attribute double depthNear; + attribute double depthNear; /** * z-depth defining the far plane of the eye view frustum * enables mapping of values in the render target depth * attachment to scene coordinates. Initially set to 10000.0. */ - attribute double depthFar; + attribute double depthFar; + + /** + * Maximum effective width of the VRLayer source, in pixels. + */ + readonly attribute unsigned long maximumRenderWidth; + + /** + * Maximum effective height of the VRLayer source, in pixels. + */ + readonly attribute unsigned long maximumRenderHeight; + + /** + * Recommended width of the VRLayer source, in pixels. + */ + readonly attribute unsigned long recommendedRenderWidth; + + /** + * Recommended height of the VRLayer source, in pixels. + */ + readonly attribute unsigned long recommendedRenderHeight; /** * The callback passed to `requestAnimationFrame` will be called @@ -2506,18 +2431,6 @@

    I readonly attribute unsigned long maxLayers; }; -enum VREye { - "left", - "right" -}; - -interface VRFieldOfView { - readonly attribute double upDegrees; - readonly attribute double rightDegrees; - readonly attribute double downDegrees; - readonly attribute double leftDegrees; -}; - interface VRPose { readonly attribute Float32Array? position; readonly attribute Float32Array? linearVelocity; @@ -2526,6 +2439,8 @@

    I readonly attribute Float32Array? orientation; readonly attribute Float32Array? angularVelocity; readonly attribute Float32Array? angularAcceleration; + + readonly attribute Float32Array poseMatrix; }; [Constructor] @@ -2533,23 +2448,16 @@

    I readonly attribute DOMHighResTimeStamp timestamp; readonly attribute Float32Array leftProjectionMatrix; + readonly attribute Float32Array leftPoseToEyeMatrix; readonly attribute Float32Array leftViewMatrix; readonly attribute Float32Array rightProjectionMatrix; + readonly attribute Float32Array rightPoseToEyeMatrix; readonly attribute Float32Array rightViewMatrix; readonly attribute VRPose pose; }; -interface VREyeParameters { - readonly attribute Float32Array offset; - - [SameObject] readonly attribute VRFieldOfView fieldOfView; - - readonly attribute unsigned long renderWidth; - readonly attribute unsigned long renderHeight; -}; - interface VRStageParameters { readonly attribute Float32Array sittingToStandingTransform; @@ -2570,7 +2478,7 @@

    I "unmounted" }; -[Constructor(VRDisplayEventInit eventInitDict)] +[Constructor(DOMString type, VRDisplayEventInit eventInitDict)] interface VRDisplayEvent : Event { readonly attribute VRDisplay display; readonly attribute VRDisplayEventReason? reason; @@ -2604,28 +2512,27 @@

    I #vrdisplayReferenced in: - - + + + + + + - - + + - - - - -