Crate webxr_api

source ·
Expand description

This crate defines the Rust API for WebXR. It is implemented by the webxr crate.

Modules

device 🔒
Traits to be implemented by backends
error 🔒
events 🔒
frame 🔒
hand 🔒
hittest 🔒
input 🔒
layer 🔒
mock 🔒
registry 🔒
session 🔒
space 🔒
view 🔒
This crate uses euclid’s typed units, and exposes different coordinate spaces.

Structs

A stand-in type for “the space isn’t statically known since it comes from client side code”
Vec, but better
The per-frame data that is provided by the device. https://www.w3.org/TR/webxr/#xrframe
https://immersive-web.github.io/hit-test/#dictdef-xrhittestoptionsinit
The coordinate space of a hit test result
https://immersive-web.github.io/hit-test/#xrray
Receiving end of a channel using serialized messages.
Sending end of a channel using serialized messages.
An object that represents an XR session. This is owned by the content thread. https://www.w3.org/TR/webxr/#xrsession-interface
A type for building XR sessions
https://immersive-web.github.io/webxr/#dictdef-xrsessioninit
For devices that want to do their own thread management, the SessionThread type is exposed.
Pattern-match on eyes
https://immersive-web.github.io/layers/#xrsubimagetype
For each eye, the pose of that eye, its projection onto its display. For stereo displays, we have a View<LeftEye> and a View<RightEye>. For mono displays, we hagve a View<Viewer> https://immersive-web.github.io/webxr/#xrview
A list of viewports per-eye in the order of fields in Views.

Enums

The coordinate space of a secondary capture view
The coordinate space of the back frustrum of a cubemap
The coordinate space of the bottom frustrum of a cubemap
The coordinate space of the left frustrum of a cubemap
The coordinate space of the right frustrum of a cubemap
The coordinate space of the top frustrum of a cubemap
The normalized device coordinate space, where the display is from (-1,-1) to (1,1).
https://immersive-web.github.io/hit-test/#enumdef-xrhittesttrackabletype
https://immersive-web.github.io/webxr-ar-module/#xrenvironmentblendmode-enum
Errors that can be produced by XR.
Convenience structure for buffering up events when no event callback has been set
The coordinate space of the floor https://immersive-web.github.io/webxr/#dom-xrreferencespacetype-local-floor
The coordinate space of an input device
https://immersive-web.github.io/layers/#enumdef-xrlayerlayout
The coordinate space of the left eye https://immersive-web.github.io/webxr/#dom-xreye-left
The native 3D coordinate space of the device This is not part of the webvr specification.
The coordinate space of the right eye https://immersive-web.github.io/webxr/#dom-xreye-right
https://www.w3.org/TR/webxr/#xrsessionmode-enum
The coordinate space of the viewer https://immersive-web.github.io/webxr/#dom-xrreferencespacetype-viewer
The unnormalized device coordinate space, where the display is from (0,0) to (w,h), measured in pixels.
Whether a device is mono or stereo, and the views it supports.

Constants

Traits

A trait for using an XR device
A trait for discovering XR devices
Devices that need to can run sessions on the main thread.
A trait for discovering mock XR devices

Functions

Create a connected IpcSender and IpcReceiver that transfer messages of a given type privided by type T or inferred by the types of messages sent by the sender.