aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/webxr/space.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-01-30 20:07:35 +0100
committerGitHub <noreply@github.com>2025-01-30 19:07:35 +0000
commit534e78db5331fbfbad7e60d72a88e9aacdc11ee4 (patch)
tree3bcd217e0e7b7fd0c91d5406a81ea241ffc4ce06 /components/shared/webxr/space.rs
parent64b40ea70065f949d1e281bd046c56d50312f2a7 (diff)
downloadservo-534e78db5331fbfbad7e60d72a88e9aacdc11ee4.tar.gz
servo-534e78db5331fbfbad7e60d72a88e9aacdc11ee4.zip
Merge webxr repository (#35228)
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/shared/webxr/space.rs')
-rw-r--r--components/shared/webxr/space.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/components/shared/webxr/space.rs b/components/shared/webxr/space.rs
new file mode 100644
index 00000000000..4ab116c5b90
--- /dev/null
+++ b/components/shared/webxr/space.rs
@@ -0,0 +1,28 @@
+use crate::InputId;
+use crate::Joint;
+use euclid::RigidTransform3D;
+
+#[derive(Clone, Copy, Debug)]
+#[cfg_attr(feature = "ipc", derive(serde::Serialize, serde::Deserialize))]
+/// A stand-in type for "the space isn't statically known since
+/// it comes from client side code"
+pub struct ApiSpace;
+
+#[derive(Clone, Copy, Debug, PartialEq)]
+#[cfg_attr(feature = "ipc", derive(serde::Serialize, serde::Deserialize))]
+pub enum BaseSpace {
+ Local,
+ Floor,
+ Viewer,
+ BoundedFloor,
+ TargetRay(InputId),
+ Grip(InputId),
+ Joint(InputId, Joint),
+}
+
+#[derive(Clone, Copy, Debug)]
+#[cfg_attr(feature = "ipc", derive(serde::Serialize, serde::Deserialize))]
+pub struct Space {
+ pub base: BaseSpace,
+ pub offset: RigidTransform3D<f32, ApiSpace, ApiSpace>,
+}