From 86b85b13e6e4b1c19b79e866ba1449121ddd06a0 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 28 Oct 2019 16:01:13 -0700 Subject: [PATCH 1/7] Use [=fire an input source event=] algorithm for select and squeeze events --- index.bs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/index.bs b/index.bs index 308ef93f..42beae74 100644 --- a/index.bs +++ b/index.bs @@ -1519,9 +1519,10 @@ Each [=XR input source=] MUST define a primary action. The [=primary
-When an [=XR input source=] for {{XRSession}} |session| begins its [=primary action=] the UA MUST run the following steps: +When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=primary action=] the UA MUST run the following steps: - 1. [=Queue a task=] to [=fire an event|fire=] an {{XRInputSourceEvent}} named {{selectstart!!event}} on |session|. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. [=Queue a task=] to [=fire an input source event=] with name {{selectstart!!event}}, frame |frame|, and source |source|.
@@ -1542,9 +1543,10 @@ Each [=XR input source=] MAY define a primary squeeze action. The [=p
-When an [=XR input source=] for {{XRSession}} |session| begins its [=primary squeeze action=] the UA MUST run the following steps: +When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=primary squeeze action=] the UA MUST run the following steps: - 1. [=Queue a task=] to [=fire an event|fire=] an {{XRInputSourceEvent}} named {{squeezestart!!event}} on |session|. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. [=Queue a task=] to [=fire an input source event=] with name {{squeezestart!!event}}, frame |frame|, and source |source|.
From b3393807746a1f0524e30552c0f6c3d1d94063fa Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 28 Oct 2019 16:13:30 -0700 Subject: [PATCH 2/7] Add XRFrame/time --- index.bs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/index.bs b/index.bs index 42beae74..1bd5e673 100644 --- a/index.bs +++ b/index.bs @@ -863,7 +863,7 @@ When this method is invoked, the user agent MUST run the following steps:
-When an {{XRSession}} |session| receives updated [=viewer=] state from the [=XRSession/XR device=], it runs an XR animation frame with a timestamp |now| and an {{XRFrame}} |frame|, which MUST run the following steps regardless of if the [=list of animation frame callbacks=] is empty or not: +When an {{XRSession}} |session| receives updated [=viewer=] state from the [=XRSession/XR device=], it runs an XR animation frame with a timestamp |now| and an {{XRFrame}} |frame| with [=XRFrame/time=] |now|, which MUST run the following steps regardless of if the [=list of animation frame callbacks=] is empty or not: 1. If |session|'s [=pending render state=] is not null, [=apply the pending render state=]. 1. If |session|'s {{XRSession/renderState}}'s {{XRRenderState/baseLayer}} is null, abort these steps. @@ -956,9 +956,11 @@ Each {{XRFrame}} has an active boolean which is initial The session attribute returns the {{XRSession}} that produced the {{XRFrame}}. +Each {{XRFrame}} represents the state of all tracked objects for a given time, and either stores or is able to query concrete information about this state at the [=XRFrame/time=]. +
-The getViewerPose(|referenceSpace|) method provides the pose of the [=viewer=] relative to |referenceSpace| as an {{XRViewerPose}}, at the time represented by the {{XRFrame}}. +The getViewerPose(|referenceSpace|) method provides the pose of the [=viewer=] relative to |referenceSpace| as an {{XRViewerPose}}, at the {{XRFrame}}'s [=XRFrame/time=]. When this method is invoked, the user agent MUST run the following steps: @@ -1028,7 +1030,7 @@ To populate the pose of an {{XRSpace}} |space| in an {{XRSpace}} |bas 1. Check if [=poses may be reported=] and, if not, throw a {{SecurityError}} 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 time represented by |frame|, then perform the following steps: + 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:
If |limit| is false and the tracking system provides a [=6DoF=] pose whose position is actively tracked or statically known for |space|'s pose relative to |baseSpace|:
Set |transform|'s {{XRRigidTransform/orientation}} to the orientation of |space|'s [=effective origin=] in |baseSpace|'s [=coordinate system=]. @@ -1521,7 +1523,7 @@ Each [=XR input source=] MUST define a primary action. The [=primary When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=primary action=] the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. 1. [=Queue a task=] to [=fire an input source event=] with name {{selectstart!!event}}, frame |frame|, and source |source|.
@@ -1530,7 +1532,7 @@ When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=pr When an [=XR input source=] |source| for {{XRSession}} |session| ends its [=primary action=] the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. 1. [=Queue a task=] to perform the following steps: 1. [=Fire an input source event=] with name {{select!!event}}, frame |frame|, and source |source|. 1. [=Fire an input source event=] with name {{selectend!!event}}, frame |frame|, and source |source|. @@ -1545,7 +1547,7 @@ Each [=XR input source=] MAY define a primary squeeze action. The [=p When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=primary squeeze action=] the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. 1. [=Queue a task=] to [=fire an input source event=] with name {{squeezestart!!event}}, frame |frame|, and source |source|.
@@ -1554,7 +1556,7 @@ When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=pr When an [=XR input source=] |source| for {{XRSession}} |session| ends its [=primary squeeze action=] the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. 1. [=Queue a task=] to perform the following steps: 1. [=Fire an input source event=] with name {{squeeze!!event}}, frame |frame|, and source |source|. 1. [=Fire an input source event=] with name {{squeezeend!!event}}, frame |frame|, and source |source|. @@ -1567,7 +1569,7 @@ Sometimes platform-specific behavior can result in a [=primary action=] or [=pri When an [=XR input source=] |source| for {{XRSession}} |session| has its [=primary action=] cancelled the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. 1. [=Queue a task=] to [=fire an input source event=] an {{XRInputSourceEvent}} with name {{selectend!!event}}, frame |frame|, and source |source|. @@ -1576,7 +1578,7 @@ When an [=XR input source=] |source| for {{XRSession}} |session| has its [=prima When an [=XR input source=] |source| for {{XRSession}} |session| has its [=primary squeeze action=] cancelled the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. 1. [=Queue a task=] to [=fire an input source event=] an {{XRInputSourceEvent}} with name {{squeezeend!!event}}, frame |frame|, and source |source|. @@ -2006,6 +2008,7 @@ The frame attribute is an {{XRFram When the user agent has to fire an input source event with name |name|, {{XRFrame}} |frame|, and {{XRInputSource}} |source| it MUST run the following steps: 1. Create an {{XRInputSourceEvent}} |event| with {{Event/type}} |name|, {{XRInputSourceEvent/frame}} |frame|, and {{XRInputSourceEvent/inputSource}} |source| + 1. 1. Set |frame|'s [=active=] boolean to true. 1. [=Dispatch=] |event| on |frame|'s {{XRFrame/session}} 1. Set |frame|'s [=active=] boolean to false. From 11d7d4e0e24072d0726dc1ce5b2c2eaf9a04f1f2 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 28 Oct 2019 16:24:36 -0700 Subject: [PATCH 3/7] Add empty algorithm for applying frame updates --- index.bs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/index.bs b/index.bs index 1bd5e673..b32d3b93 100644 --- a/index.bs +++ b/index.bs @@ -872,6 +872,7 @@ When an {{XRSession}} |session| receives updated [=viewer=] state from the [=XRS 1. Set |session|'s [=list of animation frame callbacks=] to the empty list. 1. Set |frame|'s [=active=] boolean to true. 1. Set |frame|'s [=animationFrame=] boolean to true. + 1. [=XRFrame/Apply frame updates=] for |frame|. 1. For each entry in |callbacks|, in order: 1. If the entry's [=cancelled=] boolean is true, continue to the next entry. 1. [=Invoke the Web IDL callback function=], passing |now| and |frame| as the arguments @@ -997,6 +998,17 @@ When this method is invoked, the user agent MUST run the following steps: + +
+ +To apply frame updates for an {{XRFrame}}, the user agent MUST run the following steps: + + 1. Do nothing. + +
+ +NOTE: Further specs may add new kinds of frame updates to these steps, e.g. for gamepad state. + Spaces {#spaces} ====== @@ -2010,6 +2022,7 @@ When the user agent has to fire an input source event with name |name 1. Create an {{XRInputSourceEvent}} |event| with {{Event/type}} |name|, {{XRInputSourceEvent/frame}} |frame|, and {{XRInputSourceEvent/inputSource}} |source| 1. 1. Set |frame|'s [=active=] boolean to true. + 1. [=XRFrame/Apply frame updates=] for |frame|. 1. [=Dispatch=] |event| on |frame|'s {{XRFrame/session}} 1. Set |frame|'s [=active=] boolean to false. From a0c69cc2518f57faef8678e7e2c73ef813478846 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 29 Oct 2019 12:18:16 -0700 Subject: [PATCH 4/7] Clean up time in xr animation frame algorithm --- index.bs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.bs b/index.bs index b32d3b93..1a2ecd7c 100644 --- a/index.bs +++ b/index.bs @@ -863,8 +863,9 @@ When this method is invoked, the user agent MUST run the following steps:
-When an {{XRSession}} |session| receives updated [=viewer=] state from the [=XRSession/XR device=], it runs an XR animation frame with a timestamp |now| and an {{XRFrame}} |frame| with [=XRFrame/time=] |now|, which MUST run the following steps regardless of if the [=list of animation frame callbacks=] is empty or not: +When an {{XRSession}} |session| receives updated [=viewer=] state for timestamp |now| from the [=XRSession/XR device=], it runs an XR animation frame, which MUST run the following steps regardless of if the [=list of animation frame callbacks=] is empty or not: + 1. Let |frame| be a new {{XRFrame}} with [=XRFrame/time=] |now| and {{XRFrame/session}} |session|. 1. If |session|'s [=pending render state=] is not null, [=apply the pending render state=]. 1. If |session|'s {{XRSession/renderState}}'s {{XRRenderState/baseLayer}} is null, abort these steps. 1. If |session|'s [=XRSession/mode=] is {{XRSessionMode/"inline"}} and |session|'s {{XRSession/renderState}}'s [=XRRenderState/output canvas=] is null, abort these steps. From 56f7daaa01efd60d04091bbfaf36f834928b1fc4 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 29 Oct 2019 13:20:06 -0700 Subject: [PATCH 5/7] Remove typo --- index.bs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 1a2ecd7c..7ae23611 100644 --- a/index.bs +++ b/index.bs @@ -2020,8 +2020,7 @@ The frame attribute is an {{XRFram When the user agent has to fire an input source event with name |name|, {{XRFrame}} |frame|, and {{XRInputSource}} |source| it MUST run the following steps: - 1. Create an {{XRInputSourceEvent}} |event| with {{Event/type}} |name|, {{XRInputSourceEvent/frame}} |frame|, and {{XRInputSourceEvent/inputSource}} |source| - 1. + 1. Create an {{XRInputSourceEvent}} |event| with {{Event/type}} |name|, {{XRInputSourceEvent/frame}} |frame|, and {{XRInputSourceEvent/inputSource}} |source|. 1. Set |frame|'s [=active=] boolean to true. 1. [=XRFrame/Apply frame updates=] for |frame|. 1. [=Dispatch=] |event| on |frame|'s {{XRFrame/session}} From 32523346db4184cc12b71d6452f35d19c60863c8 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 19 Nov 2019 18:12:59 -0800 Subject: [PATCH 6/7] event -> action --- index.bs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/index.bs b/index.bs index 7ae23611..e196a392 100644 --- a/index.bs +++ b/index.bs @@ -1536,7 +1536,7 @@ Each [=XR input source=] MUST define a primary action. The [=primary When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=primary action=] the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the action occurred. 1. [=Queue a task=] to [=fire an input source event=] with name {{selectstart!!event}}, frame |frame|, and source |source|.
@@ -1545,7 +1545,7 @@ When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=pr When an [=XR input source=] |source| for {{XRSession}} |session| ends its [=primary action=] the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the action occurred. 1. [=Queue a task=] to perform the following steps: 1. [=Fire an input source event=] with name {{select!!event}}, frame |frame|, and source |source|. 1. [=Fire an input source event=] with name {{selectend!!event}}, frame |frame|, and source |source|. @@ -1560,7 +1560,7 @@ Each [=XR input source=] MAY define a primary squeeze action. The [=p When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=primary squeeze action=] the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the action occurred. 1. [=Queue a task=] to [=fire an input source event=] with name {{squeezestart!!event}}, frame |frame|, and source |source|. @@ -1569,7 +1569,7 @@ When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=pr When an [=XR input source=] |source| for {{XRSession}} |session| ends its [=primary squeeze action=] the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the action occurred. 1. [=Queue a task=] to perform the following steps: 1. [=Fire an input source event=] with name {{squeeze!!event}}, frame |frame|, and source |source|. 1. [=Fire an input source event=] with name {{squeezeend!!event}}, frame |frame|, and source |source|. @@ -1582,7 +1582,7 @@ Sometimes platform-specific behavior can result in a [=primary action=] or [=pri When an [=XR input source=] |source| for {{XRSession}} |session| has its [=primary action=] cancelled the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the action occurred. 1. [=Queue a task=] to [=fire an input source event=] an {{XRInputSourceEvent}} with name {{selectend!!event}}, frame |frame|, and source |source|. @@ -1591,7 +1591,7 @@ When an [=XR input source=] |source| for {{XRSession}} |session| has its [=prima When an [=XR input source=] |source| for {{XRSession}} |session| has its [=primary squeeze action=] cancelled the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the action occurred. 1. [=Queue a task=] to [=fire an input source event=] an {{XRInputSourceEvent}} with name {{squeezeend!!event}}, frame |frame|, and source |source|. @@ -1607,7 +1607,7 @@ Some [=/XR device=]s may support transient input sources, where the [ When a [=transient input source=] |source| for {{XRSession}} |session| begins its [=primary action=] the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the action occurred. 1. [=Queue a task=] to perform the following steps: 1. Fire any "pointerdown" events produced by the [=XR input source=]'s action, if necessary. 1. [=add input source|Add the XR input source=] to the [=list of active XR input sources=]. @@ -1619,7 +1619,7 @@ When a [=transient input source=] |source| for {{XRSession}} |session| begins it When a [=transient input source=] |source| for {{XRSession}} |session| ends its [=primary action=] the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the action occurred. 1. [=Queue a task=] to perform the following steps: 1. [=Fire an input source event=] with name {{select!!event}}, frame |frame|, and source |source|. 1. Fire any "click" events produced by the [=XR input source=]'s action, if necessary. @@ -1633,7 +1633,7 @@ When a [=transient input source=] |source| for {{XRSession}} |session| ends its When a [=transient input source=] |source| for {{XRSession}} |session| has its [=primary action=] cancelled the UA MUST run the following steps: - 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the event occurred. + 1. Let |frame| be a new {{XRFrame}} with {{XRFrame/session}} |session| for the time the action occurred. 1. [=Queue a task=] to perform the following steps: 1. [=Fire an input source event=] with name {{selectend!!event}}, frame |frame|, and source |source|. 1. [=remove input source|Remove the XR input source=] from the [=list of active XR input sources=]. From 0760a6a29bfe29d7027ba70f30e4354dcf493869 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Thu, 21 Nov 2019 11:07:39 -0800 Subject: [PATCH 7/7] Explicitly add a list of frame updates --- index.bs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index e196a392..9c33edb1 100644 --- a/index.bs +++ b/index.bs @@ -999,16 +999,20 @@ When this method is invoked, the user agent MUST run the following steps: +A frame update is an algorithm that can be run given an {{XRFrame}}, which is intended to be run each {{XRFrame}}. + +Every {{XRSession}} has a list of frame updates, which is a [=/list=] of [=frame updates=], initially the empty [=/list=].
-To apply frame updates for an {{XRFrame}}, the user agent MUST run the following steps: +To apply frame updates for an {{XRFrame}} |frame|, the user agent MUST run the following steps: - 1. Do nothing. + 1. For each |frame update| in |frame|'s {{XRFrame/session}}'s [=XRSession/list of frame updates=], perform the following steps: + 1. Run |frame update| with |frame|.
-NOTE: Further specs may add new kinds of frame updates to these steps, e.g. for gamepad state. +NOTE: This spec does not define any [=frame updates=], but other specifications may add some. Spaces {#spaces} ======