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

Explicitly spec out when requestReferenceSpace() can reject queries #651

Merged
merged 3 commits into from
May 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -837,11 +837,26 @@ When an {{XRReferenceSpace}} is requested, the user agent MUST <dfn>create a ref

1. Let |session| be the {{XRSession}} object that requested creation of a reference space.
1. Let |type| be set to the {{XRReferenceSpaceType}} passed to {{requestReferenceSpace()}}.
1. If |type| is {{bounded-floor}}, let |referenceSpace| be a new {{XRBoundedReferenceSpace}}.
1. Else let |referenceSpace| be a new {{XRReferenceSpace}}.
1. Initialize |referenceSpace|'s [=XRReferenceSpace/type=] to be |type|.
1. Initialize [=XRSpace/session=] to be |session|.
1. Return |referenceSpace|.
1. If the [=reference space is supported=] for |type| and |session|, run the following steps:
1. If |type| is {{bounded-floor}}, let |referenceSpace| be a new {{XRBoundedReferenceSpace}}.
1. Else let |referenceSpace| be a new {{XRReferenceSpace}}.
1. Initialize |referenceSpace|'s [=XRReferenceSpace/type=] to be |type|.
1. Initialize |referenceSpace|'s [=XRSpace/session=] to be |session|.
1. Return |referenceSpace|
1. Else, return <code>null</code>.

</div>

<div class="algorithm" data-algorithm="reference-space-supported">
To check if a <dfn>reference space is supported</dfn> for a given reference space type |type| and {{XRSession}} |session|, run the following steps:


1. If |type| is {{inline}}, return <code>true</code>.
1. If |type| is {{local}} or {{local-floor}}, and |session| is an [=immersive session=], return <code>true</code>.
1. If |type| is {{local}} or {{local-floor}}, and the [=/XR device=] supports reporting orientation data, return <code>true</code>.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm, apps should be able to get a local reference space even before the session becomes immersive?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sessions do not "become" immersive, they are a single mode for their lifetime. Inline sessions should be able to create local reference spaces, assuming the UA has properly handled the privacy implications (ongoing discussion).

1. If |type| is {{bounded-floor}} and |session| is an [=immersive session=], return if [=bounded reference spaces are supported=] by the [=/XR device=].
1. If |type| is {{unbounded}}, |session| is an [=immersive session=], and the [=/XR device=] supports stable tracking near the user over an unlimited distance, return <code>true</code>.
1. Return <code>false</code>.

</div>

Expand Down Expand Up @@ -877,6 +892,15 @@ Each {{XRBoundedReferenceSpace}} has a <dfn for="XRBoundedReferenceSpace">native

The <dfn attribute for="XRBoundedReferenceSpace">boundsGeometry</dfn> attribute is an array of {{DOMPointReadOnly}}s such that each entry is equal to the entry in the {{XRBoundedReferenceSpace}}'s [=XRBoundedReferenceSpace/native bounds geometry=] premultiplied by the {{XRRigidTransform/inverse}} of the [=XRSpace/origin offset=]. In other words, it provides the same border in {{XRBoundedReferenceSpace}} coordinates relative to the [=XRSpace/effective origin=].


<div class="algorithm" data-algorithm="bounded-space-supported">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thetuvix are you on board with this language? If not, please feel free to propose an alternative when you update your tracking loss PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a reasonable approach. If the device can produce a floor-based coordinate system, but doesn't know boundaries, it should only support local-floor.

If the device somehow knows boundaries without knowing the floor, I suppose the UA could estimate the floor as with local-floor, but I don't know of any such devices today, so that would be more theoretical. We can always relax this later.

To check if <dfn>bounded reference spaces are supported</dfn> run the following steps:
1. If the [=/XR device=] cannot report boundaries, return false.
1. If the [=/XR device=] cannot identify the height of the user's physical floor, return false.
1. Return true.
</div>


Note: Content should not require the user to move beyond the {{boundsGeometry}}. It is possible for the user to move beyond the bounds if their physical surroundings allow for it, resulting in position values outside of the polygon they describe. This is not an error condition and should be handled gracefully by page content.

Note: Content generally should not provide a visualization of the {{boundsGeometry}}, as it's the user agent's responsibility to ensure that safety critical information is provided to the user.
Expand Down