webxr_api/
space.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use euclid::RigidTransform3D;
6
7use crate::{InputId, Joint};
8
9#[derive(Clone, Copy, Debug)]
10#[cfg_attr(feature = "ipc", derive(serde::Serialize, serde::Deserialize))]
11/// A stand-in type for "the space isn't statically known since
12/// it comes from client side code"
13pub struct ApiSpace;
14
15#[derive(Clone, Copy, Debug, PartialEq)]
16#[cfg_attr(feature = "ipc", derive(serde::Serialize, serde::Deserialize))]
17pub enum BaseSpace {
18    Local,
19    Floor,
20    Viewer,
21    BoundedFloor,
22    TargetRay(InputId),
23    Grip(InputId),
24    Joint(InputId, Joint),
25}
26
27#[derive(Clone, Copy, Debug)]
28#[cfg_attr(feature = "ipc", derive(serde::Serialize, serde::Deserialize))]
29pub struct Space {
30    pub base: BaseSpace,
31    pub offset: RigidTransform3D<f32, ApiSpace, ApiSpace>,
32}