From f259b36a96c9e85aa19174fd8db5da7711ff348c Mon Sep 17 00:00:00 2001 From: Piotr Bialecki Date: Fri, 8 Jul 2022 15:35:02 -0700 Subject: [PATCH] Add raw camera access extensions (#79) * Add raw camera access extensions * Add check for views' camera --- index.bs | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/index.bs b/index.bs index 2cdc0c8..754830d 100644 --- a/index.bs +++ b/index.bs @@ -60,6 +60,8 @@ spec: WebXR Depth Sensing Module; urlPrefix: https://immersive-web.github.io/dep type: dfn; text: create a GPU depth information instance; url: create-a-gpu-depth-information-instance type: dfn; text: depth coordinates transformation matrix; url: depth-coordinates-transformation-matrix type: dfn; text: native depth sensing; url: native-depth-sensing +spec: WebXR Raw Camera Access Module; urlPrefix: https://immersive-web.github.io/raw-camera-access/# + type: dfn; text: obtain camera @@ -301,6 +303,9 @@ dictionary FakeXRViewInit { required FakeXRDeviceResolution resolution; required FakeXRRigidTransformInit viewOffset; FakeXRFieldOfViewInit fieldOfView; + + // Raw camera access extensions: + FakeXRCameraImage cameraImageInit; }; dictionary FakeXRFieldOfViewInit { @@ -323,7 +328,6 @@ dictionary FakeXRRigidTransformInit { required sequence position; required sequence orientation; }; -

@@ -395,7 +399,6 @@ interface FakeXRDevice : EventTarget { undefined setDepthSensingData(FakeXRDepthSensingDataInit depthSensingData); undefined clearDepthSensingData(); }; - @@ -661,11 +664,9 @@ Hit test extensions {#hit-test-extensions} The hit test extensions for test API SHOULD be implemented by all user agents that implement WebXR Hit Test Module. {{FakeXRWorldInit}} dictionary describes the state of the world that will be used when computing hit test results on a {{FakeXRDevice}}. @@ -673,12 +674,10 @@ dictionary FakeXRWorldInit { {{FakeXRWorldInit/hitTestRegions}} contains a collection of {{FakeXRRegionInit}}s that are used to describe specific regions of the fake world. The order of the regions does not matter. {{FakeXRRegionInit}} dictionary describes the contents of a specific region of the world. @@ -688,11 +687,9 @@ dictionary FakeXRRegionInit { {{FakeXRRegionInit/type}} contains a type of the region that will be used during computation of hit test results. {{FakeXRTriangleInit}} dictionary describes a single face of a region. @@ -700,13 +697,11 @@ dictionary FakeXRTriangleInit { {{FakeXRTriangleInit/vertices}} contains a collection of {{DOMPointInit}}s that comprise the face. The face will be considered as solid when computing hit test results and as such, the winding order of the vertices does not matter. {{FakeXRRegionType}} enum is used to describe a type of the world region. @@ -731,7 +726,6 @@ Anchors extensions {#anchors-extensions} The anchors extensions for test API SHOULD be implemented by all user agents that implement WebXR Anchors. The {{FakeXRAnchorCreationCallback}} callback can be used by the Web Platform Tests to control the result of a call to create an anchor, and to be able to subsequently control the newly created anchor. @@ -769,7 +762,6 @@ The {{FakeXRAnchorCreationParameters/isAttachedToEntity}} attribute will be set The anchorController parameter passed in to {{FakeXRAnchorCreationCallback}} can be used to update the state of the anchor, assuming that the creation request was deemed successful. Tests SHOULD store it and issue commands to it for the entire duration of controlled anchor's lifetime. Successfully created anchors can be controlled by the test through the use of {{FakeXRAnchorController}} interface. @@ -804,7 +795,6 @@ Lighting estimation extensions {#lighting-estimation-extensions} The lighting estimation extensions for test API SHOULD be implemented by all user agents that implement WebXR Lighting Estimation. The {{FakeXRDevice}} is extended with internal light estimate which is a {{FakeXRLightEstimateInit}}, used to supply data for any requested {{XRLightEstimate}}. @@ -840,7 +829,6 @@ The depth sensing extensions for test API SHOULD be implemented by all user agen The {{FakeXRDevice}} is extended with internal depth sensing data which is a {{FakeXRDepthSensingDataInit}}, used to supply data for requests to [=native depth sensing=]. {{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. @@ -877,3 +864,29 @@ When the {{FakeXRDevice/clearDepthSensingData()}} method is invoked on {{FakeXRD 1. Set |device|'s [=FakeXRDevice/depth sensing data=] to null. + +Raw camera access extensions {#raw-camera-access-extensions} +============================ + +The raw camera access extensions for test API SHOULD be implemented by all user agents that implement WebXR Raw Camera Access Module. + +The {{FakeXRViewInit}} dictionary is extended with {{FakeXRViewInit/cameraImageInit}} dictionary of type {{FakeXRDeviceResolution}}. This dictionary carries information about the camera image, and is intended to affect the camera image variable in [=obtain camera=] algorithm. If the {{FakeXRViewInit/cameraImageInit}} key is not present in the {{FakeXRViewInit}} dictionary, the [=obtain camera=] algorithm should treat this as null camera image (and thus the algorithm will return null). + + + +The {{FakeXRCameraImage/width}} controls the width of the camera image buffer in [=obtain camera=] algorithm. + +The {{FakeXRCameraImage/height}} controls the height of the camera image buffer in [=obtain camera=] algorithm. + +The {{FakeXRCameraImage/pixels}} control the camera image contents in [=obtain camera=] algorithm. The pixels will be used to initialize the camera image texture. + +The camera image will be initialized as if by a call to gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixels), where width, height, and pixels are, respectively, {{FakeXRCameraImage/width}}, {{FakeXRCameraImage/height}}, and {{FakeXRCameraImage/pixels}}. In case {{FakeXRCameraImage/pixels}} key is not present in the dictionary, the behavior would be as if a call to gl.texImage2D() variant that omits the pixels parameter was made. + +Any time a [=simulated XR device=]'s [=simulated XR device/list of primary views=] and [=simulated XR device/list of secondary views=] is set, the user agent MUST verify that the camera images associated with the views present across both of those lists are all equal to each other. Camera images are considered equal when their {{FakeXRCameraImage/width}}s and {{FakeXRCameraImage/height}}s are equal, and their {{FakeXRCameraImage/pixels}} are the same instance (if present). If they are not equal, the user agent MUST throw an error from within the algorithm that attempted to set them.