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 πŸ”’
util
view πŸ”’
This crate uses euclid’s typed units, and exposes different coordinate spaces.

StructsΒ§

ApiSpace
A stand-in type for β€œthe space isn’t statically known since it comes from client side code”
ContextId
EntityTypes
Vec, but better
Finger
Frame
The per-frame data that is provided by the device. https://www.w3.org/TR/webxr/#xrframe
Hand
HandSpace
HitTestId
HitTestResult
HitTestSource
https://immersive-web.github.io/hit-test/#dictdef-xrhittestoptionsinit
HitTestSpace
The coordinate space of a hit test result
InputFrame
InputId
InputSource
JointFrame
LayerGrandManager
LayerId
LayerManager
LayerManagerFactory
MainThreadRegistry
MockButton
MockDeviceInit
MockInputInit
MockRegion
MockViewInit
MockWorld
Quitter
Ray
https://immersive-web.github.io/hit-test/#xrray
Registry
Session
An object that represents an XR session. This is owned by the content thread. https://www.w3.org/TR/webxr/#xrsession-interface
SessionBuilder
A type for building XR sessions
SessionId
SessionInit
https://immersive-web.github.io/webxr/#dictdef-xrsessioninit
SessionThread
For devices that want to do their own thread management, the SessionThread type is exposed.
SomeEye
Pattern-match on eyes
Space
SubImage
https://immersive-web.github.io/layers/#xrsubimagetype
SubImages
Triangle
View
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
ViewerPose
Viewports
A list of viewports per-eye in the order of fields in Views.
WebXrReceiver
Receiving end of a channel using serialized messages.
WebXrSender
Sending end of a channel using serialized messages.

EnumsΒ§

BaseSpace
Capture
The coordinate space of a secondary capture view
CubeBack
The coordinate space of the back frustrum of a cubemap
CubeBottom
The coordinate space of the bottom frustrum of a cubemap
CubeLeft
The coordinate space of the left frustrum of a cubemap
CubeRight
The coordinate space of the right frustrum of a cubemap
CubeTop
The coordinate space of the top frustrum of a cubemap
Display
The normalized device coordinate space, where the display is from (-1,-1) to (1,1).
EntityType
https://immersive-web.github.io/hit-test/#enumdef-xrhittesttrackabletype
EnvironmentBlendMode
https://immersive-web.github.io/webxr-ar-module/#xrenvironmentblendmode-enum
Error
Errors that can be produced by XR.
Event
EventBuffer
Convenience structure for buffering up events when no event callback has been set
FingerJoint
Floor
The coordinate space of the floor https://immersive-web.github.io/webxr/#dom-xrreferencespacetype-local-floor
FrameUpdateEvent
Handedness
Input
The coordinate space of an input device
Joint
LayerInit
LayerLayout
https://immersive-web.github.io/layers/#enumdef-xrlayerlayout
LeftEye
The coordinate space of the left eye https://immersive-web.github.io/webxr/#dom-xreye-left
MockButtonType
MockDeviceMsg
MockInputMsg
MockViewsInit
Native
The native 3D coordinate space of the device This is not part of the webvr specification.
RightEye
The coordinate space of the right eye https://immersive-web.github.io/webxr/#dom-xreye-right
SelectEvent
SelectKind
SessionMode
https://www.w3.org/TR/webxr/#xrsessionmode-enum
TargetRayMode
Viewer
The coordinate space of the viewer https://immersive-web.github.io/webxr/#dom-xrreferencespacetype-viewer
Viewport
The unnormalized device coordinate space, where the display is from (0,0) to (w,h), measured in pixels.
Views
Whether a device is mono or stereo, and the views it supports.
Visibility

ConstantsΒ§

CUBE_BACK
CUBE_BOTTOM
CUBE_LEFT
CUBE_RIGHT
CUBE_TOP
LEFT_EYE
RIGHT_EYE
VIEWER

TraitsΒ§

DeviceAPI
A trait for using an XR device
DiscoveryAPI
A trait for discovering XR devices
GLContexts
GLTypes
LayerGrandManagerAPI
LayerManagerAPI
MainThreadSession
Devices that need to can run sessions on the main thread.
MockDiscoveryAPI
A trait for discovering mock XR devices

FunctionsΒ§

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