Commit aeb99442 authored by Jacob DeWitt's avatar Jacob DeWitt Committed by Commit Bot

Make WebXR WPT tests use viewOffset when appropriate

Now that both position and orientation are used, some expected view
matrices had to be updated.

Bug: 1001733
Change-Id: I3dacd02ff724c0f173fae2c3473014df9fc6d8b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795492
Commit-Queue: Jacob DeWitt <jacde@chromium.org>
Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695308}
parent 7a6c46e1
...@@ -45,12 +45,9 @@ function getMatrixFromTransform(transform) { ...@@ -45,12 +45,9 @@ function getMatrixFromTransform(transform) {
m14, m24, m34, 1]; m14, m24, m34, 1];
} }
function getGFXTransformFromPosition(x, y, z) { function composeGFXTransform(fakeTransformInit) {
let transform = new gfx.mojom.Transform(); let transform = new gfx.mojom.Transform();
transform.matrix = getMatrixFromTransform({ transform.matrix = getMatrixFromTransform(fakeTransformInit);
position: [x, y, z],
orientation: [0, 0, 0, 1]
});
return transform; return transform;
} }
...@@ -378,7 +375,10 @@ class MockRuntime { ...@@ -378,7 +375,10 @@ class MockRuntime {
leftDegrees: 50.899, leftDegrees: 50.899,
rightDegrees: 35.197 rightDegrees: 35.197
}, },
headFromEye: getGFXTransformFromPosition(-0.032, 0, 0), headFromEye: composeGFXTransform({
position: [-0.032, 0, 0],
orientation: [0, 0, 0, 1]
}),
renderWidth: 20, renderWidth: 20,
renderHeight: 20 renderHeight: 20
}, },
...@@ -389,7 +389,10 @@ class MockRuntime { ...@@ -389,7 +389,10 @@ class MockRuntime {
leftDegrees: 50.899, leftDegrees: 50.899,
rightDegrees: 35.197 rightDegrees: 35.197
}, },
headFromEye: getGFXTransformFromPosition(0.032, 0, 0), headFromEye: composeGFXTransform({
position: [0.032, 0, 0],
orientation: [0, 0, 0, 1]
}),
renderWidth: 20, renderWidth: 20,
renderHeight: 20 renderHeight: 20
}, },
...@@ -415,8 +418,6 @@ class MockRuntime { ...@@ -415,8 +418,6 @@ class MockRuntime {
let upTan = (1 + m[9]) / m[5]; let upTan = (1 + m[9]) / m[5];
let downTan = (1 - m[9]) / m[5]; let downTan = (1 - m[9]) / m[5];
let offset = fakeXRViewInit.viewOffset.position;
return { return {
fieldOfView: { fieldOfView: {
upDegrees: toDegrees(upTan), upDegrees: toDegrees(upTan),
...@@ -424,7 +425,7 @@ class MockRuntime { ...@@ -424,7 +425,7 @@ class MockRuntime {
leftDegrees: toDegrees(leftTan), leftDegrees: toDegrees(leftTan),
rightDegrees: toDegrees(rightTan) rightDegrees: toDegrees(rightTan)
}, },
headFromEye: getGFXTransformFromPosition(offset[0], offset[1], offset[2]), headFromEye: composeGFXTransform(fakeXRViewInit.viewOffset),
renderWidth: fakeXRViewInit.resolution.width, renderWidth: fakeXRViewInit.resolution.width,
renderHeight: fakeXRViewInit.resolution.height renderHeight: fakeXRViewInit.resolution.height
}; };
......
...@@ -11,7 +11,7 @@ let testName = "Updating XRReferenceSpace origin offset updates view and input m ...@@ -11,7 +11,7 @@ let testName = "Updating XRReferenceSpace origin offset updates view and input m
const VIEW_OFFSET_WITH_ROTATION = { const VIEW_OFFSET_WITH_ROTATION = {
position: [4, 3, 2], position: [4, 3, 2],
orientation: [0, -0.71, 0, 0.71 ] orientation: [0, -0.7071, 0, 0.7071 ]
}; };
const VIEWS_WITH_OFFSET = [{ const VIEWS_WITH_OFFSET = [{
...@@ -55,15 +55,15 @@ let testFunction = ...@@ -55,15 +55,15 @@ let testFunction =
const RADIANS_90D = Math.PI / 2; const RADIANS_90D = Math.PI / 2;
const EXPECTED_VIEW_MATRIX_1 = [0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, -5, -4, -3, 1]; const EXPECTED_VIEW_MATRIX_1 = [1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, -3, -4, 5, 1];
const EXPECTED_GRIP_MATRIX_1 = [0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 2, 3, 1]; const EXPECTED_GRIP_MATRIX_1 = [0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 2, 3, 1];
const EXPECTED_RAY_MATRIX_1 = [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1]; const EXPECTED_RAY_MATRIX_1 = [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 2, 1, 1];
const EXPECTED_VIEW_MATRIX_2 = [0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, -8, 1, 7, 1]; const EXPECTED_VIEW_MATRIX_2 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 7, 1, 8, 1];
const EXPECTED_GRIP_MATRIX_2 = [0, -1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, -9, -2, -5, 1]; const EXPECTED_GRIP_MATRIX_2 = [0, -1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, -9, -2, -5, 1];
const EXPECTED_RAY_MATRIX_2 = [0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, -8, -4, -5, 1]; const EXPECTED_RAY_MATRIX_2 = [0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, -8, -4, -5, 1];
const EXPECTED_VIEW_MATRIX_3 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -8, 3, 12, 1]; const EXPECTED_VIEW_MATRIX_3 = [0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 12, 3, 8, 1];
const EXPECTED_GRIP_MATRIX_3 = [0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 5, -4, -14, 1]; const EXPECTED_GRIP_MATRIX_3 = [0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 5, -4, -14, 1];
const EXPECTED_RAY_MATRIX_3 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 5, -6, -13, 1]; const EXPECTED_RAY_MATRIX_3 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 5, -6, -13, 1];
......
...@@ -87,9 +87,9 @@ function testFunction(session, fakeDeviceController, t) { ...@@ -87,9 +87,9 @@ function testFunction(session, fakeDeviceController, t) {
let grip_matrix = grip_pose.transform.matrix; let grip_matrix = grip_pose.transform.matrix;
let ray_matrix = input_pose.transform.matrix; let ray_matrix = input_pose.transform.matrix;
assert_matrix_approx_equals(expected_view_matrix, view_matrix); assert_matrix_approx_equals(view_matrix, expected_view_matrix);
assert_matrix_approx_equals(expected_grip_matrix, grip_matrix); assert_matrix_approx_equals(grip_matrix, expected_grip_matrix);
assert_matrix_approx_equals(expected_ray_matrix, ray_matrix); assert_matrix_approx_equals(ray_matrix, expected_ray_matrix);
assert_equals(reference_space.boundsGeometry.length, expected_bounds_geometry.length); assert_equals(reference_space.boundsGeometry.length, expected_bounds_geometry.length);
for (var i = 0; i < reference_space.boundsGeometry.length; ++i) { for (var i = 0; i < reference_space.boundsGeometry.length; ++i) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment