mirror of
https://github.com/servo/servo.git
synced 2025-08-23 14:25:33 +01:00
Add test for origin offset
This commit is contained in:
parent
db7a08b5c6
commit
73bd249b7a
3 changed files with 14 additions and 4 deletions
|
@ -19687,11 +19687,11 @@
|
|||
"testharness"
|
||||
],
|
||||
"webxr/obtain_frame.html": [
|
||||
"f1edfc4d70a2125a44748b378a40b6855f79cc62",
|
||||
"d3c7d85c6cc6fcb65e674e8aeeab59b16db6c0a3",
|
||||
"testharness"
|
||||
],
|
||||
"webxr/resources/webxr-util.js": [
|
||||
"08d9fa69730d2523d4a066636bef4959f3e1a725",
|
||||
"b644ba72ac801bc8f659e9678d31ab23db0b7281",
|
||||
"support"
|
||||
]
|
||||
},
|
||||
|
|
|
@ -47,7 +47,17 @@
|
|||
throw "got unknown view";
|
||||
}
|
||||
}
|
||||
|
||||
let offset = space.getOffsetReferenceSpace(new XRRigidTransform({x: 1, y: -1, z: 4}, {x: 0, y: 1, z: 1, w: 1}));
|
||||
pose = frame.getViewerPose(offset);
|
||||
for (view of pose.views) {
|
||||
if (view.eye == "left") {
|
||||
assert_matrix_approx_equals(view.transform.matrix, [-1/3,-2/3,2/3,0,-2/3,2/3,1/3,0,-2/3,-1/3,-2/3,0,3.4,-1.9,-0.9,1], 0.001, "left offset transform");
|
||||
} else if (view.eye == "right") {
|
||||
assert_matrix_approx_equals(view.transform.matrix, [-1/3,-2/3,2/3,0,-2/3,2/3,1/3,0,-2/3,-1/3,-2/3,0,3.6,-1.9,-0.9,1], 0.001, "right offset transform");
|
||||
} else {
|
||||
throw "got unknown view";
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -7,7 +7,7 @@ const RIGHT_OFFSET = {position: [0.1, 0, 0], orientation: [0,0,0,0]};
|
|||
let assert_matrix_approx_equals = function(m1, m2, epsilon, prefix = "") {
|
||||
assert_equals(m1.length, m2.length, prefix + "Matrix lengths should match");
|
||||
for(var i = 0; i < m1.length; ++i) {
|
||||
assert_approx_equals(m1[i], m2[i], epsilon, prefix + " Component number " + i + " should match");
|
||||
assert_approx_equals(m1[i], m2[i], epsilon, prefix + ": Component number " + i + " should match");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue