FakeXrSession class final
An XrSession with nothing behind it: frames come when asked, at a fixed period, from frameAt; what the engine ends them with is kept in ended.
Every seam of the contract, driven from a test. Its capabilities are what the test gives it, so a refusal is tested by leaving one out; its frames carry whatever poses, inputs, planes, light and depth frameAt puts in them; its swapchain is an array texture on the engine's own device; its anchors are kept in memory under ids it makes, and outlive a session the way a runtime's persisted anchors do when the same store is handed to the next one.
Constructors
-
FakeXrSession({Set<
XrCapability> ? capabilities, double period = 1 / 90, double startTime = 100.0, XrFrame frameAt(FakeXrSession session, int index)?, Map<String, XrAnchor> ? anchorStore}) -
A session reporting
capabilities, whose framenis shown atstartTimeplusntimesperiodand is made byframeAt(two eyes 64 mm apart at 1.6 m, looking down −z, by default).
Properties
-
anchorStore
→ Map<
String, XrAnchor> -
The anchors the runtime keeps, by id: hand the same map to the next
session to restore them there.
final
-
capabilities
→ Set<
XrCapability> -
What the runtime can do, asked before start.
final
-
ended
→ List<
XrFrameEnd> -
Every frame the engine ended, in order.
final
- frameAt → XrFrame Function(FakeXrSession session, int index)
-
What frame
indexis.final - framesWaited → int
-
How many frames waitFrame has handed out: what a test reads to see
the engine asked for no frame it did not end (ended).
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- period → double
-
Seconds between frames.
final
-
pulses
→ List<
XrHaptic> -
Every pulse played.
final
- request → XrSessionRequest?
-
What the session was started as; null before start.
no setter
- runtimeName → String
-
Who the session is, as a refusal names it:
WebXR,OpenXR (Quest).no setteroverride - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- startTime → double
-
The display time of the first frame, seconds.
final
- state → XrSessionState
-
Where the session is in its life.
no setteroverride
-
states
→ Stream<
XrSessionState> -
state as it changes.
no setteroverride
-
swapchains
→ List<
FakeXrSwapchain> -
The swapchains made.
final
Methods
-
createSwapchain(
XrSwapchainRequest request) → XrSwapchain -
A swapchain of images the runtime shows, of the shape
requestasks: what the projection layer is drawn into. Refused by default, by a session that draws into Flutter's own surface (XrCapability.inline).override -
end(
) → Future< void> -
Ends the session; state becomes XrSessionState.ended.
override
-
endFrame(
XrFrameEnd end) → void -
Hands the runtime what was drawn for
end.frame, as layers.override -
moveTo(
XrSessionState state) → void -
Moves the session to
state, as a runtime does on its own: a system menu over the app (XrSessionState.visible), the headset taken off (XrSessionState.lost). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
placeAnchor(
XrAnchorRequest request) → Future< XrAnchor> -
Fixes a point to the real world, as
requestasks. Refused by default (XrCapability.anchors).override -
refusal(
XrCapability capability) → UnsupportedCapabilityException -
The refusal of
capabilityby this runtime.inherited -
requireCapabilities(
XrSessionRequest request) → void -
Throws the refusal of the first of
request's mode and required capabilities this runtime lacks; what start calls first.inherited -
restoreAnchor(
String id) → Future< XrAnchor?> -
The anchor kept under
idin an earlier session, where the runtime persists anchors; null when it does not know the id. Refused by default (XrCapability.anchors).override -
start(
XrSessionRequest request) → Future< void> -
Starts the session as
requestasks. Throws anUnsupportedCapabilityExceptionnaming the first capability ofrequest.required(or its mode) the runtime does not have — see requireCapabilities.override -
toString(
) → String -
A string representation of this object.
inherited
-
vibrate(
XrHaptic haptic) → void -
Plays
hapticon a controller. Refused by default (XrCapability.haptics).override -
waitFrame(
) → Future< XrFrame> -
Waits for the runtime's next frame and says what it will be: the
runtime's pace, so it completes when the runtime is ready for the
frame to be drawn.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
standardFrame(
FakeXrSession session, int index) → XrFrame -
The default frame
indexofsession: a head at 1.6 m looking down −z, two eyes 64 mm apart with a headset's asymmetric angles, in the session's space.