Skip to content

Commit a5866cc

Browse files
authored
Update Depth Extensions for newly available methods/properties (#88)
1 parent 379c235 commit a5866cc

File tree

1 file changed

+65
-18
lines changed

1 file changed

+65
-18
lines changed

index.bs

Lines changed: 65 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,34 @@ spec:infra;
2323
type:dfn; text:string
2424
type:dfn; text:list
2525
type:dfn; for:list; text:extend
26-
spec:webxr-1;
27-
type:event; text:reset
26+
</pre>
27+
28+
<pre class="anchors">
29+
spec: WebXR Device API - Level 1; urlPrefix: https://www.w3.org/TR/webxr/#
30+
type:event; text:reset; url: eventdef-xrreferencespace-reset
2831
type:dfn; text:xr device
29-
type:dfn; for: XRBoundedReferenceSpace; text:native bounds geometry
30-
type:dfn; for: XRSpace; text:native origin
3132
type:dfn; text:viewer
32-
type:dfn; text:view
33-
type:dfn; text:view offset
34-
type:dfn; for:view; text:eye
35-
type:dfn; for:view; text:projection matrix
3633
type:dfn; text:xr animation frame
3734
type:dfn; text:capable of supporting
3835
type:dfn; text:list of supported modes
39-
type:dfn; text:list of animation frame callbacks
4036
type:dfn; text:inline xr device
4137
type:dfn; text:list of immersive xr devices
4238
type:dfn; text:primary action
4339
type:dfn; text:primary squeeze action
4440
type:dfn; text:xr input source
45-
</pre>
46-
47-
<pre class="anchors">
41+
type:dfn; text:view; url: view
42+
for: view;
43+
type:dfn; text:eye; url: view-eye
44+
for: XRBoundedReferenceSpace;
45+
type:dfn; text:native bounds geometry; url: xrboundedreferencespace-native-bounds-geometry
46+
for: XRSpace;
47+
type:dfn; text:native origin; url: xrspace-native-origin
48+
type: interface; text: XRViewGeometry; url: xrviewgeometry-mixin
49+
type: dfn; text: view geometry; url: view-geometry
50+
for: view geometry;
51+
type: dfn; text: containing object; url: view-geometry-containing-object
52+
type: dfn; text: projection matrix; url: view-geometry-projection-matrix
53+
type: dfn; text: view offset; url: view-geometry-view-offset
4854
spec: Gamepad; urlPrefix: https://www.w3.org/TR/gamepad/#
4955
type: enum-value; text: "xr-standard"; for: GamepadMappingType; url: dfn-xr-standard
5056
spec:webxr-dom-overlays; urlPrefix: https://immersive-web.github.io/dom-overlays#
@@ -60,6 +66,11 @@ spec: WebXR Depth Sensing Module; urlPrefix: https://immersive-web.github.io/dep
6066
type: dfn; text: create a GPU depth information instance; url: create-a-gpu-depth-information-instance
6167
type: dfn; text: depth coordinates transformation matrix; url: depth-coordinates-transformation-matrix
6268
type: dfn; text: native depth sensing; url: native-depth-sensing
69+
type:attribute; for:XRDepthInformation; text:sensor; url:xrdepthinformation-sensor
70+
type: dfn; text: finding a supported configuration combination; url: find-supported-configuration-combination
71+
type: enum; text: XRDepthType; url: enumdef-xrdepthtype
72+
type: enum; text: XRDepthFormat; url: enumdef-xrdepthformat
73+
type: enum; text: XRDepthUsage; url: enumdef-xrdepthusage
6374
spec: WebXR Raw Camera Access Module; urlPrefix: https://immersive-web.github.io/raw-camera-access/#
6475
type: dfn; text: obtain camera
6576
</pre>
@@ -148,7 +159,7 @@ Simulated devices {#simulated-devices}
148159

149160
Simulated XR Device {#simulated-devices-xr}
150161
------------
151-
This API gives tests the ability to spin up a <dfn>simulated XR device</dfn> which is an [=/XR device=] which from the point of view of the WebXR API behaves like a normal [=/XR device=]. These [=simulated XR device|simulated XR devices=] can be controlled by the associated {{FakeXRDevice}} object.
162+
This API gives tests the ability to spin up a <dfn>simulated XR device</dfn> which is an [=XR device=] which from the point of view of the WebXR API behaves like a normal [=XR device=]. These [=simulated XR device|simulated XR devices=] can be controlled by the associated {{FakeXRDevice}} object.
152163

153164
Every [=simulated XR device=] may have an <dfn for="simulated XR device">native bounds geometry</dfn> which is an array of {{DOMPointReadOnly}}s, used to initialize the [=XRBoundedReferenceSpace/native bounds geometry=] of any {{XRBoundedReferenceSpace}}s created for the device. If <code>null</code>, the device is treated as if it is not currently tracking a bounded reference space.
154165

@@ -168,6 +179,12 @@ Every [=view=] for a [=simulated XR device=] has an associated <dfn for=view>dev
168179

169180
Every [=view=] for a [=simulated XR device=] may have an associated <dfn for=view>field of view</dfn>, which is an instance of {{FakeXRFieldOfViewInit}} used to calculate projection matrices using depth values. If the [=field of view=] is set, projection matrix values are calculated using the [=field of view=] and {{XRRenderState/depthNear}} and {{XRRenderState/depthFar}} values.
170181

182+
Every [=simulated XR device=] has a <dfn for="simulated XR device">supported depth types</dfn> which is a [=list=] of {{XRDepthType}} values, initially empty. If this list is empty, it implies all {{XRDepthType}} values are supported.
183+
184+
Every [=simulated XR device=] has a <dfn for="simulated XR device">supported depth formats</dfn> which is a [=list=] of {{XRDepthFormat}} values, initially empty. If this list is empty, it implies all {{XRDepthFormat}} values are supported.
185+
186+
Every [=simulated XR device=] has a <dfn for="simulated XR device">supported depth usages</dfn> which is a [=list=] of {{XRDepthUsage}} values, initially empty. If this list is empty, it implies all {{XRDepthUsage}} values are supported.
187+
171188
Simulated Input Device {#simulated-devices-input}
172189
------------
173190

@@ -256,6 +273,12 @@ When this method is invoked, the user agent MUST run the following steps:
256273
1. If |init|'s {{FakeXRDeviceInit/supportedFeatures}} is set, for each |mode| in |supportedModes|:
257274
1. Associate |init|'s {{FakeXRDeviceInit/supportedFeatures}} to |mode|
258275

276+
1. If |init|'s {{FakeXRDeviceInit/depthSupport}} is present:
277+
1. Let |depthConfig| be |init|'s {{FakeXRDeviceInit/depthSupport}}.
278+
1. If |depthConfig|'s {{FakeXRDepthConfigurationSupport/depthTypes}} is present and its [=list/size=] is greater than 0, set |device|'s [=simulated XR device/supported depth types=] to a copy of |depthConfig|'s {{FakeXRDepthConfigurationSupport/depthTypes}}.
279+
1. If |depthConfig|'s {{FakeXRDepthConfigurationSupport/depthFormats}} is present and its [=list/size=] is greater than 0, set |device|'s [=simulated XR device/supported depth formats=] to a copy of |depthConfig|'s {{FakeXRDepthConfigurationSupport/depthFormats}}.
280+
1. If |depthConfig|'s {{FakeXRDepthConfigurationSupport/depthUsages}} is present and its [=list/size=] is greater than 0, set |device|'s [=simulated XR device/supported depth usages=] to a copy of |depthConfig|'s {{FakeXRDepthConfigurationSupport/depthUsages}}.
281+
259282
NOTE: each |device| stores a [=capable of supporting|list of features it is capable of supporting=] per {{XRSessionMode}}. Most tests only test one mode anyway so there isn't much to be gained by splitting features per mode in {{FakeXRDeviceInit}}. Users wishing different modes supporting different features should create multiple devices instead.
260283

261284
1. Set |device|'s [=list of supported modes=] to |supportedModes|.
@@ -295,6 +318,7 @@ dictionary FakeXRDeviceInit {
295318

296319
// Depth sensing extensions:
297320
FakeXRDepthSensingDataInit depthSensingData;
321+
FakeXRDepthConfigurationSupport depthSupport;
298322
};
299323

300324
dictionary FakeXRViewInit {
@@ -354,19 +378,19 @@ To <dfn>parse a view</dfn> given a {{FakeXRViewInit}} |init|, perform the follow
354378
1. Let |view| be a new [=view=].
355379
1. Set |view|'s [=view/eye=] to |init|'s {{FakeXRViewInit/eye}}.
356380
1. If |init|'s {{FakeXRViewInit/projectionMatrix}} does not have 16 elements, throw a {{TypeError}}.
357-
1. Set |view|'s [=view/projection matrix=] to |init|'s {{FakeXRViewInit/projectionMatrix}}.
358-
1. Set |view|'s [=view offset=] to the result of running [=parse a rigid transform=] |init|'s {{FakeXRViewInit/viewOffset}}.
381+
1. Set |view|'s [=view geometry/projection matrix=] to |init|'s {{FakeXRViewInit/projectionMatrix}}.
382+
1. Set |view|'s [=view geometry/view offset=] to the result of running [=parse a rigid transform=] |init|'s {{FakeXRViewInit/viewOffset}}.
359383
1. Set |view|'s [=view/device resolution=] to |init|'s {{FakeXRViewInit/resolution}}.
360384
1. If |init|'s {{FakeXRViewInit/fieldOfView}} is set, perform the following steps:
361385
1. Set |view|'s [=view/field of view=] to |init|'s {{FakeXRViewInit/fieldOfView}}.
362-
1. Set |view|'s [=view/projection matrix=] to the projection matrix corresponding to this field of view, and depth values equal to {{XRRenderState/depthNear}} and {{XRRenderState/depthFar}} of any {{XRSession}} associated with the device. If there currently is none, use the default values of <code>near=0.1, far=1000.0</code>.
386+
1. Set |view|'s [=view geometry/projection matrix=] to the projection matrix corresponding to this field of view, and depth values equal to {{XRRenderState/depthNear}} and {{XRRenderState/depthFar}} of any {{XRSession}} associated with the device. If there currently is none, use the default values of <code>near=0.1, far=1000.0</code>.
363387
1. Return |view|.
364388

365389
</div>
366390

367391
FakeXRRigidTransformInit {#fakexrrigidtransform-base-space}
368392
------------
369-
The WebXR API never exposes native origins directly, instead exposing transforms between them, so we need to specify a <dfn>base reference space</dfn> for {{FakeXRRigidTransformInit}}s so that we can have consistent numerical values across implementations. When used as an origin, {{FakeXRRigidTransformInit}}s are in the [=base reference space=] where the [=viewer=]'s [=native origin=] is identity at initialization, unless otherwise specified. In this space, the {{XRReferenceSpaceType/"local"}} reference space has a [=native origin=] of identity. This is an arbitrary choice: changing this reference space doesn't affect the data returned by the WebXR API, but we must make such a choice so that the tests produce the same results across different UAs. When used as an origin it is logically a transform <i>from</i> the origin's space <i>to</i> the underlying [=base reference space=] described above.
393+
The WebXR API never exposes native origins directly, instead exposing transforms between them, so we need to specify a <dfn>base reference space</dfn> for {{FakeXRRigidTransformInit}}s so that we can have consistent numerical values across implementations. When used as an origin, {{FakeXRRigidTransformInit}}s are in the [=base reference space=] where the [=viewer=]'s [=XRSpace/native origin=] is identity at initialization, unless otherwise specified. In this space, the {{XRReferenceSpaceType/"local"}} reference space has a [=XRSpace/native origin=] of identity. This is an arbitrary choice: changing this reference space doesn't affect the data returned by the WebXR API, but we must make such a choice so that the tests produce the same results across different UAs. When used as an origin it is logically a transform <i>from</i> the origin's space <i>to</i> the underlying [=base reference space=] described above.
370394

371395
Mocking {#mocking}
372396
==============
@@ -487,7 +511,7 @@ The <dfn method for=FakeXRDevice>setBoundsGeometry(|boundsCoordinates|)</dfn> pe
487511

488512
</div>
489513

490-
The <dfn method for=FakeXRDevice>simulateResetPose()</dfn> method will, as soon as possible, behave as if the [=FakeXRDevice/device=]'s [=viewer=]'s [=native origin=] had a discontinuity, triggering appropriate {{reset}} events.
514+
The <dfn method for=FakeXRDevice>simulateResetPose()</dfn> method will, as soon as possible, behave as if the [=FakeXRDevice/device=]'s [=viewer=]'s [=XRSpace/native origin=] had a discontinuity, triggering appropriate {{reset}} events.
491515

492516
<div class="algorithm" data-algorithm="simulate-input-source-connection">
493517
The <dfn method for=FakeXRDevice>simulateInputSourceConnection(|init|)</dfn> method creates a new [=simulated XR input source=].
@@ -828,31 +852,54 @@ The depth sensing extensions for test API SHOULD be implemented by all user agen
828852

829853
The {{FakeXRDevice}} is extended with internal <dfn for=FakeXRDevice>depth sensing data</dfn> which is a {{FakeXRDepthSensingDataInit}}, used to supply data for requests to [=native depth sensing=].
830854

855+
<script type="idl">
856+
dictionary FakeXRDepthConfigurationSupport {
857+
sequence<XRDepthType> depthTypes;
858+
sequence<XRDepthFormat> depthFormats;
859+
sequence<XRDepthUsage> depthUsages;
860+
};
861+
</script>
862+
863+
The {{FakeXRDepthConfigurationSupport}} dictionary is used to define the [=native depth sensing=] capabilities of a [=simulated XR device=]. Missing or empty sequences for {{FakeXRDepthConfigurationSupport/depthTypes}}, {{FakeXRDepthConfigurationSupport/depthFormats}}, or {{FakeXRDepthConfigurationSupport/depthUsages}} indicate that all possible values for that respective enumeration are supported by the [=simulated XR device=]. If a User Agent does not support a particular value for any real device that it supports, it SHOULD ignore the presence of that value in any of these lists, in order to generate a more appropriate failure.
864+
865+
Note: For simplicity, the [=simulated XR device=] is presumed to support the cross-product of all supported types, formats, and usages. There is currently no mechanism in this test API to specify support for only specific combinations (e.g., a particular format and type only with a particular usage).
866+
831867
<script type="idl">
832868
dictionary FakeXRDepthSensingDataInit {
833869
required ArrayBuffer depthData;
870+
required XRDepthFormat depthFormat;
834871
required FakeXRRigidTransformInit normDepthBufferFromNormView;
835872
required float rawValueToMeters;
836873
required unsigned long width;
837874
required unsigned long height;
875+
sequence<float> projectionMatrix;
876+
FakeXRRigidTransformInit viewOffset;
838877
};
839878
</script>
840879

841880
{{FakeXRDepthSensingDataInit}} dictionary describes the state of the depth sensing data that should be used when returning latest depth information in [=creating a CPU depth information instance=] and [=creating a GPU depth information instance=] algorithms. All keys present in {{FakeXRDepthSensingDataInit}} correspond to the data required to be returned by [=native depth sensing=] capabilities of the device.
842881

843882
{{FakeXRDepthSensingDataInit/depthData}} corresponds to the desired depth buffer that is to be set on native depth information returned from querying the native device. Not setting {{FakeXRDepthSensingDataInit/depthData}} key in the dictionary signals that the returned native depth information should be <code>null</code>.
844883

884+
{{FakeXRDepthSensingDataInit/depthFormat}} indicates the {{XRDepthFormat}} of the data set in {{FakeXRDepthSensingDataInit/depthData}}.
885+
845886
{{FakeXRDepthSensingDataInit/normDepthBufferFromNormView}} corresponds to the desired [=depth coordinates transformation matrix=] that is to be set on native depth information returned from querying the native device.
846887

847888
{{FakeXRDepthSensingDataInit/rawValueToMeters}} corresponds to the desired conversion factor that is to be set on native depth information returned from querying the native device.
848889

849890
{{FakeXRDepthSensingDataInit/width}} and {{FakeXRDepthSensingDataInit/height}} correspond to the desired dimensions of the depth buffer that are to be set on native depth information returned from querying the native device.
850891

892+
{{FakeXRDepthSensingDataInit/projectionMatrix}} is an optional 16-element sequence of floats representing a projection matrix. If present, this matrix is intended to define the [=view geometry/projection matrix=] for the {{XRDepthInformation/sensor}}'s {{XRViewGeometry}}. If not present, the sensor geometry's projection matrix is assumed to be aligned with the projection matrix of the {{XRViewGeometry}} of the [=view=] for which the depth information is being created.
893+
894+
{{FakeXRDepthSensingDataInit/viewOffset}} is an optional {{FakeXRRigidTransformInit}}. If present, this transform is intended to define the [=view geometry/view offset=] for the {{XRDepthInformation/sensor}}'s {{XRViewGeometry}}, relative to the [=base reference space=]. If not present, the sensor geometry's transform is assumed to be aligned with the view offset of the {{XRViewGeometry}} of the [=view=] for which the depth information is being created.
895+
851896
<div class="algorithm" data-algorithm="set-depth-sensing-information">
852897

853898
When the {{FakeXRDevice/setDepthSensingData()}} method is invoked on {{FakeXRDevice}} |device| with |depthSensingData|, run the following steps:
854899

855900
1. If |depthSensingData|'s {{FakeXRDepthSensingDataInit/depthData}} is <code>null</code>, throw a {{TypeError}} and abort these steps.
901+
1. If |depthSensingData|'s {{FakeXRDepthSensingDataInit/projectionMatrix}} is set and its size is not 16, throw a {{TypeError}} and abort these steps.
902+
1. If |depthSensingData|'s {{FakeXRDepthSensingDataInit/viewOffset}} is set, run [=parse a rigid transform=] on |depthSensingData|'s {{FakeXRDepthSensingDataInit/viewOffset}}.
856903
1. Set |device|'s [=FakeXRDevice/depth sensing data=] to |depthSensingData|.
857904

858905
</div>

0 commit comments

Comments
 (0)