Skip to content

Commit bef9369

Browse files
committed
Specify that getViewerPose throws an error unless the frame come from a rAF call.
1 parent a37e250 commit bef9369

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

index.bs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ When an {{XRSession}} |session| receives updated [=viewer=] state from the [=/XR
573573
1. Let |callbacks| be a list of the entries in |session|'s [=list of animation frame callback=], in the order in which they were added to the list.
574574
1. Set |session|'s [=list of animation frame callbacks=] to the empty list.
575575
1. Set |frame|'s [=active=] boolean to <code>true</code>.
576+
1. Set |frame|'s [=animationFrame=] boolean to <code>true</code>.
576577
1. For each entry in |callbacks|, in order:
577578
1. If the entry's [=cancelled=] boolean is <code>true</code>, continue to the next entry.
578579
1. [=Invoke the Web IDL callback function=], passing |now| and |frame| as the arguments
@@ -636,7 +637,7 @@ An {{XRFrame}} represents a snapshot of the state of all of the tracked objects
636637
};
637638
</pre>
638639

639-
Each {{XRFrame}} has a <dfn for="XRFrame">active</dfn> boolean which is initially set to <code>false</code>.
640+
Each {{XRFrame}} has a <dfn for="XRFrame">active</dfn> boolean which is initially set to <code>false</code>, and an <dfn for="XRFrame">animationFrame</dfn> boolean which is initially set to <code>false</code>.
640641

641642
The <dfn attribute for="XRFrame">session</dfn> attribute returns the {{XRSession}} that produced the {{XRFrame}}.
642643

@@ -645,6 +646,7 @@ The <dfn attribute for="XRFrame">session</dfn> attribute returns the {{XRSession
645646
When the <dfn method for="XRFrame">getViewerPose(|referenceSpace|)</dfn> method is invoked, the user agent MUST run the following steps:
646647

647648
1. If the {{XRFrame}}'s [=active=] boolean is <code>false</code>, throw a {{InvalidStateError}} and abort these steps.
649+
1. If the {{XRFrame}}'s [=animationFrame=] boolean is <code>false</code>, throw a {{InvalidStateError}} and abort these steps.
648650
1. Let |session| be the {{XRFrame}}'s {{XRFrame/session}} object.
649651
1. If |referenceSpace|'s [=XRSpace/session=] does not equal |session|, throw a {{InvalidStateError}} and abort these steps.
650652
1. If the [=viewer=]'s pose cannot be determined relative to |referenceSpace|, return <code>null</code>

input-explainer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function onSessionStarted(session) {
8787
}
8888
```
8989

90-
All three events are `XRInputSourceEvent` events. When fired the event's `inputSource` attribute will contain the `XRInputSource` that produced the event. The event's `frame` attribute will contain a valid `XRFrame` that can be used to call `getPose()` at the time the selection event occurred. The frame's `getViewerPose()` function will return null.
90+
All three events are `XRInputSourceEvent` events. When fired the event's `inputSource` attribute will contain the `XRInputSource` that produced the event. The event's `frame` attribute will contain a valid `XRFrame` that can be used to call `getPose()` at the time the selection event occurred. Calling the frame's `getViewerPose()` method will throw an `InvalidState` error. (The viewer's pose can still be queried by passing the `XRSession`'s `viewerSpace` to `XRFrame.getPose()`.)
9191

9292
### Transient input sources
9393
Some input sources are only be added to the list of input sources while an action is occurring. For example, those with an `targetRayMode` of 'screen' or those with `targetRayMode` of 'gaze' which are triggered by a voice command. In these cases, `XRInputSource` is only present in the array returned by `getInputSources()` during the lifetime of the action. In this circumstance, the order of events is as follows:

0 commit comments

Comments
 (0)