diff --git a/index.bs b/index.bs index 388a1a27..965fc951 100755 --- a/index.bs +++ b/index.bs @@ -630,6 +630,7 @@ enum XRVisibilityState { readonly attribute Float32Array? supportedFrameRates; [SameObject] readonly attribute XRRenderState renderState; [SameObject] readonly attribute XRInputSourceArray inputSources; + [SameObject] readonly attribute XRInputSourceArray trackedSources; readonly attribute FrozenArray<DOMString> enabledFeatures; readonly attribute boolean isSystemKeyboardSupported; @@ -831,12 +832,14 @@ When this method is invoked, the user agent MUST run the following steps: -Each {{XRSession}} has a list of active XR input sources (a [=/list=] of {{XRInputSource}}) which MUST be initially an empty [=/list=]. +Each {{XRSession}} has a list of active XR input sources (a [=/list=] of {{XRInputSource}}) and a list of active XR tracked sources (a [=/list=] of {{XRInputSource}}) which MUST both be initially an empty [=/list=]. Each {{XRSession}} has an XR device, which is an [=/XR device=] set at initialization. The inputSources attribute returns the {{XRSession}}'s [=list of active XR input sources=]. +The trackedSources attribute returns the {{XRSession}}'s [=list of active XR tracked sources=]. + The user agent MUST monitor any [=XR input source=]s associated with the [=XRSession/XR device=], including detecting when [=XR input source=]s are added, removed, or changed. Each {{XRSession}} has a promise resolved flag, initially `false`. @@ -848,13 +851,23 @@ NOTE: The purpose of this flag is to ensure that the [=XRSession/add input sourc When new [=XR input source=]s become available for {{XRSession}} |session|, the user agent MUST run the following steps: 1. If |session|'s [=XRSession/promise resolved=] flag is not set, abort these steps. - 1. Let |added| be a new [=/list=]. + 1. Let |added primary sources| be a new [=/list=]. + 1. Let |added tracked sources| be a new [=/list=]. 1. For each new [=XR input source=]: - 1. Let |inputSource| be a [=new=] {{XRInputSource}} in the [=relevant realm=] of this {{XRSession}}. - 1. Add |inputSource| to |added|. + 1. Let |inputSource| be a [=new=] {{XRInputSource}} in the [=relevant realm=] of this {{XRSession}}, then perform the following step: +
+ : If |inputSource| is a [=primary input source=]: + :: + Add |inputSource| to |added primary sources|. + : Otherwise: + :: + Add |inputSource| to |added tracked sources|. +
1. [=Queue a task=] to perform the following steps: - 1. [=list/Extend=] |session|'s [=list of active XR input sources=] with |added|. - 1. Fire an {{XRInputSourcesChangeEvent}} named {{inputsourceschange!!event}} on |session| with {{XRInputSourcesChangeEvent/added}} set to |added|. + 1. [=list/Extend=] |session|'s [=list of active XR input sources=] with |added primary sources|. + 1. If |added primary sources| is not empty, fire an {{XRInputSourcesChangeEvent}} named {{inputsourceschange!!event}} on |session| with {{XRInputSourcesChangeEvent/added}} set to |added primary sources|. + 1. [=list/Extend=] |session|'s [=list of active XR tracked sources=] with |added tracked sources|. + 1. If |added tracked sources| is not empty, fire an {{XRInputSourcesChangeEvent}} named {{trackedsourceschange!!event}} on |session| with {{XRInputSourcesChangeEvent/added}} set to |added tracked sources|. @@ -863,13 +876,23 @@ When new [=XR input source=]s become When any previously added [=XR input source=]s are no longer available for {{XRSession}} |session|, the user agent MUST run the following steps: 1. If |session|'s [=XRSession/promise resolved=] flag is not set, abort these steps. - 1. Let |removed| be a new [=/list=]. + 1. Let |removed primary sources| be a new [=/list=]. + 1. Let |removed tracked sources| be a new [=/list=]. 1. For each [=XR input source=] that is no longer available: - 1. Let |inputSource| be the {{XRInputSource}} in |session|'s [=list of active XR input sources=] associated with the [=XR input source=]. - 1. Add |inputSource| to |removed|. + 1. Let |inputSource| be the {{XRInputSource}} in |session|'s [=list of active XR input sources=] associated with the [=XR input source=], then perform the following step: +
+ : If |inputSource| is a [=primary input source=]: + :: + Add |inputSource| to |removed primary sources|. + : Otherwise: + :: + Add |inputSource| to |removed tracked sources|. +
1. [=Queue a task=] to perform the following steps: - 1. [=list/Remove=] each {{XRInputSource}} in |removed| from |session|'s [=list of active XR input sources=]. - 1. Fire an {{XRInputSourcesChangeEvent}} named {{inputsourceschange!!event}} on |session| with {{XRInputSourcesChangeEvent/removed}} set to |removed|. + 1. [=list/Remove=] each {{XRInputSource}} in |removed primary sources| from |session|'s [=list of active XR input sources=]. + 1. If |removed primary sources| is not empty, fire an {{XRInputSourcesChangeEvent}} named {{inputsourceschange!!event}} on |session| with {{XRInputSourcesChangeEvent/removed}} set to |removed primary sources|. + 1. [=list/Remove=] each {{XRInputSource}} in |removed tracked sources| from |session|'s [=list of active XR tracked sources=]. + 1. If |removed tracked sources| is not empty, fire an {{XRInputSourcesChangeEvent}} named {{trackedsourceschange!!event}} on |session| with {{XRInputSourcesChangeEvent/removed}} set to |removed tracked sources|. Note: The user agent MAY fire this event when an input source temporarily loses both position and orientation tracking. It is recommended that this only be done for physical handheld controller input sources. It is not recommended that this event be fired when this happens for tracked hand input sources, because this will happen often, nor is it recommended when this happens for tracker object input sources, since this makes it harder for the application to maintain a notion of identity. @@ -877,20 +900,39 @@ Note: The user agent MAY fire this event when an input source temporarily loses
-When the {{XRInputSource/handedness}}, {{XRInputSource/targetRayMode}}, {{XRInputSource/profiles}}, or presence of a {{XRInputSource/gripSpace}} for any [=XR input source=]s change for {{XRSession}} |session|, the user agent MUST run the following steps: +When the {{XRInputSource/handedness}}, {{XRInputSource/targetRayMode}}, {{XRInputSource/profiles}}, presence of a {{XRInputSource/gripSpace}} or the status as a [=primary input source=] or [=tracked input source=] for any [=XR input source=]s change for {{XRSession}} |session|, the user agent MUST run the following steps: 1. If |session|'s [=XRSession/promise resolved=] flag is not set, abort these steps. - 1. Let |added| be a new [=/list=]. - 1. Let |removed| be a new [=/list=]. + 1. Let |added primary sources| be a new [=/list=]. + 1. Let |removed primary sources| be a new [=/list=]. + 1. Let |added tracked sources| be a new [=/list=]. + 1. Let |removed tracked sources| be a new [=/list=]. 1. For each changed [=XR input source=]: - 1. Let |oldInputSource| be the {{XRInputSource}} in |session|'s [=list of active XR input sources=] previously associated with the [=XR input source=]. - 1. Let |newInputSource| be a [=new=] {{XRInputSource}} in the [=relevant realm=] of |session|. - 1. Add |oldInputSource| to |removed|. - 1. Add |newInputSource| to |added|. + 1. Let |oldInputSource| be the {{XRInputSource}} in |session|'s [=list of active XR input sources=] previously associated with the [=XR input source=], then perform the following step: +
+ : If |oldInputSource| is a [=primary input source=] or its state changed from a [=primary input source=] to [=tracked input source=] a: + :: + Add |oldInputSource| to |removed primary sources|. + : Otherwise: + :: + Add |oldInputSource| to |removed tracked sources|. +
+ 1. Let |newInputSource| be a [=new=] {{XRInputSource}} in the [=relevant realm=] of |session|, then perform the following step: +
+ : If |newInputSource| is a [=primary input source=] or its state changed from a [=tracked input source=] to [=primary input source=] : + :: + Add |newInputSource| to |added primary sources|. + : Otherwise: + :: + Add |newInputSource| to |added tracked sources|. +
1. [=Queue a task=] to perform the following steps: - 1. [=list/Remove=] each {{XRInputSource}} in |removed| from |session|'s [=list of active XR input sources=]. - 1. [=list/Extend=] |session|'s [=list of active XR input sources=] with |added|. - 1. Fire an {{XRInputSourcesChangeEvent}} named {{inputsourceschange!!event}} on |session| with{{XRInputSourcesChangeEvent/added}} set to |added| and {{XRInputSourcesChangeEvent/removed}} set to |removed|. + 1. [=list/Remove=] each {{XRInputSource}} in |removed primary sources| from |session|'s [=list of active XR input sources=]. + 1. [=list/Extend=] |session|'s [=list of active XR input sources=] with |added primary sources|. + 1. If |added primary sources| or |removed primary sources| are not empty, fire an {{XRInputSourcesChangeEvent}} named {{inputsourceschange!!event}} on |session| with{{XRInputSourcesChangeEvent/added}} set to |added primary sources| and {{XRInputSourcesChangeEvent/removed}} set to |removed primary sources|. + 1. [=list/Remove=] each {{XRInputSource}} in |removed tracked sources| from |session|'s [=list of active XR tracked sources=]. + 1. [=list/Extend=] |session|'s [=list of active XR input sources=] with |added tracked sources|. + 1. If |added tracked sources| or |removed tracked sources| are not empty, fire an {{XRInputSourcesChangeEvent}} named {{trackedsourceschange!!event}} on |session| with {{XRInputSourcesChangeEvent/added}} set to |added tracked sources| and {{XRInputSourcesChangeEvent/removed}} set to |removed tracked sources|.
@@ -1890,7 +1932,8 @@ Note: {{XRInputSource}}s in an {{XRSession}}'s {{XRSession/inputSources}} array An [=XR input source=] is a primary input source if it supports a primary action. The [=primary action=] is a platform-specific action that, when engaged, produces {{XRSession/selectstart}}, {{XRSession/selectend}}, and {{XRSession/select}} events. Examples of possible [=primary action=]s are pressing a trigger, touchpad, or button, speaking a command, or making a hand gesture. If the platform guidelines define a recommended primary input then it should be used as the [=primary action=], otherwise the user agent is free to select one. The device MUST support at least one [=primary input source=]. -An [=XR input source=] is an auxiliary input source if it does not support a [=primary action=], for example [=transient input sources=] associated with secondary screen touches on a multitouch device. +An [=XR input source=] is an tracked input source if it does not support a [=primary action=]. These inputs are primarily intended to provide pose data. +Note: An example of a [=tracked input source=] would be tracking attachments for a users legs or a prop. Tracked hands may also be considered a [=tracked input source=] if there is no gesture recognition being performed to detect [=primary action=]s.
@@ -1957,7 +2000,7 @@ When an [=XR input source=] |source| for {{XRSession}} |session| has its [=prima Transient input {#transient-input} --------------- -Some [=/XR device=]s may support transient input sources, where the [=XR input source=] is only meaningful while performing a transient action, either the [=primary action=] for a [=primary input source=], or a device-specific auxiliary action for an [=auxiliary input source=]. +Some [=/XR device=]s may support transient input sources, where the [=XR input source=] is only meaningful while performing a transient action, either the [=primary action=] for a [=primary input source=], or a device-specific auxiliary action for an [=tracked 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. @@ -2457,7 +2500,7 @@ When the user agent has to fire an input source event with name |name XRInputSourcesChangeEvent {#xrinputsourceschangeevent-interface} ------------------------- -{{XRInputSourcesChangeEvent}}s are fired to indicate changes to the {{XRInputSource}}s that are available to an {{XRSession}}. +{{XRInputSourcesChangeEvent}}s are fired to indicate changes to the [=list of active XR input sources=] that are available to an {{XRSession}}.
 [SecureContext, Exposed=Window]
@@ -2482,7 +2525,6 @@ The added attribute is a [=
 
 The removed attribute is a [=/list=] of {{XRInputSource}}s that were removed from the {{XRSession}} at the time of the event.
 
-
 XRReferenceSpaceEvent {#xrreferencespaceevent-interface}
 ---------------------
 
@@ -2519,6 +2561,8 @@ A user agent MUST [=fire an event=] named end u
 
 A user agent MUST [=fire an event=] named inputsourceschange using {{XRInputSourcesChangeEvent}} on an {{XRSession}} when the session's [=list of active XR input sources=] has changed.
 
+A user agent MUST [=fire an event=] named trackedsourceschange using {{XRInputSourcesChangeEvent}} on an {{XRSession}} when the session's [=list of active XR tracked sources=] has changed.
+
 A user agent MUST [=fire an event=] named selectstart using {{XRInputSourceEvent}} on an {{XRSession}} when one of its {{XRInputSource}}s begins its [=primary action=]. The event MUST be of type .
 
 A user agent MUST [=fire an event=] named selectend using {{XRInputSourceEvent}} on an {{XRSession}} when one of its {{XRInputSource}}s ends its [=primary action=] or when an {{XRInputSource}} that has begun a [=primary action=] is disconnected.