зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1633489 [wpt PR 23272] - Treat floorOrigin as mojoFromFloor, a=testonly
Automatic update from web-platform-tests Treat floorOrigin as mojoFromFloor Per the webxr-test-api all origins are based on the "local" space when the "session" started; which means that all of our origins passed in are inherently "mojoFromFoo." The standingTransform (in need of renaming) is, in blink and by devices, floorFromMojo. Since the tests were directly setting floorOrigin to the standingTransform, the tests were incorrectly treating floor origin as floorFromMojo. This change inverts the floorOrigin before assigning it to the standingTransform, so that Chrome begins treating the floorOrigin as mojoFromFloor. Given that Chrome was the only ones running these particular tests, the output values were *also* written as if the passed in floorOrigins were floorFromMojo. In order to stick with the expectations, this inverts the input transforms as well. In fixing this, a bug was discovered in XRMathHelper.inverse wherein the comatrix was not created properly. This change also addresses that bug. Fixed:1071630 Change-Id: I1626d80099169c4ceba0df68ad84bbf181f76647 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2165881 Auto-Submit: Alexander Cooper <alcooper@chromium.org> Commit-Queue: Piotr Bialecki <bialpio@chromium.org> Reviewed-by: Piotr Bialecki <bialpio@chromium.org> Cr-Commit-Position: refs/heads/master@{#763104} -- wpt-commits: 6a2f0e6a0110fd0830fc3196680f671bb83c2747 wpt-pr: 23272
This commit is contained in:
Родитель
f2549ba061
Коммит
b253edb1e9
|
@ -196,23 +196,23 @@ class XRMathHelper {
|
|||
const result2 = [
|
||||
// First column (m0r):
|
||||
invDet * det3x3(m11, m12, m13, m21, m22, m23, m32, m32, m33),
|
||||
invDet * det3x3(m10, m12, m13, m20, m22, m23, m30, m32, m33),
|
||||
-invDet * det3x3(m10, m12, m13, m20, m22, m23, m30, m32, m33),
|
||||
invDet * det3x3(m10, m11, m13, m20, m21, m23, m30, m31, m33),
|
||||
invDet * det3x3(m10, m11, m12, m20, m21, m22, m30, m31, m32),
|
||||
-invDet * det3x3(m10, m11, m12, m20, m21, m22, m30, m31, m32),
|
||||
// Second column (m1r):
|
||||
invDet * det3x3(m01, m02, m03, m21, m22, m23, m32, m32, m33),
|
||||
-invDet * det3x3(m01, m02, m03, m21, m22, m23, m32, m32, m33),
|
||||
invDet * det3x3(m00, m02, m03, m20, m22, m23, m30, m32, m33),
|
||||
invDet * det3x3(m00, m01, m03, m20, m21, m23, m30, m31, m33),
|
||||
-invDet * det3x3(m00, m01, m03, m20, m21, m23, m30, m31, m33),
|
||||
invDet * det3x3(m00, m01, m02, m20, m21, m22, m30, m31, m32),
|
||||
// Third column (m2r):
|
||||
invDet * det3x3(m01, m02, m03, m11, m12, m13, m31, m32, m33),
|
||||
invDet * det3x3(m00, m02, m03, m10, m12, m13, m30, m32, m33),
|
||||
-invDet * det3x3(m00, m02, m03, m10, m12, m13, m30, m32, m33),
|
||||
invDet * det3x3(m00, m01, m03, m10, m11, m13, m30, m31, m33),
|
||||
invDet * det3x3(m00, m01, m02, m10, m11, m12, m30, m31, m32),
|
||||
-invDet * det3x3(m00, m01, m02, m10, m11, m12, m30, m31, m32),
|
||||
// Fourth column (m3r):
|
||||
invDet * det3x3(m01, m02, m03, m11, m12, m13, m21, m22, m23),
|
||||
-invDet * det3x3(m01, m02, m03, m11, m12, m13, m21, m22, m23),
|
||||
invDet * det3x3(m00, m02, m03, m10, m12, m13, m20, m22, m23),
|
||||
invDet * det3x3(m00, m01, m03, m10, m11, m13, m20, m21, m23),
|
||||
-invDet * det3x3(m00, m01, m03, m10, m11, m13, m20, m21, m23),
|
||||
invDet * det3x3(m00, m01, m02, m10, m11, m12, m20, m21, m22),
|
||||
];
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// This polyfill library implements the WebXR Test API as specified here:
|
||||
// https://github.com/immersive-web/webxr-test-api
|
||||
|
||||
|
||||
// The standingTransform is floor_from_mojo and represented as such here.
|
||||
const default_standing = new gfx.mojom.Transform();
|
||||
default_standing.matrix = [1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
|
@ -409,8 +409,11 @@ class MockRuntime {
|
|||
}
|
||||
|
||||
this.stageParameters_.standingTransform = new gfx.mojom.Transform();
|
||||
|
||||
// floorOrigin is passed in as mojoFromFloor; however, standingTransform is
|
||||
// floorFromMojo so we need to invert the result of |getMatrixFromTransform|
|
||||
this.stageParameters_.standingTransform.matrix =
|
||||
getMatrixFromTransform(floorOrigin);
|
||||
XRMathHelper.inverse(getMatrixFromTransform(floorOrigin));
|
||||
|
||||
this.onStageParametersUpdated();
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ const VIEWER_ORIGIN_TRANSFORM = {
|
|||
|
||||
// 0.25m above world origin.
|
||||
const FLOOR_ORIGIN_TRANSFORM = {
|
||||
position: [0, -0.25, 0],
|
||||
position: [0, 0.25, 0],
|
||||
orientation: [0, 0, 0, 1],
|
||||
};
|
||||
|
||||
const fakeDeviceInitParams = {
|
||||
supportedModes: ["immersive-ar"],
|
||||
views: VALID_VIEWS,
|
||||
floorOrigin: FLOOR_ORIGIN_TRANSFORM, // aka floor_from_mojo
|
||||
floorOrigin: FLOOR_ORIGIN_TRANSFORM, // aka mojo_from_floor
|
||||
viewerOrigin: VIEWER_ORIGIN_TRANSFORM, // aka mojo_from_viewer
|
||||
supportedFeatures: ALL_FEATURES,
|
||||
world: createFakeWorld(5.0, 2.0, 5.0), // webxr_test_constants_fake_world.js has detailed description of the fake world
|
||||
|
|
|
@ -71,7 +71,7 @@ const VALID_FLOOR_ORIGIN_MATRIX = [1, 0, 0, 0,
|
|||
1, 1.65, -1, 1];
|
||||
|
||||
const VALID_FLOOR_ORIGIN = {
|
||||
position: [1.0, 1.65, -1.0],
|
||||
position: [-1.0, -1.65, 1.0],
|
||||
orientation: [0, 0, 0, 1]
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ const VIEWS_WITH_OFFSET = [{
|
|||
}];
|
||||
|
||||
const FLOOR_TRANSFORM = {
|
||||
position: [0.1, 0.2, 0.3],
|
||||
position: [-0.1, -0.2, -0.3],
|
||||
orientation: [0, 0, 0, 1]
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="resources/webxr_util.js"></script>
|
||||
<script src="resources/webxr_test_constants.js"></script>
|
||||
<script src="resources/webxr_test_asserts.js"></script>
|
||||
<canvas></canvas>
|
||||
<script>
|
||||
let testName =
|
||||
"Bounded space, viewer space, local and local-floor space have correct poses w.r.t. each other";
|
||||
// 1m above world origin.
|
||||
const VIEWER_ORIGIN_TRANSFORM = {
|
||||
position: [0, 1, 0],
|
||||
orientation: [0, 0, 0, 1],
|
||||
};
|
||||
// 0.25m above world origin.
|
||||
const FLOOR_ORIGIN_TRANSFORM = {
|
||||
position: [0, 0.25, 0],
|
||||
orientation: [0, 0, 0, 1],
|
||||
};
|
||||
const fakeDeviceInitParams = {
|
||||
supportsImmersive: true,
|
||||
supportedModes: ["inline", "immersive-vr"],
|
||||
views: VALID_VIEWS,
|
||||
viewerOrigin: VIEWER_ORIGIN_TRANSFORM,
|
||||
floorOrigin: FLOOR_ORIGIN_TRANSFORM,
|
||||
supportedFeatures: ALL_FEATURES
|
||||
};
|
||||
let testFunction = function(session, fakeDeviceController, t) {
|
||||
return new Promise((resolve, reject) => {
|
||||
Promise.all([
|
||||
session.requestReferenceSpace('bounded-floor'),
|
||||
session.requestReferenceSpace('local'),
|
||||
session.requestReferenceSpace('local-floor'),
|
||||
session.requestReferenceSpace('viewer')
|
||||
]).then(([boundedSpace, localSpace, localFloorSpace, viewerSpace]) => {
|
||||
t.step(() => {
|
||||
});
|
||||
const onFrame = function(time, xrFrame) {
|
||||
const localFloorPoseInLocalSpace = xrFrame.getPose(localFloorSpace, localSpace);
|
||||
const viewerPoseInLocalFloorSpace = xrFrame.getPose(viewerSpace, localFloorSpace);
|
||||
const boundedFloorPoseInLocalFloorSpace = xrFrame.getPose(boundedSpace, localFloorSpace);
|
||||
t.step(() => {
|
||||
// Local floor space is supposed to be 0.25m above local space (aka world space).
|
||||
assert_equals(localFloorPoseInLocalSpace.transform.position.y, 0.25);
|
||||
// Bounded floor space should be at the same height as local floor space.
|
||||
assert_equals(boundedFloorPoseInLocalFloorSpace.transform.position.y, 0.0);
|
||||
// Viewer space should be additional 0.75m above local-floor space.
|
||||
assert_equals(viewerPoseInLocalFloorSpace.transform.position.y, 0.75);
|
||||
});
|
||||
resolve();
|
||||
}
|
||||
session.requestAnimationFrame(onFrame);
|
||||
});
|
||||
});
|
||||
};
|
||||
xr_session_promise_test(testName, testFunction, fakeDeviceInitParams, 'immersive-vr', { 'requiredFeatures': ['local-floor', 'bounded-floor'] });
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче