Auto merge of #23164 - Manishearth:getpose, r=asajeffrey

Add XRFrame.getPose()

I think I've figured out the model of poses, waiting on Nell for confirmation.

Basically, `getViewerPose(p)` is equivalent to `getPose(source=viewerSpace, relative_to=p)`

The eye-level space, for example, is stationary and stuck to the origin. The position-disabled and identity spaces somewhat counterintuitively follow you around (and appear to be stationary from `getViewerPose()` but not `getPose()`.

The incorrect mental model kinda "works" when looking at only `getViewerPose()`, but we need to figure it out for `getPose()`.

Todo (may add to this PR, but probably not)

 - implement `XRSession.viewerSpace`
 - implement position-disabled
 - implement floor-level (hard to test without a 6dof device)

r? @asajeffrey

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23164)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-04-05 21:00:47 -04:00 committed by GitHub
commit 967efc7fbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 127 additions and 41 deletions

View file

@ -8,6 +8,7 @@
interface XRFrame {
readonly attribute XRSession session;
XRViewerPose? getViewerPose(XRReferenceSpace referenceSpace);
[Throws] XRViewerPose? getViewerPose(XRReferenceSpace referenceSpace);
[Throws] XRPose? getPose(XRSpace space, XRSpace relativeTo);
// XRInputPose? getInputPose(XRInputSource inputSource, optional XRReferenceSpace referenceSpace);
};

View file

@ -20,6 +20,7 @@ interface XRSession : EventTarget {
readonly attribute XREnvironmentBlendMode environmentBlendMode;
readonly attribute XRRenderState renderState;
readonly attribute XRSpace viewerSpace;
// // Methods
Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceOptions options);