1use euclid::RigidTransform3D;
6use malloc_size_of_derive::MallocSizeOf;
7use serde::{Deserialize, Serialize};
8
9use crate::{Hand, Input, JointFrame, Native};
10
11#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, MallocSizeOf)]
12pub struct InputId(pub u32);
13
14#[derive(Clone, Copy, Debug, Serialize, Deserialize, MallocSizeOf)]
15pub enum Handedness {
16 None,
17 Left,
18 Right,
19}
20
21#[derive(Clone, Copy, Debug, Serialize, Deserialize, MallocSizeOf)]
22pub enum TargetRayMode {
23 Gaze,
24 TrackedPointer,
25 Screen,
26 TransientPointer,
27}
28
29#[derive(Clone, Debug, Serialize, Deserialize, MallocSizeOf)]
30pub struct InputSource {
31 pub handedness: Handedness,
32 pub target_ray_mode: TargetRayMode,
33 pub id: InputId,
34 pub supports_grip: bool,
35 pub hand_support: Option<Hand<()>>,
36 pub profiles: Vec<String>,
37}
38
39#[derive(Clone, Debug, Serialize, Deserialize, MallocSizeOf)]
40pub struct InputFrame {
41 pub id: InputId,
42 pub target_ray_origin: Option<RigidTransform3D<f32, Input, Native>>,
43 pub grip_origin: Option<RigidTransform3D<f32, Input, Native>>,
44 pub pressed: bool,
45 pub hand: Option<Box<Hand<JointFrame>>>,
46 pub squeezed: bool,
47 pub button_values: Vec<f32>,
48 pub axis_values: Vec<f32>,
49 pub input_changed: bool,
50}
51
52#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
53pub enum SelectEvent {
54 Start,
56 End,
58 Select,
60}
61
62#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
63pub enum SelectKind {
64 Select,
65 Squeeze,
66}