mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 13:48:23 +02:00
Automatic update from web-platform-tests Implement XRFrame.getPose According to WebXR spec https://immersive-web.github.io/webxr/#dom-xrframe-getpose Bug: 922202 Change-Id: Ia7af7156e4195cb01d1eebda2701520d2ab836b9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1480272 Reviewed-by: Klaus Weidner <klausw@chromium.org> Reviewed-by: Bill Orr <billorr@chromium.org> Commit-Queue: Jacob DeWitt <jacde@chromium.org> Cr-Commit-Position: refs/heads/master@{#637540} -- wpt-commits: 7a54b4d831b271f678fac355f3a9c8285701512f wpt-pr: 15536
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
// assert_equals can fail when comparing floats due to precision errors, so
|
|
// use assert_approx_equals with this constant instead
|
|
const FLOAT_EPSILON = 0.001;
|
|
|
|
// Identity matrix
|
|
const IDENTITY_MATRIX = [1, 0, 0, 0,
|
|
0, 1, 0, 0,
|
|
0, 0, 1, 0,
|
|
0, 0, 0, 1];
|
|
|
|
// A valid pose matrix for when we don't care about specific values
|
|
const VALID_POSE_MATRIX = [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1];
|
|
|
|
const VALID_PROJECTION_MATRIX =
|
|
[1, 0, 0, 0, 0, 1, 0, 0, 3, 2, -1, -1, 0, 0, -0.2, 0];
|
|
|
|
const VALID_VIEW_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 2, 1];
|
|
|
|
// A valid VRPose for when we want the HMD to report being at the origin
|
|
const ORIGIN_POSE = IDENTITY_MATRIX;
|
|
|
|
// A valid input grip matrix for when we don't care about specific values
|
|
const VALID_GRIP = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 2, 1];
|
|
|
|
// A valid input pointer offset for when we don't care about specific values
|
|
const VALID_POINTER_OFFSET = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1];
|
|
|
|
const VALID_GRIP_WITH_POINTER_OFFSET =
|
|
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 4, 3, 3, 1];
|
|
|
|
const VALID_STAGE_TRANSFORM =
|
|
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1.0, 1.65, -1.0, 1];
|