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

Transient intent addition #1343

Merged
merged 7 commits into from
Oct 5, 2023
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
27 changes: 21 additions & 6 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ In this document, the term <dfn>inline session</dfn> is synonymous with an {{inl

[=Immersive sessions=] MUST provide some level of [=viewer=] tracking, and content MUST be shown at the proper scale relative to the user and/or the surrounding environment. Additionally, [=Immersive sessions=] MUST be given <dfn>exclusive access</dfn> to the [=immersive XR device=], meaning that while the [=immersive session=] is {{XRVisibilityState/"visible"}} the HTML document is not shown on the [=immersive XR device=]'s display, nor does content from any other source have exclusive access. [=Exclusive access=] does not prevent the user agent from overlaying its own UI, however this UI SHOULD be minimal.

Note: UA may choose to overlay content for accessibility or safety such as guardian boundaries, obstructions or the user's hands when there are no alternative input sources.

Note: Future specifications or modules may expand the definition of [=immersive session=] to include additional session modes.

Note: Examples of ways [=exclusive access=] may be presented include stereo content displayed on a virtual reality headset.
Expand Down Expand Up @@ -1259,6 +1261,7 @@ To <dfn>populate the pose</dfn> of an {{XRSpace}} |space| in an {{XRSpace}} |bas
1. If |space|'s [=XRSpace/session=] does not equal |session|, throw an {{InvalidStateError}} and abort these steps.
1. If |baseSpace|'s [=XRSpace/session=] does not equal |session|, throw an {{InvalidStateError}} and abort these steps.
1. Check if [=poses may be reported=] and, if not, throw a {{SecurityError}} and abort these steps.
1. If |session|'s {{XRSession/visibilityState}} is {{XRVisibilityState/"visible-blurred"}} and |space| or |baseSpace| is associated with an {{XRInputSource}}, set |pose| to `null` and abort these steps.
1. Let |limit| be the result of whether [=poses must be limited=] between |space| and |baseSpace|.
1. Let |transform| be |pose|'s {{XRPose/transform}}.
1. Query the [=/XR device=]'s tracking system for |space|'s pose relative to |baseSpace| at the |frame|'s [=XRFrame/time=], then perform the following steps:
Expand Down Expand Up @@ -1734,13 +1737,13 @@ To <dfn for="XRRigidTransform">obtain the matrix</dfn> for a given {{XRRigidTran
1. If the operation {{IsDetachedBuffer}} on [=XRRigidTransform/internal matrix=] is `false`, return |transform|'s [=XRRigidTransform/internal matrix=].
1. Let |translation| be a new [=matrix=] which is a column-vector translation matrix corresponding to {{XRRigidTransform/position}}. Mathematically, if {{XRRigidTransform/position}} is `(x, y, z)`, this matrix is

<img src="images/translation_matrix.svg" width="6733" height="5386" style="height: 6em; width: auto;" alt="Mathematical expression for column-vector translation matrix" />
<img src="images/translation_matrix.svg" width="6733" height="5386" style="height: 6em; width: auto;" alt="Mathematical expression for column-vector translation matrix" >
1. Let |rotation| be a new [=matrix=] which is a column-vector rotation matrix corresponding to {{XRRigidTransform/orientation}}. Mathematically, if {{XRRigidTransform/orientation}} is the unit quaternion (<code>q<sub>x</sub>, q<sub>y</sub>, q<sub>z</sub>, q<sub>w</sub></code>), this matrix is

<img src="images/rotation_matrix.svg" width="24008" height="5817" style="height: 6em; width: auto" alt="Mathematical expression for column-vector rotation matrix" />
<img src="images/rotation_matrix.svg" width="24008" height="5817" style="height: 6em; width: auto" alt="Mathematical expression for column-vector rotation matrix" >
1. Set |transform|'s [=XRRigidTransform/internal matrix=] to a [=new=] {{Float32Array}} in the [=relevant realm=] of |transform| set to the result of multiplying |translation| and |rotation| with |translation| on the left (`translation * rotation`) in the [=relevant realm=] of |transform|. Mathematically, this matrix is

<img src="images/rigid_matrix.svg" width="24080" height="5817" style="height: 6em; width: auto" alt="Mathematical expression for matrix of multiplying translation and rotation with translation on the left" />
<img src="images/rigid_matrix.svg" width="24080" height="5817" style="height: 6em; width: auto" alt="Mathematical expression for matrix of multiplying translation and rotation with translation on the left" >
1. Return |transform|'s [=XRRigidTransform/internal matrix=].

</div>
Expand Down Expand Up @@ -1823,7 +1826,8 @@ enum XRHandedness {
enum XRTargetRayMode {
"gaze",
"tracked-pointer",
"screen"
"screen",
"transient-pointer"
};

[SecureContext, Exposed=Window]
Expand All @@ -1845,11 +1849,16 @@ The <dfn attribute for="XRInputSource">targetRayMode</dfn> attribute describes t
- <dfn enum-value for="XRTargetRayMode">gaze</dfn> indicates the target ray will originate at the viewer and follow the direction it is facing. (This is commonly referred to as a "gaze input" device in the context of head-mounted displays.)
- <dfn enum-value for="XRTargetRayMode">tracked-pointer</dfn> indicates that the target ray originates from either a handheld device or other hand-tracking mechanism and represents that the user is using their hands or the held device for pointing. The orientation of the target ray relative to the tracked object MUST follow platform-specific ergonomics guidelines when available. In the absence of platform-specific guidance, the target ray SHOULD point in the same direction as the user's index finger if it was outstretched.
- <dfn enum-value for="XRTargetRayMode">screen</dfn> indicates that the input source was an interaction with the canvas element associated with an inline session's output context, such as a mouse click or touch event.
- <dfn enum-value for="XRTargetRayMode">transient-pointer</dfn> indicates that the input source was generated as part of an operating system interaction intent rather than a specific piece of hardware. Some examples are user intents based on information too sensitive to expose directly such as gaze, synthesised inputs from web driver or inputs generated by assistive technologies. This should only be used for assistive technologies if it is also used as a primary input so as to not inadvertently indicate that assistive technology is being used as per the W3C design principals.

The <dfn attribute for="XRInputSource">targetRaySpace</dfn> attribute is an {{XRSpace}} that has a [=native origin=] tracking the position and orientation of the preferred pointing ray of the {{XRInputSource}} (along its `-Z` axis), as defined by the {{targetRayMode}}.

For input sources with a {{targetRayMode}} of {{XRTargetRayMode/"transient-pointer"}} the {{targetRaySpace}} represents the ray to the interaction target at the start of the interaction. The pose for this should be static within the gripSpace for this XRInput.

The <dfn attribute for="XRInputSource">gripSpace</dfn> attribute is an {{XRSpace}} that has a [=native origin=] tracking to the pose that should be used to render virtual objects such that they appear to be held in the user's hand. If the user were to hold a straight rod, this {{XRSpace}} places the [=native origin=] at the centroid of their curled fingers and where the `-Z` axis points along the length of the rod towards their thumb. The `X` axis is perpendicular to the back of the hand being described, with the back of the user's right hand pointing towards `+X` and the back of the user's left hand pointing towards `-X`. The `Y` axis is implied by the relationship between the `X` and `Z` axis, with `+Y` roughly pointing in the direction of the user's arm.

For input sources with a {{targetRayMode}} of {{XRTargetRayMode/"transient-pointer"}} the {{gripSpace}} should be the associated user gesture if there is one, otherwise it should be another space the user controls such as the ViewerSpace or the gripSpace or the targetRaySpace of another XRInput. This is to allow user the user to still manipulate the targetRaySpace.

The {{gripSpace}} MUST be `null` if the input source isn't inherently trackable such as for input sources with a {{targetRayMode}} of {{XRTargetRayMode/"gaze"}} or {{XRTargetRayMode/"screen"}}.

The <dfn attribute for="XRInputSource">profiles</dfn> attribute is a [=/list=] of [=input profile name=]s indicating both the prefered visual representation and behavior of the input source.
Expand Down Expand Up @@ -1941,7 +1950,13 @@ When an [=XR input source=] |source| for {{XRSession}} |session| has its [=prima
Transient input {#transient-input}
---------------

Some [=/XR device=]s may support <dfn>transient input sources</dfn>, where the [=XR input source=] is only meaningful while performing a <dfn>transient action</dfn>, either the [=primary action=] for a [=primary input source=], or a device-specific <dfn>auxiliary action</dfn> for an [=auxiliary input source=]. An example would be mouse, touch, or stylus input against an {{XRSessionMode/"inline"}} {{XRSession}}, which MUST produce a transient {{XRInputSource}} with a {{targetRayMode}} set to {{screen}}, treated as a [=primary action=] for the [=primary pointer=], and as a non-primary [=auxiliary action=] for a non-primary pointer. [=Transient input sources=] are only present in the session's [=list of active XR input sources=] for the duration of the [=transient action=].
Some [=/XR device=]s may support <dfn>transient input sources</dfn>, where the [=XR input source=] is only meaningful while performing a <dfn>transient action</dfn>, either the [=primary action=] for a [=primary input source=], or a device-specific <dfn>auxiliary action</dfn> for an [=auxiliary input source=].

One example would be mouse, touch, or stylus input against an {{XRSessionMode/"inline"}} {{XRSession}}, which MUST produce a transient {{XRInputSource}} with a {{targetRayMode}} set to {{screen}}, treated as a [=primary action=] for the [=primary pointer=], and as a non-primary [=auxiliary action=] for a non-primary pointer.

Another example would be intents from the operating system with input derived from sensitive information that cannot be exposed directly, such as interactions based on gaze. These produce a transient {{XRInputSource}} with a {{targetRayMode}} set to {{transient-pointer}}, treated as a [=primary action=].

[=Transient input sources=] are only present in the session's [=list of active XR input sources=] for the duration of the [=transient action=].

[=Transient input sources=] follow the following sequence when handling [=transient actions=] instead of the algorithms for non-transient [=primary actions=]:

Expand Down Expand Up @@ -2607,7 +2622,7 @@ When based on sensor data, {{XRPose}} and {{XRViewerPose}} will expose [=sensiti
To determine if <dfn>poses may be reported</dfn> to an {{XRSession}} |session|, the user agent MUST run the following steps:

1. If |session|'s [=relevant global object=] is not the [=current global object=], return `false`.
1. If |session|'s {{XRSession/visibilityState}} is not {{XRVisibilityState/"visible"}}, return `false`.
1. If |session|'s {{XRSession/visibilityState}} is {{XRVisibilityState/"hidden"}}, return `false`.
1. Determine if the pose data can be returned as follows:
<dl class="switch">
: If the pose data is known by the user agent to not expose fingerprintable sensor data
Expand Down