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;
6use serde::{Deserialize, Serialize};
7
8use crate::{InputId, Joint};
9
10#[derive(Clone, Copy, Debug, Serialize, 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, Serialize, Deserialize)]
16pub enum BaseSpace {
17    Local,
18    Floor,
19    Viewer,
20    BoundedFloor,
21    TargetRay(InputId),
22    Grip(InputId),
23    Joint(InputId, Joint),
24}
25
26#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
27pub struct Space {
28    pub base: BaseSpace,
29    pub offset: RigidTransform3D<f32, ApiSpace, ApiSpace>,
30}