Bug 1644506 [wpt PR 24065] - WebXR - anchors - fix anchor creation from hit test, a=testonly
authorPiotr Bialecki <bialpio@chromium.org>
Sat, 13 Jun 2020 03:32:36 +0000
changeset 536051 9390f053462981c3bff30270e537a7e7ce269893
parent 536050 35513bcc2e6b81822f9ad3c9ad92290127197cf9
child 536052 17b46f765e92e090c2ace84e6ff9d1454a022c90
push id37516
push usercbrindusan@mozilla.com
push dateWed, 17 Jun 2020 21:52:06 +0000
treeherdermozilla-central@fa0afb432810 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1644506, 24065, 2236592, 777463
milestone79.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1644506 [wpt PR 24065] - WebXR - anchors - fix anchor creation from hit test, a=testonly Automatic update from web-platform-tests WebXR - anchors - fix anchor creation from hit test Anchor creation based off of hit test result was incorrectly using unstable native origin (planes' origins may change diametrically from frame to frame) - this CL fixes the issue. Additionally, hit test logic did not correctly treat hit test results as computed based off of plane intersection - the issue did not cause any problems with hit test API, but is problematic for anchor creation API. Changes: - plane-attached anchor creation now accepts native origin information and pose relative to passed in native origin - this is done to ensure that anchor creation uses a frame of reference that is stable w.r.t. the environment (plane pose is not a correct choice as it changes when plane extents are changing) - fixed an issue in ArCoreImpl::RequestHitTest() - it would not report results as computed based off of a plane even if they were - mojom's hit test result now uses pose instead of matrix - pose is directly provided by ARCore SDK and has smaller cognitive load as it does not require considering column-major vs. row-major memory layouts - IDL - anchor creation based on hit test result and on plane no longer accepts initial pose since the spec draft has changed - initial pose was considered confusing and unnecessary since it did not extend the capabilities of the API - JS-exposed anchor creation from XRHitTestResult and from XRPlane no longer accepts an XRRigidTransform - the spec draft was already changed to account for this All other changes (parameter renames, comment updates, fixing call sites to account for parameter count changes, etc.) are related to the above major changes. Change-Id: I5acb872c5a9d9003f1f85173edd82e6e6fa002bb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2236592 Commit-Queue: Piotr Bialecki <bialpio@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Alexander Cooper <alcooper@chromium.org> Cr-Commit-Position: refs/heads/master@{#777463} -- wpt-commits: c28b441d5378bb8d669b684a6a8bbb1a24c2482c wpt-pr: 24065
testing/web-platform/tests/resources/chromium/webxr-test.js
--- a/testing/web-platform/tests/resources/chromium/webxr-test.js
+++ b/testing/web-platform/tests/resources/chromium/webxr-test.js
@@ -1196,42 +1196,42 @@ class MockRuntime extends EventTarget {
         const x_axis = normalize(cross(y_axis, z_axis));
 
         // Filter out the points not in polygon.
         if (!XRMathHelper.pointInFace(intersection_point, face)) {
           return null;
         }
 
         const hitResult = new device.mojom.XRHitResult();
-        hitResult.hitMatrix = new gfx.mojom.Transform();
-
         hitResult.distance = distance;  // Extend the object with additional information used by higher layers.
                                         // It will not be serialized over mojom.
 
-        hitResult.hitMatrix.matrix = new Array(16);
+        const matrix = new Array(16);
 
-        hitResult.hitMatrix.matrix[0] = x_axis.x;
-        hitResult.hitMatrix.matrix[1] = x_axis.y;
-        hitResult.hitMatrix.matrix[2] = x_axis.z;
-        hitResult.hitMatrix.matrix[3] = 0;
+        matrix[0] = x_axis.x;
+        matrix[1] = x_axis.y;
+        matrix[2] = x_axis.z;
+        matrix[3] = 0;
+
+        matrix[4] = y_axis.x;
+        matrix[5] = y_axis.y;
+        matrix[6] = y_axis.z;
+        matrix[7] = 0;
 
-        hitResult.hitMatrix.matrix[4] = y_axis.x;
-        hitResult.hitMatrix.matrix[5] = y_axis.y;
-        hitResult.hitMatrix.matrix[6] = y_axis.z;
-        hitResult.hitMatrix.matrix[7] = 0;
+        matrix[8] = z_axis.x;
+        matrix[9] = z_axis.y;
+        matrix[10] = z_axis.z;
+        matrix[11] = 0;
 
-        hitResult.hitMatrix.matrix[8] = z_axis.x;
-        hitResult.hitMatrix.matrix[9] = z_axis.y;
-        hitResult.hitMatrix.matrix[10] = z_axis.z;
-        hitResult.hitMatrix.matrix[11] = 0;
+        matrix[12] = intersection_point.x;
+        matrix[13] = intersection_point.y;
+        matrix[14] = intersection_point.z;
+        matrix[15] = 1;
 
-        hitResult.hitMatrix.matrix[12] = intersection_point.x;
-        hitResult.hitMatrix.matrix[13] = intersection_point.y;
-        hitResult.hitMatrix.matrix[14] = intersection_point.z;
-        hitResult.hitMatrix.matrix[15] = 1;
+        hitResult.mojoFromResult = XRMathHelper.decomposeRigidTransform(matrix);
 
         return hitResult;
       }
     }
   }
 
   _getMojoFromViewer() {
     const transform = {