tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

webvr.tentative.idl (6099B)


      1 // Archived version of the WebVR spec from
      2 // https://w3c.github.io/webvr/archive/prerelease/1.1/index.html
      3 
      4 [Exposed=Window]
      5 interface VRDisplay : EventTarget {
      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   * z-depth defining the near plane of the eye view frustum
     48   * enables mapping of values in the render target depth
     49   * attachment to scene coordinates. Initially set to 0.01.
     50   */
     51  attribute double depthNear;
     52 
     53  /**
     54   * z-depth defining the far plane of the eye view frustum
     55   * enables mapping of values in the render target depth
     56   * attachment to scene coordinates. Initially set to 10000.0.
     57   */
     58  attribute double depthFar;
     59 
     60  /**
     61   * The callback passed to `requestAnimationFrame` will be called
     62   * any time a new frame should be rendered. When the VRDisplay is
     63   * presenting the callback will be called at the native refresh
     64   * rate of the HMD. When not presenting this function acts
     65   * identically to how window.requestAnimationFrame acts. Content should
     66   * make no assumptions of frame rate or vsync behavior as the HMD runs
     67   * asynchronously from other displays and at differing refresh rates.
     68   */
     69  long requestAnimationFrame(FrameRequestCallback callback);
     70 
     71  /**
     72   * Passing the value returned by `requestAnimationFrame` to
     73   * `cancelAnimationFrame` will unregister the callback.
     74   */
     75  undefined cancelAnimationFrame(long handle);
     76 
     77  /**
     78   * Begin presenting to the VRDisplay. Must be called in response to a user gesture.
     79   * Repeat calls while already presenting will update the layers being displayed.
     80   * 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
     81   * If the source of any of the layers is not present (null), the promise is rejected.
     82   */
     83  Promise<undefined> requestPresent(sequence<VRLayerInit> layers);
     84 
     85  /**
     86   * Stops presenting to the VRDisplay.
     87   */
     88  Promise<undefined> exitPresent();
     89 
     90  /**
     91   * Get the layers currently being presented.
     92   */
     93  sequence<VRLayerInit> getLayers();
     94 
     95  /**
     96   * The layer provided to the VRDisplay will be captured and presented
     97   * in the HMD. Calling this function has the same effect on the source
     98   * canvas as any other operation that uses its source image, and canvases
     99   * created without preserveDrawingBuffer set to true will be cleared.
    100   */
    101  undefined submitFrame();
    102 };
    103 
    104 typedef (HTMLCanvasElement or
    105         OffscreenCanvas) VRSource;
    106 
    107 dictionary VRLayerInit {
    108  VRSource? source = null;
    109 
    110  sequence<float> leftBounds = [];
    111  sequence<float> rightBounds = [];
    112 };
    113 
    114 [Exposed=Window]
    115 interface VRDisplayCapabilities {
    116  readonly attribute boolean hasPosition;
    117  readonly attribute boolean hasExternalDisplay;
    118  readonly attribute boolean canPresent;
    119  readonly attribute unsigned long maxLayers;
    120 };
    121 
    122 enum VREye {
    123  "left",
    124  "right"
    125 };
    126 
    127 [Exposed=Window]
    128 interface VRPose {
    129  readonly attribute Float32Array? position;
    130  readonly attribute Float32Array? linearVelocity;
    131  readonly attribute Float32Array? linearAcceleration;
    132 
    133  readonly attribute Float32Array? orientation;
    134  readonly attribute Float32Array? angularVelocity;
    135  readonly attribute Float32Array? angularAcceleration;
    136 };
    137 
    138 [Exposed=Window]
    139 interface VRFrameData {
    140  constructor();
    141 
    142  readonly attribute Float32Array leftProjectionMatrix;
    143  readonly attribute Float32Array leftViewMatrix;
    144 
    145  readonly attribute Float32Array rightProjectionMatrix;
    146  readonly attribute Float32Array rightViewMatrix;
    147 
    148  readonly attribute VRPose pose;
    149 };
    150 
    151 [Exposed=Window]
    152 interface VREyeParameters {
    153  readonly attribute Float32Array offset;
    154 
    155  readonly attribute unsigned long renderWidth;
    156  readonly attribute unsigned long renderHeight;
    157 };
    158 
    159 [Exposed=Window]
    160 interface VRStageParameters {
    161  readonly attribute Float32Array sittingToStandingTransform;
    162 
    163  readonly attribute float sizeX;
    164  readonly attribute float sizeZ;
    165 };
    166 
    167 partial interface Navigator {
    168  Promise<sequence<VRDisplay>> getVRDisplays();
    169  readonly attribute FrozenArray<VRDisplay> activeVRDisplays;
    170  readonly attribute boolean vrEnabled;
    171 };
    172 
    173 enum VRDisplayEventReason {
    174  "mounted",
    175  "navigation",
    176  "requested",
    177  "unmounted"
    178 };
    179 
    180 [Exposed=Window]
    181 interface VRDisplayEvent : Event {
    182  constructor(DOMString type, VRDisplayEventInit eventInitDict);
    183  readonly attribute VRDisplay display;
    184  readonly attribute VRDisplayEventReason? reason;
    185 };
    186 
    187 dictionary VRDisplayEventInit : EventInit {
    188  required VRDisplay display;
    189  VRDisplayEventReason reason;
    190 };
    191 
    192 partial interface Window {
    193  attribute EventHandler onvrdisplayconnect;
    194  attribute EventHandler onvrdisplaydisconnect;
    195  attribute EventHandler onvrdisplayactivate;
    196  attribute EventHandler onvrdisplaydeactivate;
    197  attribute EventHandler onvrdisplayblur;
    198  attribute EventHandler onvrdisplayfocus;
    199  attribute EventHandler onvrdisplaypresentchange;
    200 };
    201 
    202 partial interface Gamepad {
    203  readonly attribute unsigned long displayId;
    204 };