aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-12-03 00:11:14 -0500
committerGitHub <noreply@github.com>2019-12-03 00:11:14 -0500
commit7aa68c8fe7ca0865a7323ab1e5b9526efa588ca2 (patch)
tree42f0cfb22ec35e1306a3ac879545e3e0d65af102
parent87c1019c5deafd128acd76f083e63f1a285bb1e0 (diff)
parentba3689ee4f40606afe24b566f1f0cc3587ab5527 (diff)
downloadservo-7aa68c8fe7ca0865a7323ab1e5b9526efa588ca2.tar.gz
servo-7aa68c8fe7ca0865a7323ab1e5b9526efa588ca2.zip
Auto merge of #25025 - Manishearth:originOffset, r=jdm
Origin offset fixes https://github.com/immersive-web/webxr/issues/567 was closed out. We were computing offset spaces of already-offset spaces incorrectly, but otherwise our math is correct. I improved our comments around this with more math, so I never have to do this math again. Chrome's math isn't, which is why we fail some tests around this: https://bugs.chromium.org/p/chromium/issues/detail?id=1030049 . I'm planning to wait for them to fix and upstream the tests, I've already verified that we pass the corrected test. r? @jdm
-rw-r--r--components/script/dom/xrreferencespace.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/components/script/dom/xrreferencespace.rs b/components/script/dom/xrreferencespace.rs
index 829fdfc02fa..35e106d1125 100644
--- a/components/script/dom/xrreferencespace.rs
+++ b/components/script/dom/xrreferencespace.rs
@@ -64,7 +64,7 @@ impl XRReferenceSpace {
impl XRReferenceSpaceMethods for XRReferenceSpace {
/// https://immersive-web.github.io/webxr/#dom-xrreferencespace-getoffsetreferencespace
fn GetOffsetReferenceSpace(&self, new: &XRRigidTransform) -> DomRoot<Self> {
- let offset = new.transform().pre_transform(&self.offset.transform());
+ let offset = self.offset.transform().pre_transform(&new.transform());
let offset = XRRigidTransform::new(&self.global(), offset);
Self::new_offset(
&self.global(),
@@ -82,9 +82,6 @@ impl XRReferenceSpace {
/// however we specialize it to be efficient
pub fn get_viewer_pose(&self, base_pose: &Frame) -> ApiViewerPose {
let pose = self.get_unoffset_viewer_pose(base_pose);
-
- // This may change, see https://github.com/immersive-web/webxr/issues/567
-
// in column-vector notation,
// get_viewer_pose(space) = get_pose(space).inverse() * get_pose(viewer_space)
// = (get_unoffset_pose(space) * offset).inverse() * get_pose(viewer_space)
@@ -139,10 +136,12 @@ impl XRReferenceSpace {
/// with other spaces
pub fn get_pose(&self, base_pose: &Frame) -> ApiPose {
let pose = self.get_unoffset_pose(base_pose);
-
- // This may change, see https://github.com/immersive-web/webxr/issues/567
let offset = self.offset.transform();
- offset.post_transform(&pose)
+ // pose is a transform from the unoffset space to native space,
+ // offset is a transform from offset space to unoffset space,
+ // we want a transform from unoffset space to native space,
+ // which is pose * offset in column vector notation
+ pose.pre_transform(&offset)
}
/// Gets pose represented by this space