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 malloc_size_of_derive::MallocSizeOf;
7use serde::{Deserialize, Serialize};
8
9use crate::{InputId, Joint};
10
11#[derive(Clone, Copy, Debug, Serialize, Deserialize, MallocSizeOf)]
12/// A stand-in type for "the space isn't statically known since
13/// it comes from client side code"
14pub struct ApiSpace;
15
16#[derive(Clone, Copy, Debug, PartialEq, Serialize, 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, Serialize, Deserialize)]
28pub struct Space {
29    pub base: BaseSpace,
30    pub offset: RigidTransform3D<f32, ApiSpace, ApiSpace>,
31}