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
Prev

Remove viewMatrix

Users are supposed to use `view.transform.inverse.matrix`

The view matrix was incorrect anyway, we had forgotten to invert it, but that was okay since we transposed it by accident (due to euclid's use of the row-vector convention), and for 3DOF devices these transforms are mostly rotations so  transposing instead of inverting doesn't lead to visible effects.
  • Loading branch information
Manishearth committed Apr 4, 2019
commit e055884564f6bf1db0ea2ca6af3b3aaafd4fd17b
@@ -13,6 +13,5 @@ enum XREye {
interface XRView {
readonly attribute XREye eye;
readonly attribute Float32Array projectionMatrix;
readonly attribute Float32Array viewMatrix;
readonly attribute XRRigidTransform transform;
};
@@ -63,7 +63,6 @@ impl XRView {

let offset = Vector3D::new(offset[0] as f64, offset[1] as f64, offset[2] as f64);
let transform = pose.post_mul(&offset.into());
let view = transform.to_transform().cast().to_column_major_array();
let transform = XRRigidTransform::new(global, transform);

let ret = reflect_dom_object(
@@ -75,7 +74,6 @@ impl XRView {
let cx = global.get_cx();
unsafe {
create_typed_array(cx, proj, &ret.proj);
create_typed_array(cx, &view, &ret.view);
}
ret
}
@@ -97,12 +95,6 @@ impl XRViewMethods for XRView {
NonNull::new(self.proj.get()).unwrap()
}

#[allow(unsafe_code)]
/// https://immersive-web.github.io/webxr/#dom-xrview-projectionmatrix
unsafe fn ViewMatrix(&self, _cx: *mut JSContext) -> NonNull<JSObject> {
NonNull::new(self.view.get()).unwrap()
}

/// https://immersive-web.github.io/webxr/#dom-xrview-transform
fn Transform(&self) -> DomRoot<XRRigidTransform> {
DomRoot::from_ref(&self.transform)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.