Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update XR code to use rigid transforms and new pose/transform stuff from the spec #23159

Merged
merged 13 commits into from Apr 4, 2019

XRRigidTransform.inverse is now a lazy attribute

  • Loading branch information
Manishearth committed Apr 4, 2019
commit eb837d1ed79bac1d3e0e9552b149f7f289665eb1
@@ -10,5 +10,5 @@ interface XRRigidTransform {
readonly attribute DOMPointReadOnly position;
readonly attribute DOMPointReadOnly orientation;
// readonly attribute Float32Array matrix;
XRRigidTransform inverse();
readonly attribute XRRigidTransform inverse;
};
@@ -23,6 +23,7 @@ pub struct XRRigidTransform {
orientation: MutNullableDom<DOMPointReadOnly>,
#[ignore_malloc_size_of = "defined in euclid"]
transform: RigidTransform3D<f64>,
inverse: MutNullableDom<XRRigidTransform>,
}

impl XRRigidTransform {
@@ -32,6 +33,7 @@ impl XRRigidTransform {
position: MutNullableDom::default(),
orientation: MutNullableDom::default(),
transform,
inverse: MutNullableDom::default(),
}
}

@@ -93,7 +95,9 @@ impl XRRigidTransformMethods for XRRigidTransform {
}
// https://immersive-web.github.io/webxr/#dom-xrrigidtransform-inverse
fn Inverse(&self) -> DomRoot<XRRigidTransform> {
XRRigidTransform::new(&self.global(), self.transform.inverse())
self.inverse.or_init(|| {
XRRigidTransform::new(&self.global(), self.transform.inverse())
})
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.