stardust_xr_fusion/
protocol.rs

1#![allow(async_fn_in_trait, unused_parens, clippy::all)]
2use crate::node::NodeType;
3pub(crate) trait AddAspect<A> {
4    fn add_aspect(
5        registry: &crate::scenegraph::NodeRegistry,
6        node_id: u64,
7        aspect_id: u64,
8    );
9}
10#[allow(unused_imports)]
11use root::*;
12pub mod root {
13    #[allow(unused_imports)]
14    use super::*;
15    pub(crate) const INTERFACE_VERSION: u32 = 1u32;
16    ///
17    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
18    pub struct FrameInfo {
19        pub delta: f32,
20        pub elapsed: f32,
21    }
22    ///The persistent state of a Stardust client.
23    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
24    pub struct ClientState {
25        pub data: Option<Vec<u8>>,
26        pub root: u64,
27        pub spatial_anchors: stardust_xr::values::Map<String, u64>,
28    }
29    ///The hub of the client. Spatially this is positioned where the client is started so is a stable base to position things relative to.
30    #[derive(Debug, Clone)]
31    pub struct Root {
32        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
33        pub(crate) root_event: std::sync::Arc<
34            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<RootEvent>>,
35        >,
36    }
37    impl Root {
38        pub(crate) fn from_id(
39            client: &std::sync::Arc<crate::client::ClientHandle>,
40            id: u64,
41            owned: bool,
42        ) -> Self {
43            let core = std::sync::Arc::new(
44                crate::node::NodeCore::new(client.clone(), id, owned),
45            );
46            let root_event = std::sync::Arc::new(
47                client.registry.add_aspect(id, 7212020743076450030u64).into(),
48            );
49            Root { core, root_event }
50        }
51        pub fn as_spatial_ref(self) -> super::SpatialRef {
52            super::SpatialRef {
53                core: self.core,
54            }
55        }
56    }
57    impl crate::node::NodeType for Root {
58        fn node(&self) -> &crate::node::NodeCore {
59            &self.core
60        }
61    }
62    impl std::hash::Hash for Root {
63        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
64            self.core.id.hash(state);
65        }
66    }
67    impl std::cmp::PartialEq for Root {
68        fn eq(&self, other: &Self) -> bool {
69            self.core.id == other.core.id
70        }
71    }
72    impl std::cmp::Eq for Root {}
73    impl serde::Serialize for Root {
74        fn serialize<S: serde::Serializer>(
75            &self,
76            serializer: S,
77        ) -> Result<S::Ok, S::Error> {
78            serializer.serialize_u64(self.core.id)
79        }
80    }
81    impl SpatialRefAspect for Root {}
82    impl RootAspect for Root {
83        fn recv_root_event(&self) -> Option<RootEvent> {
84            self.root_event.lock().unwrap().try_recv().ok()
85        }
86    }
87    #[derive(Debug)]
88    pub enum RootEvent {
89        Ping { response: crate::TypedMethodResponse<()> },
90        Frame { info: FrameInfo },
91        SaveState { response: crate::TypedMethodResponse<ClientState> },
92    }
93    impl crate::scenegraph::EventParser for RootEvent {
94        const ASPECT_ID: u64 = 7212020743076450030u64;
95        fn parse_signal(
96            _client: &std::sync::Arc<crate::client::ClientHandle>,
97            signal_id: u64,
98            _data: &[u8],
99            _fds: Vec<std::os::fd::OwnedFd>,
100        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
101            match signal_id {
102                2586777469268117179u64 => {
103                    let (info): (FrameInfo) = stardust_xr::schemas::flex::deserialize(
104                        _data,
105                    )?;
106                    tracing::trace!(
107                        ? info, "Got signal from server, {}::{}", "Root", "frame"
108                    );
109                    Ok(RootEvent::Frame { info: info })
110                }
111                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
112            }
113        }
114        fn parse_method(
115            _client: &std::sync::Arc<crate::client::ClientHandle>,
116            method_id: u64,
117            _data: &[u8],
118            _fds: Vec<std::os::fd::OwnedFd>,
119            response: stardust_xr::messenger::MethodResponse,
120        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
121            match method_id {
122                1374738518356883234u64 => {
123                    let (): () = stardust_xr::schemas::flex::deserialize(_data)?;
124                    tracing::trace!("Method called from server, {}::{}", "Root", "ping");
125                    Ok(RootEvent::Ping {
126                        response: crate::TypedMethodResponse(
127                            response,
128                            std::marker::PhantomData,
129                        ),
130                    })
131                }
132                6559167809188075643u64 => {
133                    let (): () = stardust_xr::schemas::flex::deserialize(_data)?;
134                    tracing::trace!(
135                        "Method called from server, {}::{}", "Root", "save_state"
136                    );
137                    Ok(RootEvent::SaveState {
138                        response: crate::TypedMethodResponse(
139                            response,
140                            std::marker::PhantomData,
141                        ),
142                    })
143                }
144                _ => {
145                    let _ = response
146                        .send(
147                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
148                        );
149                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
150                }
151            }
152        }
153    }
154    ///The hub of the client. Spatially this is positioned where the client is started so is a stable base to position things relative to.
155    pub trait RootAspect: crate::node::NodeType + super::SpatialRefAspect + std::fmt::Debug {
156        fn recv_root_event(&self) -> Option<RootEvent>;
157        ///Get the current state. Useful to check the state before you initialize your application!
158        async fn get_state(&self) -> crate::node::NodeResult<ClientState> {
159            {
160                let mut _fds = Vec::new();
161                let data = ();
162                {
163                    let () = &data;
164                    tracing::trace!(
165                        "Called method on server, {}::{}", "Root", "get_state"
166                    );
167                }
168                let result: ClientState = self
169                    .node()
170                    .call_method(
171                        7212020743076450030u64,
172                        14958324855167218950u64,
173                        &data,
174                        _fds,
175                    )
176                    .await?;
177                let deserialized = result;
178                tracing::trace!(
179                    "return" = ? deserialized, "Method return from server, {}::{}",
180                    "Root", "get_state"
181                );
182                Ok(deserialized)
183            }
184        }
185        /**
186			Generate a client state token and return it back.
187
188			When launching a new client, set the environment variable `STARDUST_STARTUP_TOKEN` to the returned string.
189			Make sure the environment variable shows in `/proc/{pid}/environ` as that's the only reliable way to pass the value to the server (suggestions welcome).
190		*/
191        async fn generate_state_token(
192            &self,
193            state: ClientState,
194        ) -> crate::node::NodeResult<String> {
195            {
196                let mut _fds = Vec::new();
197                let data = (state);
198                {
199                    let (state) = &data;
200                    tracing::trace!(
201                        ? state, "Called method on server, {}::{}", "Root",
202                        "generate_state_token"
203                    );
204                }
205                let result: String = self
206                    .node()
207                    .call_method(
208                        7212020743076450030u64,
209                        530863980839400599u64,
210                        &data,
211                        _fds,
212                    )
213                    .await?;
214                let deserialized = result;
215                tracing::trace!(
216                    "return" = ? deserialized, "Method return from server, {}::{}",
217                    "Root", "generate_state_token"
218                );
219                Ok(deserialized)
220            }
221        }
222        ///Get a hashmap of all the environment variables to connect a given app to the stardust server
223        async fn get_connection_environment(
224            &self,
225        ) -> crate::node::NodeResult<stardust_xr::values::Map<String, String>> {
226            {
227                let mut _fds = Vec::new();
228                let data = ();
229                {
230                    let () = &data;
231                    tracing::trace!(
232                        "Called method on server, {}::{}", "Root",
233                        "get_connection_environment"
234                    );
235                }
236                let result: stardust_xr::values::Map<String, String> = self
237                    .node()
238                    .call_method(
239                        7212020743076450030u64,
240                        3344613215577382567u64,
241                        &data,
242                        _fds,
243                    )
244                    .await?;
245                let deserialized = result
246                    .into_iter()
247                    .map(|(k, a)| Ok((k, a)))
248                    .collect::<
249                        Result<
250                            stardust_xr::values::Map<String, _>,
251                            crate::node::NodeError,
252                        >,
253                    >()?;
254                tracing::trace!(
255                    "return" = ? deserialized, "Method return from server, {}::{}",
256                    "Root", "get_connection_environment"
257                );
258                Ok(deserialized)
259            }
260        }
261        ///Set initial list of folders to look for namespaced resources in
262        fn set_base_prefixes(&self, prefixes: &[String]) -> crate::node::NodeResult<()> {
263            let mut _fds = Vec::new();
264            let data = (prefixes
265                .iter()
266                .map(|a| Ok(a))
267                .collect::<crate::node::NodeResult<Vec<_>>>()?);
268            self.node()
269                .send_signal(
270                    7212020743076450030u64,
271                    3714507829296596139u64,
272                    &data,
273                    _fds,
274                )?;
275            let (prefixes) = data;
276            tracing::trace!(
277                ? prefixes, "Sent signal to server, {}::{}", "Root", "set_base_prefixes"
278            );
279            Ok(())
280        }
281        ///Cleanly disconnect from the server
282        fn disconnect(&self) -> crate::node::NodeResult<()> {
283            let mut _fds = Vec::new();
284            let data = ();
285            self.node()
286                .send_signal(
287                    7212020743076450030u64,
288                    662137628972844924u64,
289                    &data,
290                    _fds,
291                )?;
292            let () = data;
293            tracing::trace!("Sent signal to server, {}::{}", "Root", "disconnect");
294            Ok(())
295        }
296    }
297}
298#[allow(unused_imports)]
299use node::*;
300pub mod node {
301    #[allow(unused_imports)]
302    use super::*;
303    pub(crate) const INTERFACE_VERSION: u32 = 1u32;
304    #[derive(Debug)]
305    pub enum OwnedEvent {}
306    ///This node was created by the current client and can be disabled/destroyed
307    pub trait OwnedAspect: crate::node::NodeType + std::fmt::Debug {
308        ///Set if this node is enabled or not. Disabled drawables won't render, input handlers won't receive input, etc.
309        fn set_enabled(&self, enabled: bool) -> crate::node::NodeResult<()> {
310            let mut _fds = Vec::new();
311            let data = (enabled);
312            self.node()
313                .send_signal(
314                    15801764205032075891u64,
315                    13365497663235993822u64,
316                    &data,
317                    _fds,
318                )?;
319            let (enabled) = data;
320            tracing::trace!(
321                ? enabled, "Sent signal to server, {}::{}", "Owned", "set_enabled"
322            );
323            Ok(())
324        }
325        ///Destroy this node immediately. Not all nodes will have this method, those that don't can be dropped client-side without issue.
326        fn destroy(&self) -> crate::node::NodeResult<()> {
327            let mut _fds = Vec::new();
328            let data = ();
329            self.node()
330                .send_signal(
331                    15801764205032075891u64,
332                    8637450960623370830u64,
333                    &data,
334                    _fds,
335                )?;
336            let () = data;
337            tracing::trace!("Sent signal to server, {}::{}", "Owned", "destroy");
338            Ok(())
339        }
340    }
341}
342#[allow(unused_imports)]
343use spatial::*;
344pub mod spatial {
345    #[allow(unused_imports)]
346    use super::*;
347    pub(crate) const INTERFACE_VERSION: u32 = 1u32;
348    pub(crate) const INTERFACE_NODE_ID: u64 = 1u64;
349    ///
350    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
351    pub struct BoundingBox {
352        pub center: stardust_xr::values::Vector3<f32>,
353        pub size: stardust_xr::values::Vector3<f32>,
354    }
355    ///
356    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
357    pub struct Transform {
358        pub translation: Option<stardust_xr::values::Vector3<f32>>,
359        pub rotation: Option<stardust_xr::values::Quaternion>,
360        pub scale: Option<stardust_xr::values::Vector3<f32>>,
361    }
362    /**
363		A reference to a node with spatial attributes (position, rotation, scale).
364
365		Equivalent to a Transform in Unity, Spatial in Godot, etc.
366	*/
367    #[derive(Debug, Clone)]
368    pub struct SpatialRef {
369        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
370    }
371    impl SpatialRef {
372        pub(crate) fn from_id(
373            client: &std::sync::Arc<crate::client::ClientHandle>,
374            id: u64,
375            owned: bool,
376        ) -> Self {
377            let core = std::sync::Arc::new(
378                crate::node::NodeCore::new(client.clone(), id, owned),
379            );
380            SpatialRef { core }
381        }
382    }
383    impl crate::node::NodeType for SpatialRef {
384        fn node(&self) -> &crate::node::NodeCore {
385            &self.core
386        }
387    }
388    impl std::hash::Hash for SpatialRef {
389        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
390            self.core.id.hash(state);
391        }
392    }
393    impl std::cmp::PartialEq for SpatialRef {
394        fn eq(&self, other: &Self) -> bool {
395            self.core.id == other.core.id
396        }
397    }
398    impl std::cmp::Eq for SpatialRef {}
399    impl serde::Serialize for SpatialRef {
400        fn serialize<S: serde::Serializer>(
401            &self,
402            serializer: S,
403        ) -> Result<S::Ok, S::Error> {
404            serializer.serialize_u64(self.core.id)
405        }
406    }
407    impl SpatialRefAspect for SpatialRef {}
408    #[derive(Debug)]
409    pub enum SpatialRefEvent {}
410    /**
411		A reference to a node with spatial attributes (position, rotation, scale).
412
413		Equivalent to a Transform in Unity, Spatial in Godot, etc.
414	*/
415    pub trait SpatialRefAspect: crate::node::NodeType + std::fmt::Debug {
416        ///Get the bounding box of this spatial and its children relative to another spatial
417        async fn get_local_bounding_box(&self) -> crate::node::NodeResult<BoundingBox> {
418            {
419                let mut _fds = Vec::new();
420                let data = ();
421                {
422                    let () = &data;
423                    tracing::trace!(
424                        "Called method on server, {}::{}", "SpatialRef",
425                        "get_local_bounding_box"
426                    );
427                }
428                let result: BoundingBox = self
429                    .node()
430                    .call_method(
431                        14774096707642646617u64,
432                        15184457389419466387u64,
433                        &data,
434                        _fds,
435                    )
436                    .await?;
437                let deserialized = result;
438                tracing::trace!(
439                    "return" = ? deserialized, "Method return from server, {}::{}",
440                    "SpatialRef", "get_local_bounding_box"
441                );
442                Ok(deserialized)
443            }
444        }
445        ///Get the bounding box of this spatial and its children relative to itself
446        async fn get_relative_bounding_box(
447            &self,
448            relative_to: &impl SpatialRefAspect,
449        ) -> crate::node::NodeResult<BoundingBox> {
450            {
451                let mut _fds = Vec::new();
452                let data = (relative_to.node().id);
453                {
454                    let (relative_to) = &data;
455                    tracing::trace!(
456                        ? relative_to, "Called method on server, {}::{}", "SpatialRef",
457                        "get_relative_bounding_box"
458                    );
459                }
460                let result: BoundingBox = self
461                    .node()
462                    .call_method(
463                        14774096707642646617u64,
464                        8077745023404307052u64,
465                        &data,
466                        _fds,
467                    )
468                    .await?;
469                let deserialized = result;
470                tracing::trace!(
471                    "return" = ? deserialized, "Method return from server, {}::{}",
472                    "SpatialRef", "get_relative_bounding_box"
473                );
474                Ok(deserialized)
475            }
476        }
477        ///Get the transform relative to some other spatial node.
478        async fn get_transform(
479            &self,
480            relative_to: &impl SpatialRefAspect,
481        ) -> crate::node::NodeResult<Transform> {
482            {
483                let mut _fds = Vec::new();
484                let data = (relative_to.node().id);
485                {
486                    let (relative_to) = &data;
487                    tracing::trace!(
488                        ? relative_to, "Called method on server, {}::{}", "SpatialRef",
489                        "get_transform"
490                    );
491                }
492                let result: Transform = self
493                    .node()
494                    .call_method(
495                        14774096707642646617u64,
496                        6982810219028106561u64,
497                        &data,
498                        _fds,
499                    )
500                    .await?;
501                let deserialized = result;
502                tracing::trace!(
503                    "return" = ? deserialized, "Method return from server, {}::{}",
504                    "SpatialRef", "get_transform"
505                );
506                Ok(deserialized)
507            }
508        }
509    }
510    /**
511		A node with spatial attributes (position, rotation, scale) that can be manipulated by zones if zoneable.
512
513		Equivalent to a Transform in Unity, Spatial in Godot, etc.
514	*/
515    #[derive(Debug, Clone)]
516    pub struct Spatial {
517        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
518    }
519    impl Spatial {
520        pub(crate) fn from_id(
521            client: &std::sync::Arc<crate::client::ClientHandle>,
522            id: u64,
523            owned: bool,
524        ) -> Self {
525            let core = std::sync::Arc::new(
526                crate::node::NodeCore::new(client.clone(), id, owned),
527            );
528            Spatial { core }
529        }
530        pub fn as_spatial_ref(self) -> super::SpatialRef {
531            super::SpatialRef {
532                core: self.core,
533            }
534        }
535    }
536    impl crate::node::NodeType for Spatial {
537        fn node(&self) -> &crate::node::NodeCore {
538            &self.core
539        }
540    }
541    impl std::hash::Hash for Spatial {
542        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
543            self.core.id.hash(state);
544        }
545    }
546    impl std::cmp::PartialEq for Spatial {
547        fn eq(&self, other: &Self) -> bool {
548            self.core.id == other.core.id
549        }
550    }
551    impl std::cmp::Eq for Spatial {}
552    impl serde::Serialize for Spatial {
553        fn serialize<S: serde::Serializer>(
554            &self,
555            serializer: S,
556        ) -> Result<S::Ok, S::Error> {
557            serializer.serialize_u64(self.core.id)
558        }
559    }
560    impl SpatialRefAspect for Spatial {}
561    impl OwnedAspect for Spatial {}
562    impl SpatialAspect for Spatial {}
563    #[derive(Debug)]
564    pub enum SpatialEvent {}
565    /**
566		A node with spatial attributes (position, rotation, scale) that can be manipulated by zones if zoneable.
567
568		Equivalent to a Transform in Unity, Spatial in Godot, etc.
569	*/
570    pub trait SpatialAspect: crate::node::NodeType + super::SpatialRefAspect + super::OwnedAspect + std::fmt::Debug {
571        ///Set the transform of this spatial relative to its spatial parent.
572        fn set_local_transform(
573            &self,
574            transform: Transform,
575        ) -> crate::node::NodeResult<()> {
576            let mut _fds = Vec::new();
577            let data = (transform);
578            self.node()
579                .send_signal(
580                    17785849468685298036u64,
581                    5092462149256736585u64,
582                    &data,
583                    _fds,
584                )?;
585            let (transform) = data;
586            tracing::trace!(
587                ? transform, "Sent signal to server, {}::{}", "Spatial",
588                "set_local_transform"
589            );
590            Ok(())
591        }
592        ///Set the transform of this spatial relative to another node.
593        fn set_relative_transform(
594            &self,
595            relative_to: &impl SpatialRefAspect,
596            transform: Transform,
597        ) -> crate::node::NodeResult<()> {
598            let mut _fds = Vec::new();
599            let data = (relative_to.node().id, transform);
600            self.node()
601                .send_signal(
602                    17785849468685298036u64,
603                    15020422542376308840u64,
604                    &data,
605                    _fds,
606                )?;
607            let (relative_to, transform) = data;
608            tracing::trace!(
609                ? relative_to, ? transform, "Sent signal to server, {}::{}", "Spatial",
610                "set_relative_transform"
611            );
612            Ok(())
613        }
614        /**
615			Set the spatial parent with its local transform remaining the same.
616			It will silently error and not set the spatial parent if it is to a child of itself.
617		*/
618        fn set_spatial_parent(
619            &self,
620            parent: &impl SpatialRefAspect,
621        ) -> crate::node::NodeResult<()> {
622            let mut _fds = Vec::new();
623            let data = (parent.node().id);
624            self.node()
625                .send_signal(
626                    17785849468685298036u64,
627                    12472379656662040034u64,
628                    &data,
629                    _fds,
630                )?;
631            let (parent) = data;
632            tracing::trace!(
633                ? parent, "Sent signal to server, {}::{}", "Spatial",
634                "set_spatial_parent"
635            );
636            Ok(())
637        }
638        /**
639			Set the spatial parent with its "global" transform remaining the same.
640			It will silently error and not set the spatial parent if it is to a child of itself.
641		*/
642        fn set_spatial_parent_in_place(
643            &self,
644            parent: &impl SpatialRefAspect,
645        ) -> crate::node::NodeResult<()> {
646            let mut _fds = Vec::new();
647            let data = (parent.node().id);
648            self.node()
649                .send_signal(
650                    17785849468685298036u64,
651                    1386737540675144626u64,
652                    &data,
653                    _fds,
654                )?;
655            let (parent) = data;
656            tracing::trace!(
657                ? parent, "Sent signal to server, {}::{}", "Spatial",
658                "set_spatial_parent_in_place"
659            );
660            Ok(())
661        }
662        /**
663			Set if this spatial is zoneable or not.
664			You may want to set this to false when being grabbed or interacted with, then back to true when it's floating inert in space.
665		*/
666        fn set_zoneable(&self, zoneable: bool) -> crate::node::NodeResult<()> {
667            let mut _fds = Vec::new();
668            let data = (zoneable);
669            self.node()
670                .send_signal(
671                    17785849468685298036u64,
672                    14580454097816778715u64,
673                    &data,
674                    _fds,
675                )?;
676            let (zoneable) = data;
677            tracing::trace!(
678                ? zoneable, "Sent signal to server, {}::{}", "Spatial", "set_zoneable"
679            );
680            Ok(())
681        }
682        ///Return a UUID representing this node's SpatialRef that you can send to other clients
683        async fn export_spatial(&self) -> crate::node::NodeResult<u64> {
684            {
685                let mut _fds = Vec::new();
686                let data = ();
687                {
688                    let () = &data;
689                    tracing::trace!(
690                        "Called method on server, {}::{}", "Spatial", "export_spatial"
691                    );
692                }
693                let result: u64 = self
694                    .node()
695                    .call_method(
696                        17785849468685298036u64,
697                        3600225297814947977u64,
698                        &data,
699                        _fds,
700                    )
701                    .await?;
702                let deserialized = result;
703                tracing::trace!(
704                    "return" = ? deserialized, "Method return from server, {}::{}",
705                    "Spatial", "export_spatial"
706                );
707                Ok(deserialized)
708            }
709        }
710    }
711    /**
712		Node to manipulate spatial nodes across clients.
713	*/
714    #[derive(Debug, Clone)]
715    pub struct Zone {
716        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
717        pub(crate) zone_event: std::sync::Arc<
718            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<ZoneEvent>>,
719        >,
720    }
721    impl Zone {
722        pub(crate) fn from_id(
723            client: &std::sync::Arc<crate::client::ClientHandle>,
724            id: u64,
725            owned: bool,
726        ) -> Self {
727            let core = std::sync::Arc::new(
728                crate::node::NodeCore::new(client.clone(), id, owned),
729            );
730            let zone_event = std::sync::Arc::new(
731                client.registry.add_aspect(id, 8505905936867072296u64).into(),
732            );
733            Zone { core, zone_event }
734        }
735        pub fn as_spatial(self) -> super::Spatial {
736            super::Spatial { core: self.core }
737        }
738        pub fn as_spatial_ref(self) -> super::SpatialRef {
739            super::SpatialRef {
740                core: self.core,
741            }
742        }
743    }
744    impl crate::node::NodeType for Zone {
745        fn node(&self) -> &crate::node::NodeCore {
746            &self.core
747        }
748    }
749    impl std::hash::Hash for Zone {
750        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
751            self.core.id.hash(state);
752        }
753    }
754    impl std::cmp::PartialEq for Zone {
755        fn eq(&self, other: &Self) -> bool {
756            self.core.id == other.core.id
757        }
758    }
759    impl std::cmp::Eq for Zone {}
760    impl serde::Serialize for Zone {
761        fn serialize<S: serde::Serializer>(
762            &self,
763            serializer: S,
764        ) -> Result<S::Ok, S::Error> {
765            serializer.serialize_u64(self.core.id)
766        }
767    }
768    impl SpatialAspect for Zone {}
769    impl OwnedAspect for Zone {}
770    impl SpatialRefAspect for Zone {}
771    impl ZoneAspect for Zone {
772        fn recv_zone_event(&self) -> Option<ZoneEvent> {
773            self.zone_event.lock().unwrap().try_recv().ok()
774        }
775    }
776    #[derive(Debug)]
777    pub enum ZoneEvent {
778        Enter { spatial: SpatialRef },
779        Capture { spatial: Spatial },
780        Release { id: u64 },
781        Leave { id: u64 },
782    }
783    impl crate::scenegraph::EventParser for ZoneEvent {
784        const ASPECT_ID: u64 = 8505905936867072296u64;
785        fn parse_signal(
786            _client: &std::sync::Arc<crate::client::ClientHandle>,
787            signal_id: u64,
788            _data: &[u8],
789            _fds: Vec<std::os::fd::OwnedFd>,
790        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
791            match signal_id {
792                17714309963407960406u64 => {
793                    let (spatial): (u64) = stardust_xr::schemas::flex::deserialize(
794                        _data,
795                    )?;
796                    tracing::trace!(
797                        ? spatial, "Got signal from server, {}::{}", "Zone", "enter"
798                    );
799                    Ok(ZoneEvent::Enter {
800                        spatial: SpatialRef::from_id(_client, spatial, false),
801                    })
802                }
803                11313548931929469818u64 => {
804                    let (spatial): (u64) = stardust_xr::schemas::flex::deserialize(
805                        _data,
806                    )?;
807                    tracing::trace!(
808                        ? spatial, "Got signal from server, {}::{}", "Zone", "capture"
809                    );
810                    Ok(ZoneEvent::Capture {
811                        spatial: Spatial::from_id(_client, spatial, false),
812                    })
813                }
814                11905596878821798323u64 => {
815                    let (id): (u64) = stardust_xr::schemas::flex::deserialize(_data)?;
816                    tracing::trace!(
817                        ? id, "Got signal from server, {}::{}", "Zone", "release"
818                    );
819                    Ok(ZoneEvent::Release { id: id })
820                }
821                2707764513383459725u64 => {
822                    let (id): (u64) = stardust_xr::schemas::flex::deserialize(_data)?;
823                    tracing::trace!(
824                        ? id, "Got signal from server, {}::{}", "Zone", "leave"
825                    );
826                    Ok(ZoneEvent::Leave { id: id })
827                }
828                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
829            }
830        }
831        fn parse_method(
832            _client: &std::sync::Arc<crate::client::ClientHandle>,
833            method_id: u64,
834            _data: &[u8],
835            _fds: Vec<std::os::fd::OwnedFd>,
836            response: stardust_xr::messenger::MethodResponse,
837        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
838            match method_id {
839                _ => {
840                    let _ = response
841                        .send(
842                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
843                        );
844                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
845                }
846            }
847        }
848    }
849    /**
850		Node to manipulate spatial nodes across clients.
851	*/
852    pub trait ZoneAspect: crate::node::NodeType + super::SpatialAspect + super::OwnedAspect + super::SpatialRefAspect + std::fmt::Debug {
853        fn recv_zone_event(&self) -> Option<ZoneEvent>;
854        ///
855        fn update(&self) -> crate::node::NodeResult<()> {
856            let mut _fds = Vec::new();
857            let data = ();
858            self.node()
859                .send_signal(
860                    8505905936867072296u64,
861                    4876473203673722513u64,
862                    &data,
863                    _fds,
864                )?;
865            let () = data;
866            tracing::trace!("Sent signal to server, {}::{}", "Zone", "update");
867            Ok(())
868        }
869        ///
870        fn capture(
871            &self,
872            spatial: &impl SpatialRefAspect,
873        ) -> crate::node::NodeResult<()> {
874            let mut _fds = Vec::new();
875            let data = (spatial.node().id);
876            self.node()
877                .send_signal(
878                    8505905936867072296u64,
879                    11313548931929469818u64,
880                    &data,
881                    _fds,
882                )?;
883            let (spatial) = data;
884            tracing::trace!(
885                ? spatial, "Sent signal to server, {}::{}", "Zone", "capture"
886            );
887            Ok(())
888        }
889        ///
890        fn release(
891            &self,
892            spatial: &impl SpatialRefAspect,
893        ) -> crate::node::NodeResult<()> {
894            let mut _fds = Vec::new();
895            let data = (spatial.node().id);
896            self.node()
897                .send_signal(
898                    8505905936867072296u64,
899                    11905596878821798323u64,
900                    &data,
901                    _fds,
902                )?;
903            let (spatial) = data;
904            tracing::trace!(
905                ? spatial, "Sent signal to server, {}::{}", "Zone", "release"
906            );
907            Ok(())
908        }
909    }
910    ///Import a spatial ref from a UUID generated by Spatial::export_spatial
911    pub async fn import_spatial_ref(
912        _client: &std::sync::Arc<crate::client::ClientHandle>,
913        uid: u64,
914    ) -> crate::node::NodeResult<SpatialRef> {
915        let mut _fds = Vec::new();
916        let data = (uid);
917        {
918            let (uid) = &data;
919            tracing::trace!(
920                ? uid, "Called method on server, {}::{}", "Interface",
921                "import_spatial_ref"
922            );
923        }
924        let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
925        let message = _client
926            .message_sender_handle
927            .method(1u64, 0u64, 7309812661610962094u64, &serialized_data, _fds)
928            .await?
929            .map_err(|e| crate::node::NodeError::ReturnedError {
930                e,
931            })?
932            .into_message();
933        let result: u64 = stardust_xr::schemas::flex::deserialize(&message)?;
934        let deserialized = SpatialRef::from_id(_client, result, false);
935        tracing::trace!(
936            "return" = ? deserialized, "Method return from server, {}::{}", "Interface",
937            "import_spatial_ref"
938        );
939        Ok(deserialized)
940    }
941    ///Create a spatial relative to another spatial
942    pub fn create_spatial(
943        _client: &std::sync::Arc<crate::client::ClientHandle>,
944        id: u64,
945        parent: &impl SpatialRefAspect,
946        transform: Transform,
947        zoneable: bool,
948    ) -> crate::node::NodeResult<Spatial> {
949        {
950            let mut _fds = Vec::new();
951            let data = (id, parent.node().id, transform, zoneable);
952            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
953            _client
954                .message_sender_handle
955                .signal(1u64, 0u64, 3949276749019911643u64, &serialized_data, _fds)?;
956            let (id, parent, transform, zoneable) = data;
957            tracing::trace!(
958                ? id, ? parent, ? transform, ? zoneable, "Sent signal to server, {}::{}",
959                "Interface", "create_spatial"
960            );
961        }
962        Ok(Spatial::from_id(_client, id, true))
963    }
964    /**
965	    Create a zone given a field, this zone will become inactive if the field is dropped.
966        Keep in mind the zone and its field are different spatials, they can move independently.
967    */
968    pub fn create_zone(
969        _client: &std::sync::Arc<crate::client::ClientHandle>,
970        id: u64,
971        parent: &impl SpatialRefAspect,
972        transform: Transform,
973        field: &impl FieldAspect,
974    ) -> crate::node::NodeResult<Zone> {
975        {
976            let mut _fds = Vec::new();
977            let data = (id, parent.node().id, transform, field.node().id);
978            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
979            _client
980                .message_sender_handle
981                .signal(1u64, 0u64, 7282214243246353525u64, &serialized_data, _fds)?;
982            let (id, parent, transform, field) = data;
983            tracing::trace!(
984                ? id, ? parent, ? transform, ? field, "Sent signal to server, {}::{}",
985                "Interface", "create_zone"
986            );
987        }
988        Ok(Zone::from_id(_client, id, true))
989    }
990}
991#[allow(unused_imports)]
992use field::*;
993pub mod field {
994    #[allow(unused_imports)]
995    use super::*;
996    pub(crate) const INTERFACE_VERSION: u32 = 1u32;
997    pub(crate) const INTERFACE_NODE_ID: u64 = 2u64;
998    ///The shape of a given field.
999    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
1000    #[serde(tag = "t", content = "c")]
1001    pub enum Shape {
1002        ///Box with a given size in meters
1003        Box(stardust_xr::values::Vector3<f32>),
1004        ///Cylinder aligned to the XZ plane
1005        Cylinder(CylinderShape),
1006        ///Sphere with a given radius in meters
1007        Sphere(f32),
1008        ///Torus aligned to the XZ plane
1009        Torus(TorusShape),
1010    }
1011    ///Information about raymarching a field. All vectors are relative to the spatial reference used.
1012    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
1013    pub struct RayMarchResult {
1014        pub ray_origin: stardust_xr::values::Vector3<f32>,
1015        pub ray_direction: stardust_xr::values::Vector3<f32>,
1016        pub min_distance: f32,
1017        pub deepest_point_distance: f32,
1018        pub ray_length: f32,
1019        pub ray_steps: u32,
1020    }
1021    ///Cylinder shape info
1022    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
1023    pub struct CylinderShape {
1024        pub length: f32,
1025        pub radius: f32,
1026    }
1027    ///Torus shape info
1028    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
1029    pub struct TorusShape {
1030        pub radius_a: f32,
1031        pub radius_b: f32,
1032    }
1033    ///A reference to a signed distance field that you can sample
1034    #[derive(Debug, Clone)]
1035    pub struct FieldRef {
1036        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
1037    }
1038    impl FieldRef {
1039        pub(crate) fn from_id(
1040            client: &std::sync::Arc<crate::client::ClientHandle>,
1041            id: u64,
1042            owned: bool,
1043        ) -> Self {
1044            let core = std::sync::Arc::new(
1045                crate::node::NodeCore::new(client.clone(), id, owned),
1046            );
1047            FieldRef { core }
1048        }
1049        pub fn as_spatial_ref(self) -> super::SpatialRef {
1050            super::SpatialRef {
1051                core: self.core,
1052            }
1053        }
1054    }
1055    impl crate::node::NodeType for FieldRef {
1056        fn node(&self) -> &crate::node::NodeCore {
1057            &self.core
1058        }
1059    }
1060    impl std::hash::Hash for FieldRef {
1061        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1062            self.core.id.hash(state);
1063        }
1064    }
1065    impl std::cmp::PartialEq for FieldRef {
1066        fn eq(&self, other: &Self) -> bool {
1067            self.core.id == other.core.id
1068        }
1069    }
1070    impl std::cmp::Eq for FieldRef {}
1071    impl serde::Serialize for FieldRef {
1072        fn serialize<S: serde::Serializer>(
1073            &self,
1074            serializer: S,
1075        ) -> Result<S::Ok, S::Error> {
1076            serializer.serialize_u64(self.core.id)
1077        }
1078    }
1079    impl SpatialRefAspect for FieldRef {}
1080    impl FieldRefAspect for FieldRef {}
1081    #[derive(Debug)]
1082    pub enum FieldRefEvent {}
1083    ///A reference to a signed distance field that you can sample
1084    pub trait FieldRefAspect: crate::node::NodeType + super::SpatialRefAspect + std::fmt::Debug {
1085        ///Get the distance to the surface of this field relative to the `point` in `space`
1086        async fn distance(
1087            &self,
1088            space: &impl SpatialRefAspect,
1089            point: impl Into<stardust_xr::values::Vector3<f32>>,
1090        ) -> crate::node::NodeResult<f32> {
1091            {
1092                let mut _fds = Vec::new();
1093                let data = (space.node().id, point.into());
1094                {
1095                    let (space, point) = &data;
1096                    tracing::trace!(
1097                        ? space, ? point, "Called method on server, {}::{}", "FieldRef",
1098                        "distance"
1099                    );
1100                }
1101                let result: f32 = self
1102                    .node()
1103                    .call_method(
1104                        10662923473076663509u64,
1105                        12706699825100237095u64,
1106                        &data,
1107                        _fds,
1108                    )
1109                    .await?;
1110                let deserialized = result;
1111                tracing::trace!(
1112                    "return" = ? deserialized, "Method return from server, {}::{}",
1113                    "FieldRef", "distance"
1114                );
1115                Ok(deserialized)
1116            }
1117        }
1118        ///Get a vector pointing away from surface of this field relative to the `point` in `space`
1119        async fn normal(
1120            &self,
1121            space: &impl SpatialRefAspect,
1122            point: impl Into<stardust_xr::values::Vector3<f32>>,
1123        ) -> crate::node::NodeResult<stardust_xr::values::Vector3<f32>> {
1124            {
1125                let mut _fds = Vec::new();
1126                let data = (space.node().id, point.into());
1127                {
1128                    let (space, point) = &data;
1129                    tracing::trace!(
1130                        ? space, ? point, "Called method on server, {}::{}", "FieldRef",
1131                        "normal"
1132                    );
1133                }
1134                let result: stardust_xr::values::Vector3<f32> = self
1135                    .node()
1136                    .call_method(
1137                        10662923473076663509u64,
1138                        10933809934326220183u64,
1139                        &data,
1140                        _fds,
1141                    )
1142                    .await?;
1143                let deserialized = result;
1144                tracing::trace!(
1145                    "return" = ? deserialized, "Method return from server, {}::{}",
1146                    "FieldRef", "normal"
1147                );
1148                Ok(deserialized)
1149            }
1150        }
1151        ///Get the closest point on the surface of this field relative to the `point` in `space`
1152        async fn closest_point(
1153            &self,
1154            space: &impl SpatialRefAspect,
1155            point: impl Into<stardust_xr::values::Vector3<f32>>,
1156        ) -> crate::node::NodeResult<stardust_xr::values::Vector3<f32>> {
1157            {
1158                let mut _fds = Vec::new();
1159                let data = (space.node().id, point.into());
1160                {
1161                    let (space, point) = &data;
1162                    tracing::trace!(
1163                        ? space, ? point, "Called method on server, {}::{}", "FieldRef",
1164                        "closest_point"
1165                    );
1166                }
1167                let result: stardust_xr::values::Vector3<f32> = self
1168                    .node()
1169                    .call_method(
1170                        10662923473076663509u64,
1171                        13473947755141124846u64,
1172                        &data,
1173                        _fds,
1174                    )
1175                    .await?;
1176                let deserialized = result;
1177                tracing::trace!(
1178                    "return" = ? deserialized, "Method return from server, {}::{}",
1179                    "FieldRef", "closest_point"
1180                );
1181                Ok(deserialized)
1182            }
1183        }
1184        ///Get information from the server raymarching the given ray in `space` through this field such as steps, closest/deepest distance, etc.
1185        async fn ray_march(
1186            &self,
1187            space: &impl SpatialRefAspect,
1188            ray_origin: impl Into<stardust_xr::values::Vector3<f32>>,
1189            ray_direction: impl Into<stardust_xr::values::Vector3<f32>>,
1190        ) -> crate::node::NodeResult<RayMarchResult> {
1191            {
1192                let mut _fds = Vec::new();
1193                let data = (space.node().id, ray_origin.into(), ray_direction.into());
1194                {
1195                    let (space, ray_origin, ray_direction) = &data;
1196                    tracing::trace!(
1197                        ? space, ? ray_origin, ? ray_direction,
1198                        "Called method on server, {}::{}", "FieldRef", "ray_march"
1199                    );
1200                }
1201                let result: RayMarchResult = self
1202                    .node()
1203                    .call_method(
1204                        10662923473076663509u64,
1205                        7352457860499612292u64,
1206                        &data,
1207                        _fds,
1208                    )
1209                    .await?;
1210                let deserialized = result;
1211                tracing::trace!(
1212                    "return" = ? deserialized, "Method return from server, {}::{}",
1213                    "FieldRef", "ray_march"
1214                );
1215                Ok(deserialized)
1216            }
1217        }
1218    }
1219    ///A signed distance field with adjustable shape. Replaces colliders.
1220    #[derive(Debug, Clone)]
1221    pub struct Field {
1222        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
1223    }
1224    impl Field {
1225        pub(crate) fn from_id(
1226            client: &std::sync::Arc<crate::client::ClientHandle>,
1227            id: u64,
1228            owned: bool,
1229        ) -> Self {
1230            let core = std::sync::Arc::new(
1231                crate::node::NodeCore::new(client.clone(), id, owned),
1232            );
1233            Field { core }
1234        }
1235        pub fn as_field_ref(self) -> super::FieldRef {
1236            super::FieldRef { core: self.core }
1237        }
1238        pub fn as_spatial_ref(self) -> super::SpatialRef {
1239            super::SpatialRef {
1240                core: self.core,
1241            }
1242        }
1243        pub fn as_spatial(self) -> super::Spatial {
1244            super::Spatial { core: self.core }
1245        }
1246    }
1247    impl crate::node::NodeType for Field {
1248        fn node(&self) -> &crate::node::NodeCore {
1249            &self.core
1250        }
1251    }
1252    impl std::hash::Hash for Field {
1253        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1254            self.core.id.hash(state);
1255        }
1256    }
1257    impl std::cmp::PartialEq for Field {
1258        fn eq(&self, other: &Self) -> bool {
1259            self.core.id == other.core.id
1260        }
1261    }
1262    impl std::cmp::Eq for Field {}
1263    impl serde::Serialize for Field {
1264        fn serialize<S: serde::Serializer>(
1265            &self,
1266            serializer: S,
1267        ) -> Result<S::Ok, S::Error> {
1268            serializer.serialize_u64(self.core.id)
1269        }
1270    }
1271    impl FieldRefAspect for Field {}
1272    impl SpatialRefAspect for Field {}
1273    impl SpatialAspect for Field {}
1274    impl OwnedAspect for Field {}
1275    impl FieldAspect for Field {}
1276    #[derive(Debug)]
1277    pub enum FieldEvent {}
1278    ///A signed distance field with adjustable shape. Replaces colliders.
1279    pub trait FieldAspect: crate::node::NodeType + super::FieldRefAspect + super::SpatialRefAspect + super::SpatialAspect + super::OwnedAspect + std::fmt::Debug {
1280        ///Set the shape of this field (and its parameters)
1281        fn set_shape(&self, shape: Shape) -> crate::node::NodeResult<()> {
1282            let mut _fds = Vec::new();
1283            let data = (shape);
1284            self.node()
1285                .send_signal(
1286                    3948434400034960392u64,
1287                    10076774457453995458u64,
1288                    &data,
1289                    _fds,
1290                )?;
1291            let (shape) = data;
1292            tracing::trace!(
1293                ? shape, "Sent signal to server, {}::{}", "Field", "set_shape"
1294            );
1295            Ok(())
1296        }
1297        ///Return a UUID representing this node's FieldRef that you can send to other clients
1298        async fn export_field(&self) -> crate::node::NodeResult<u64> {
1299            {
1300                let mut _fds = Vec::new();
1301                let data = ();
1302                {
1303                    let () = &data;
1304                    tracing::trace!(
1305                        "Called method on server, {}::{}", "Field", "export_field"
1306                    );
1307                }
1308                let result: u64 = self
1309                    .node()
1310                    .call_method(
1311                        3948434400034960392u64,
1312                        939650650519133349u64,
1313                        &data,
1314                        _fds,
1315                    )
1316                    .await?;
1317                let deserialized = result;
1318                tracing::trace!(
1319                    "return" = ? deserialized, "Method return from server, {}::{}",
1320                    "Field", "export_field"
1321                );
1322                Ok(deserialized)
1323            }
1324        }
1325    }
1326    ///Import a FieldRef from a UUID generated by Field::export_field
1327    pub async fn import_field_ref(
1328        _client: &std::sync::Arc<crate::client::ClientHandle>,
1329        uid: u64,
1330    ) -> crate::node::NodeResult<FieldRef> {
1331        let mut _fds = Vec::new();
1332        let data = (uid);
1333        {
1334            let (uid) = &data;
1335            tracing::trace!(
1336                ? uid, "Called method on server, {}::{}", "Interface", "import_field_ref"
1337            );
1338        }
1339        let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
1340        let message = _client
1341            .message_sender_handle
1342            .method(2u64, 0u64, 5844955584634021418u64, &serialized_data, _fds)
1343            .await?
1344            .map_err(|e| crate::node::NodeError::ReturnedError {
1345                e,
1346            })?
1347            .into_message();
1348        let result: u64 = stardust_xr::schemas::flex::deserialize(&message)?;
1349        let deserialized = FieldRef::from_id(_client, result, false);
1350        tracing::trace!(
1351            "return" = ? deserialized, "Method return from server, {}::{}", "Interface",
1352            "import_field_ref"
1353        );
1354        Ok(deserialized)
1355    }
1356    ///Create a field with the shape of a box
1357    pub fn create_field(
1358        _client: &std::sync::Arc<crate::client::ClientHandle>,
1359        id: u64,
1360        parent: &impl SpatialRefAspect,
1361        transform: Transform,
1362        shape: Shape,
1363    ) -> crate::node::NodeResult<Field> {
1364        {
1365            let mut _fds = Vec::new();
1366            let data = (id, parent.node().id, transform, shape);
1367            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
1368            _client
1369                .message_sender_handle
1370                .signal(2u64, 0u64, 3216373392735127623u64, &serialized_data, _fds)?;
1371            let (id, parent, transform, shape) = data;
1372            tracing::trace!(
1373                ? id, ? parent, ? transform, ? shape, "Sent signal to server, {}::{}",
1374                "Interface", "create_field"
1375            );
1376        }
1377        Ok(Field::from_id(_client, id, true))
1378    }
1379}
1380#[allow(unused_imports)]
1381use audio::*;
1382pub mod audio {
1383    #[allow(unused_imports)]
1384    use super::*;
1385    pub(crate) const INTERFACE_VERSION: u32 = 1u32;
1386    pub(crate) const INTERFACE_NODE_ID: u64 = 10u64;
1387    ///Simple spatial point audio source
1388    #[derive(Debug, Clone)]
1389    pub struct Sound {
1390        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
1391    }
1392    impl Sound {
1393        pub(crate) fn from_id(
1394            client: &std::sync::Arc<crate::client::ClientHandle>,
1395            id: u64,
1396            owned: bool,
1397        ) -> Self {
1398            let core = std::sync::Arc::new(
1399                crate::node::NodeCore::new(client.clone(), id, owned),
1400            );
1401            Sound { core }
1402        }
1403        pub fn as_spatial(self) -> super::Spatial {
1404            super::Spatial { core: self.core }
1405        }
1406        pub fn as_spatial_ref(self) -> super::SpatialRef {
1407            super::SpatialRef {
1408                core: self.core,
1409            }
1410        }
1411    }
1412    impl crate::node::NodeType for Sound {
1413        fn node(&self) -> &crate::node::NodeCore {
1414            &self.core
1415        }
1416    }
1417    impl std::hash::Hash for Sound {
1418        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1419            self.core.id.hash(state);
1420        }
1421    }
1422    impl std::cmp::PartialEq for Sound {
1423        fn eq(&self, other: &Self) -> bool {
1424            self.core.id == other.core.id
1425        }
1426    }
1427    impl std::cmp::Eq for Sound {}
1428    impl serde::Serialize for Sound {
1429        fn serialize<S: serde::Serializer>(
1430            &self,
1431            serializer: S,
1432        ) -> Result<S::Ok, S::Error> {
1433            serializer.serialize_u64(self.core.id)
1434        }
1435    }
1436    impl SpatialAspect for Sound {}
1437    impl OwnedAspect for Sound {}
1438    impl SpatialRefAspect for Sound {}
1439    impl SoundAspect for Sound {}
1440    #[derive(Debug)]
1441    pub enum SoundEvent {}
1442    ///Simple spatial point audio source
1443    pub trait SoundAspect: crate::node::NodeType + super::SpatialAspect + super::OwnedAspect + super::SpatialRefAspect + std::fmt::Debug {
1444        ///Play sound effect
1445        fn play(&self) -> crate::node::NodeResult<()> {
1446            let mut _fds = Vec::new();
1447            let data = ();
1448            self.node()
1449                .send_signal(
1450                    17761155925539609649u64,
1451                    18267594382511242772u64,
1452                    &data,
1453                    _fds,
1454                )?;
1455            let () = data;
1456            tracing::trace!("Sent signal to server, {}::{}", "Sound", "play");
1457            Ok(())
1458        }
1459        ///Stop sound effect
1460        fn stop(&self) -> crate::node::NodeResult<()> {
1461            let mut _fds = Vec::new();
1462            let data = ();
1463            self.node()
1464                .send_signal(
1465                    17761155925539609649u64,
1466                    4968801543080236686u64,
1467                    &data,
1468                    _fds,
1469                )?;
1470            let () = data;
1471            tracing::trace!("Sent signal to server, {}::{}", "Sound", "stop");
1472            Ok(())
1473        }
1474    }
1475    ///Create a sound node. WAV and MP3 are supported.
1476    pub fn create_sound(
1477        _client: &std::sync::Arc<crate::client::ClientHandle>,
1478        id: u64,
1479        parent: &impl SpatialRefAspect,
1480        transform: Transform,
1481        resource: &stardust_xr::values::ResourceID,
1482    ) -> crate::node::NodeResult<Sound> {
1483        {
1484            let mut _fds = Vec::new();
1485            let data = (id, parent.node().id, transform, resource);
1486            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
1487            _client
1488                .message_sender_handle
1489                .signal(10u64, 0u64, 3197851813257440734u64, &serialized_data, _fds)?;
1490            let (id, parent, transform, resource) = data;
1491            tracing::trace!(
1492                ? id, ? parent, ? transform, ? resource, "Sent signal to server, {}::{}",
1493                "Interface", "create_sound"
1494            );
1495        }
1496        Ok(Sound::from_id(_client, id, true))
1497    }
1498}
1499#[allow(unused_imports)]
1500use drawable::*;
1501pub mod drawable {
1502    #[allow(unused_imports)]
1503    use super::*;
1504    pub(crate) const INTERFACE_VERSION: u32 = 1u32;
1505    pub(crate) const INTERFACE_NODE_ID: u64 = 4u64;
1506    ///X alignment
1507    #[derive(
1508        Debug,
1509        Clone,
1510        Copy,
1511        Hash,
1512        PartialEq,
1513        serde_repr::Deserialize_repr,
1514        serde_repr::Serialize_repr
1515    )]
1516    #[repr(u32)]
1517    pub enum XAlign {
1518        Left,
1519        Center,
1520        Right,
1521    }
1522    ///Y alignment
1523    #[derive(
1524        Debug,
1525        Clone,
1526        Copy,
1527        Hash,
1528        PartialEq,
1529        serde_repr::Deserialize_repr,
1530        serde_repr::Serialize_repr
1531    )]
1532    #[repr(u32)]
1533    pub enum YAlign {
1534        Top,
1535        Center,
1536        Bottom,
1537    }
1538    ///How the text fits in a box of any size
1539    #[derive(
1540        Debug,
1541        Clone,
1542        Copy,
1543        Hash,
1544        PartialEq,
1545        serde_repr::Deserialize_repr,
1546        serde_repr::Serialize_repr
1547    )]
1548    #[repr(u32)]
1549    pub enum TextFit {
1550        Wrap,
1551        Clip,
1552        Squeeze,
1553        Exact,
1554        Overflow,
1555    }
1556    ///
1557    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
1558    #[serde(tag = "t", content = "c")]
1559    pub enum MaterialParameter {
1560        Bool(bool),
1561        Int(i32),
1562        UInt(u32),
1563        Float(f32),
1564        Vec2(stardust_xr::values::Vector2<f32>),
1565        Vec3(stardust_xr::values::Vector3<f32>),
1566        Color(stardust_xr::values::Color),
1567        Texture(stardust_xr::values::ResourceID),
1568    }
1569    ///A single point on a line
1570    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
1571    pub struct LinePoint {
1572        pub point: stardust_xr::values::Vector3<f32>,
1573        pub thickness: f32,
1574        pub color: stardust_xr::values::Color,
1575    }
1576    ///A single continuous polyline
1577    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
1578    pub struct Line {
1579        pub points: Vec<LinePoint>,
1580        pub cyclic: bool,
1581    }
1582    ///
1583    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
1584    pub struct TextBounds {
1585        pub bounds: stardust_xr::values::Vector2<f32>,
1586        pub fit: TextFit,
1587        pub anchor_align_x: XAlign,
1588        pub anchor_align_y: YAlign,
1589    }
1590    ///
1591    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
1592    pub struct TextStyle {
1593        pub character_height: f32,
1594        pub color: stardust_xr::values::Color,
1595        pub font: Option<stardust_xr::values::ResourceID>,
1596        pub text_align_x: XAlign,
1597        pub text_align_y: YAlign,
1598        pub bounds: Option<TextBounds>,
1599    }
1600    ///A collection of polylines drawn by the server. Meant for debug, so the spatial transform affects point positions but the thickness is in world space. Any mesh made to represent these lines cannot be distorted.
1601    #[derive(Debug, Clone)]
1602    pub struct Lines {
1603        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
1604    }
1605    impl Lines {
1606        pub(crate) fn from_id(
1607            client: &std::sync::Arc<crate::client::ClientHandle>,
1608            id: u64,
1609            owned: bool,
1610        ) -> Self {
1611            let core = std::sync::Arc::new(
1612                crate::node::NodeCore::new(client.clone(), id, owned),
1613            );
1614            Lines { core }
1615        }
1616        pub fn as_spatial(self) -> super::Spatial {
1617            super::Spatial { core: self.core }
1618        }
1619        pub fn as_spatial_ref(self) -> super::SpatialRef {
1620            super::SpatialRef {
1621                core: self.core,
1622            }
1623        }
1624    }
1625    impl crate::node::NodeType for Lines {
1626        fn node(&self) -> &crate::node::NodeCore {
1627            &self.core
1628        }
1629    }
1630    impl std::hash::Hash for Lines {
1631        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1632            self.core.id.hash(state);
1633        }
1634    }
1635    impl std::cmp::PartialEq for Lines {
1636        fn eq(&self, other: &Self) -> bool {
1637            self.core.id == other.core.id
1638        }
1639    }
1640    impl std::cmp::Eq for Lines {}
1641    impl serde::Serialize for Lines {
1642        fn serialize<S: serde::Serializer>(
1643            &self,
1644            serializer: S,
1645        ) -> Result<S::Ok, S::Error> {
1646            serializer.serialize_u64(self.core.id)
1647        }
1648    }
1649    impl SpatialAspect for Lines {}
1650    impl OwnedAspect for Lines {}
1651    impl SpatialRefAspect for Lines {}
1652    impl LinesAspect for Lines {}
1653    #[derive(Debug)]
1654    pub enum LinesEvent {}
1655    ///A collection of polylines drawn by the server. Meant for debug, so the spatial transform affects point positions but the thickness is in world space. Any mesh made to represent these lines cannot be distorted.
1656    pub trait LinesAspect: crate::node::NodeType + super::SpatialAspect + super::OwnedAspect + super::SpatialRefAspect + std::fmt::Debug {
1657        ///Replace all polylines with the given lines
1658        fn set_lines(&self, lines: &[Line]) -> crate::node::NodeResult<()> {
1659            let mut _fds = Vec::new();
1660            let data = (lines
1661                .iter()
1662                .map(|a| Ok(a))
1663                .collect::<crate::node::NodeResult<Vec<_>>>()?);
1664            self.node()
1665                .send_signal(
1666                    16705186951373789081u64,
1667                    17689001183742889136u64,
1668                    &data,
1669                    _fds,
1670                )?;
1671            let (lines) = data;
1672            tracing::trace!(
1673                ? lines, "Sent signal to server, {}::{}", "Lines", "set_lines"
1674            );
1675            Ok(())
1676        }
1677    }
1678    ///A GLTF model loaded by the server.
1679    #[derive(Debug, Clone)]
1680    pub struct Model {
1681        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
1682    }
1683    impl Model {
1684        pub(crate) fn from_id(
1685            client: &std::sync::Arc<crate::client::ClientHandle>,
1686            id: u64,
1687            owned: bool,
1688        ) -> Self {
1689            let core = std::sync::Arc::new(
1690                crate::node::NodeCore::new(client.clone(), id, owned),
1691            );
1692            Model { core }
1693        }
1694        pub fn as_spatial(self) -> super::Spatial {
1695            super::Spatial { core: self.core }
1696        }
1697        pub fn as_spatial_ref(self) -> super::SpatialRef {
1698            super::SpatialRef {
1699                core: self.core,
1700            }
1701        }
1702    }
1703    impl crate::node::NodeType for Model {
1704        fn node(&self) -> &crate::node::NodeCore {
1705            &self.core
1706        }
1707    }
1708    impl std::hash::Hash for Model {
1709        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1710            self.core.id.hash(state);
1711        }
1712    }
1713    impl std::cmp::PartialEq for Model {
1714        fn eq(&self, other: &Self) -> bool {
1715            self.core.id == other.core.id
1716        }
1717    }
1718    impl std::cmp::Eq for Model {}
1719    impl serde::Serialize for Model {
1720        fn serialize<S: serde::Serializer>(
1721            &self,
1722            serializer: S,
1723        ) -> Result<S::Ok, S::Error> {
1724            serializer.serialize_u64(self.core.id)
1725        }
1726    }
1727    impl SpatialAspect for Model {}
1728    impl OwnedAspect for Model {}
1729    impl SpatialRefAspect for Model {}
1730    impl ModelAspect for Model {}
1731    #[derive(Debug)]
1732    pub enum ModelEvent {}
1733    ///A GLTF model loaded by the server.
1734    pub trait ModelAspect: crate::node::NodeType + super::SpatialAspect + super::OwnedAspect + super::SpatialRefAspect + std::fmt::Debug {
1735        ///Bind a model part to the node with the ID input.
1736        fn bind_model_part(
1737            &self,
1738            id: u64,
1739            part_path: &str,
1740        ) -> crate::node::NodeResult<ModelPart> {
1741            {
1742                let mut _fds = Vec::new();
1743                let data = (id, part_path);
1744                self.node()
1745                    .send_signal(
1746                        11775342128130118047u64,
1747                        18406803564448475833u64,
1748                        &data,
1749                        _fds,
1750                    )?;
1751                let (id, part_path) = data;
1752                tracing::trace!(
1753                    ? id, ? part_path, "Sent signal to server, {}::{}", "Model",
1754                    "bind_model_part"
1755                );
1756            }
1757            Ok(ModelPart::from_id(&self.node().client, id, true))
1758        }
1759    }
1760    ///A graphical node in the GLTF hierarchy for the given model. Can be reparented and have material parameters set on.
1761    #[derive(Debug, Clone)]
1762    pub struct ModelPart {
1763        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
1764    }
1765    impl ModelPart {
1766        pub(crate) fn from_id(
1767            client: &std::sync::Arc<crate::client::ClientHandle>,
1768            id: u64,
1769            owned: bool,
1770        ) -> Self {
1771            let core = std::sync::Arc::new(
1772                crate::node::NodeCore::new(client.clone(), id, owned),
1773            );
1774            ModelPart { core }
1775        }
1776        pub fn as_spatial(self) -> super::Spatial {
1777            super::Spatial { core: self.core }
1778        }
1779        pub fn as_spatial_ref(self) -> super::SpatialRef {
1780            super::SpatialRef {
1781                core: self.core,
1782            }
1783        }
1784    }
1785    impl crate::node::NodeType for ModelPart {
1786        fn node(&self) -> &crate::node::NodeCore {
1787            &self.core
1788        }
1789    }
1790    impl std::hash::Hash for ModelPart {
1791        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1792            self.core.id.hash(state);
1793        }
1794    }
1795    impl std::cmp::PartialEq for ModelPart {
1796        fn eq(&self, other: &Self) -> bool {
1797            self.core.id == other.core.id
1798        }
1799    }
1800    impl std::cmp::Eq for ModelPart {}
1801    impl serde::Serialize for ModelPart {
1802        fn serialize<S: serde::Serializer>(
1803            &self,
1804            serializer: S,
1805        ) -> Result<S::Ok, S::Error> {
1806            serializer.serialize_u64(self.core.id)
1807        }
1808    }
1809    impl SpatialAspect for ModelPart {}
1810    impl OwnedAspect for ModelPart {}
1811    impl SpatialRefAspect for ModelPart {}
1812    impl ModelPartAspect for ModelPart {}
1813    #[derive(Debug)]
1814    pub enum ModelPartEvent {}
1815    ///A graphical node in the GLTF hierarchy for the given model. Can be reparented and have material parameters set on.
1816    pub trait ModelPartAspect: crate::node::NodeType + super::SpatialAspect + super::OwnedAspect + super::SpatialRefAspect + std::fmt::Debug {
1817        ///Set this model part's material to one that cuts a hole in the world. Often used for overlays/passthrough where you want to show the background through an object.
1818        fn apply_holdout_material(&self) -> crate::node::NodeResult<()> {
1819            let mut _fds = Vec::new();
1820            let data = ();
1821            self.node()
1822                .send_signal(
1823                    7912164431074553740u64,
1824                    13817793452575402942u64,
1825                    &data,
1826                    _fds,
1827                )?;
1828            let () = data;
1829            tracing::trace!(
1830                "Sent signal to server, {}::{}", "ModelPart", "apply_holdout_material"
1831            );
1832            Ok(())
1833        }
1834        ///Set the material parameter with `parameter_name` to `value`
1835        fn set_material_parameter(
1836            &self,
1837            parameter_name: &str,
1838            value: MaterialParameter,
1839        ) -> crate::node::NodeResult<()> {
1840            let mut _fds = Vec::new();
1841            let data = (parameter_name, value);
1842            self.node()
1843                .send_signal(
1844                    7912164431074553740u64,
1845                    12609900228877593594u64,
1846                    &data,
1847                    _fds,
1848                )?;
1849            let (parameter_name, value) = data;
1850            tracing::trace!(
1851                ? parameter_name, ? value, "Sent signal to server, {}::{}", "ModelPart",
1852                "set_material_parameter"
1853            );
1854            Ok(())
1855        }
1856    }
1857    ///Text rendered to work best in XR
1858    #[derive(Debug, Clone)]
1859    pub struct Text {
1860        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
1861    }
1862    impl Text {
1863        pub(crate) fn from_id(
1864            client: &std::sync::Arc<crate::client::ClientHandle>,
1865            id: u64,
1866            owned: bool,
1867        ) -> Self {
1868            let core = std::sync::Arc::new(
1869                crate::node::NodeCore::new(client.clone(), id, owned),
1870            );
1871            Text { core }
1872        }
1873        pub fn as_spatial(self) -> super::Spatial {
1874            super::Spatial { core: self.core }
1875        }
1876        pub fn as_spatial_ref(self) -> super::SpatialRef {
1877            super::SpatialRef {
1878                core: self.core,
1879            }
1880        }
1881    }
1882    impl crate::node::NodeType for Text {
1883        fn node(&self) -> &crate::node::NodeCore {
1884            &self.core
1885        }
1886    }
1887    impl std::hash::Hash for Text {
1888        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1889            self.core.id.hash(state);
1890        }
1891    }
1892    impl std::cmp::PartialEq for Text {
1893        fn eq(&self, other: &Self) -> bool {
1894            self.core.id == other.core.id
1895        }
1896    }
1897    impl std::cmp::Eq for Text {}
1898    impl serde::Serialize for Text {
1899        fn serialize<S: serde::Serializer>(
1900            &self,
1901            serializer: S,
1902        ) -> Result<S::Ok, S::Error> {
1903            serializer.serialize_u64(self.core.id)
1904        }
1905    }
1906    impl SpatialAspect for Text {}
1907    impl OwnedAspect for Text {}
1908    impl SpatialRefAspect for Text {}
1909    impl TextAspect for Text {}
1910    #[derive(Debug)]
1911    pub enum TextEvent {}
1912    ///Text rendered to work best in XR
1913    pub trait TextAspect: crate::node::NodeType + super::SpatialAspect + super::OwnedAspect + super::SpatialRefAspect + std::fmt::Debug {
1914        ///Set the character height in meters
1915        fn set_character_height(&self, height: f32) -> crate::node::NodeResult<()> {
1916            let mut _fds = Vec::new();
1917            let data = (height);
1918            self.node()
1919                .send_signal(
1920                    3129045917168168339u64,
1921                    1124886941794143568u64,
1922                    &data,
1923                    _fds,
1924                )?;
1925            let (height) = data;
1926            tracing::trace!(
1927                ? height, "Sent signal to server, {}::{}", "Text", "set_character_height"
1928            );
1929            Ok(())
1930        }
1931        ///Set the text content
1932        fn set_text(&self, text: &str) -> crate::node::NodeResult<()> {
1933            let mut _fds = Vec::new();
1934            let data = (text);
1935            self.node()
1936                .send_signal(
1937                    3129045917168168339u64,
1938                    395974856293277940u64,
1939                    &data,
1940                    _fds,
1941                )?;
1942            let (text) = data;
1943            tracing::trace!(? text, "Sent signal to server, {}::{}", "Text", "set_text");
1944            Ok(())
1945        }
1946    }
1947    ///Set the sky texture to a given HDRI file.
1948    pub fn set_sky_tex(
1949        _client: &std::sync::Arc<crate::client::ClientHandle>,
1950        tex: Option<&stardust_xr::values::ResourceID>,
1951    ) -> crate::node::NodeResult<()> {
1952        let mut _fds = Vec::new();
1953        let data = (tex.map(|o| Ok::<_, crate::node::NodeError>(o)).transpose()?);
1954        let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
1955        _client
1956            .message_sender_handle
1957            .signal(4u64, 0u64, 4424860741442403592u64, &serialized_data, _fds)?;
1958        let (tex) = data;
1959        tracing::trace!(
1960            ? tex, "Sent signal to server, {}::{}", "Interface", "set_sky_tex"
1961        );
1962        Ok(())
1963    }
1964    ///Set the sky lighting to a given HDRI file.
1965    pub fn set_sky_light(
1966        _client: &std::sync::Arc<crate::client::ClientHandle>,
1967        light: Option<&stardust_xr::values::ResourceID>,
1968    ) -> crate::node::NodeResult<()> {
1969        let mut _fds = Vec::new();
1970        let data = (light.map(|o| Ok::<_, crate::node::NodeError>(o)).transpose()?);
1971        let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
1972        _client
1973            .message_sender_handle
1974            .signal(4u64, 0u64, 6210987039553590011u64, &serialized_data, _fds)?;
1975        let (light) = data;
1976        tracing::trace!(
1977            ? light, "Sent signal to server, {}::{}", "Interface", "set_sky_light"
1978        );
1979        Ok(())
1980    }
1981    ///Create a lines node
1982    pub fn create_lines(
1983        _client: &std::sync::Arc<crate::client::ClientHandle>,
1984        id: u64,
1985        parent: &impl SpatialRefAspect,
1986        transform: Transform,
1987        lines: &[Line],
1988    ) -> crate::node::NodeResult<Lines> {
1989        {
1990            let mut _fds = Vec::new();
1991            let data = (
1992                id,
1993                parent.node().id,
1994                transform,
1995                lines.iter().map(|a| Ok(a)).collect::<crate::node::NodeResult<Vec<_>>>()?,
1996            );
1997            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
1998            _client
1999                .message_sender_handle
2000                .signal(4u64, 0u64, 17691651736865216822u64, &serialized_data, _fds)?;
2001            let (id, parent, transform, lines) = data;
2002            tracing::trace!(
2003                ? id, ? parent, ? transform, ? lines, "Sent signal to server, {}::{}",
2004                "Interface", "create_lines"
2005            );
2006        }
2007        Ok(Lines::from_id(_client, id, true))
2008    }
2009    ///Load a GLTF model into a Model node
2010    pub fn load_model(
2011        _client: &std::sync::Arc<crate::client::ClientHandle>,
2012        id: u64,
2013        parent: &impl SpatialRefAspect,
2014        transform: Transform,
2015        model: &stardust_xr::values::ResourceID,
2016    ) -> crate::node::NodeResult<Model> {
2017        {
2018            let mut _fds = Vec::new();
2019            let data = (id, parent.node().id, transform, model);
2020            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
2021            _client
2022                .message_sender_handle
2023                .signal(4u64, 0u64, 8647852218278439936u64, &serialized_data, _fds)?;
2024            let (id, parent, transform, model) = data;
2025            tracing::trace!(
2026                ? id, ? parent, ? transform, ? model, "Sent signal to server, {}::{}",
2027                "Interface", "load_model"
2028            );
2029        }
2030        Ok(Model::from_id(_client, id, true))
2031    }
2032    ///Create a text node
2033    pub fn create_text(
2034        _client: &std::sync::Arc<crate::client::ClientHandle>,
2035        id: u64,
2036        parent: &impl SpatialRefAspect,
2037        transform: Transform,
2038        text: &str,
2039        style: TextStyle,
2040    ) -> crate::node::NodeResult<Text> {
2041        {
2042            let mut _fds = Vec::new();
2043            let data = (id, parent.node().id, transform, text, style);
2044            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
2045            _client
2046                .message_sender_handle
2047                .signal(4u64, 0u64, 11386227176670607870u64, &serialized_data, _fds)?;
2048            let (id, parent, transform, text, style) = data;
2049            tracing::trace!(
2050                ? id, ? parent, ? transform, ? text, ? style,
2051                "Sent signal to server, {}::{}", "Interface", "create_text"
2052            );
2053        }
2054        Ok(Text::from_id(_client, id, true))
2055    }
2056}
2057#[allow(unused_imports)]
2058use input::*;
2059pub mod input {
2060    #[allow(unused_imports)]
2061    use super::*;
2062    pub(crate) const INTERFACE_VERSION: u32 = 1u32;
2063    pub(crate) const INTERFACE_NODE_ID: u64 = 3u64;
2064    ///The special type of an InputMethod.
2065    #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
2066    #[serde(tag = "t", content = "c")]
2067    pub enum InputDataType {
2068        Pointer(Pointer),
2069        Hand(Hand),
2070        Tip(Tip),
2071    }
2072    ///A hand joint. Distance from input handler's field is given because it's cheap to calculate and laggy to request from the server.
2073    #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
2074    pub struct Joint {
2075        pub position: stardust_xr::values::Vector3<f32>,
2076        pub rotation: stardust_xr::values::Quaternion,
2077        pub radius: f32,
2078        pub distance: f32,
2079    }
2080    ///
2081    #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
2082    pub struct Finger {
2083        pub tip: Joint,
2084        pub distal: Joint,
2085        pub intermediate: Joint,
2086        pub proximal: Joint,
2087        pub metacarpal: Joint,
2088    }
2089    ///Different than finger to be explicit about number of joints.
2090    #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
2091    pub struct Thumb {
2092        pub tip: Joint,
2093        pub distal: Joint,
2094        pub proximal: Joint,
2095        pub metacarpal: Joint,
2096    }
2097    ///A fully articulated and tracked hand according to OpenXR spec for its coordinate system and joints.
2098    #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
2099    pub struct Hand {
2100        pub right: bool,
2101        pub thumb: Thumb,
2102        pub index: Finger,
2103        pub middle: Finger,
2104        pub ring: Finger,
2105        pub little: Finger,
2106        pub palm: Joint,
2107        pub wrist: Joint,
2108        pub elbow: Option<Joint>,
2109    }
2110    ///A 3D pointer, such as a gaze pointer for eye tracking or a mouse or a ray from a controller.
2111    #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
2112    pub struct Pointer {
2113        pub origin: stardust_xr::values::Vector3<f32>,
2114        pub orientation: stardust_xr::values::Quaternion,
2115        pub deepest_point: stardust_xr::values::Vector3<f32>,
2116    }
2117    ///Represents a controller, pen tip, spatial cursor, etc. that is just a single point.
2118    #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
2119    pub struct Tip {
2120        pub origin: stardust_xr::values::Vector3<f32>,
2121        pub orientation: stardust_xr::values::Quaternion,
2122    }
2123    ///Information about a given input method's state relative to an input handler. All coordinates are relative to the InputHandler.
2124    #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
2125    pub struct InputData {
2126        pub id: u64,
2127        pub input: InputDataType,
2128        pub distance: f32,
2129        pub datamap: stardust_xr::values::Datamap,
2130        pub order: u32,
2131        pub captured: bool,
2132    }
2133    ///Node representing a spatial input device
2134    #[derive(Debug, Clone)]
2135    pub struct InputMethodRef {
2136        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
2137    }
2138    impl InputMethodRef {
2139        pub(crate) fn from_id(
2140            client: &std::sync::Arc<crate::client::ClientHandle>,
2141            id: u64,
2142            owned: bool,
2143        ) -> Self {
2144            let core = std::sync::Arc::new(
2145                crate::node::NodeCore::new(client.clone(), id, owned),
2146            );
2147            InputMethodRef { core }
2148        }
2149        pub fn as_spatial_ref(self) -> super::SpatialRef {
2150            super::SpatialRef {
2151                core: self.core,
2152            }
2153        }
2154    }
2155    impl crate::node::NodeType for InputMethodRef {
2156        fn node(&self) -> &crate::node::NodeCore {
2157            &self.core
2158        }
2159    }
2160    impl std::hash::Hash for InputMethodRef {
2161        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
2162            self.core.id.hash(state);
2163        }
2164    }
2165    impl std::cmp::PartialEq for InputMethodRef {
2166        fn eq(&self, other: &Self) -> bool {
2167            self.core.id == other.core.id
2168        }
2169    }
2170    impl std::cmp::Eq for InputMethodRef {}
2171    impl serde::Serialize for InputMethodRef {
2172        fn serialize<S: serde::Serializer>(
2173            &self,
2174            serializer: S,
2175        ) -> Result<S::Ok, S::Error> {
2176            serializer.serialize_u64(self.core.id)
2177        }
2178    }
2179    impl SpatialRefAspect for InputMethodRef {}
2180    impl InputMethodRefAspect for InputMethodRef {}
2181    #[derive(Debug)]
2182    pub enum InputMethodRefEvent {}
2183    ///Node representing a spatial input device
2184    pub trait InputMethodRefAspect: crate::node::NodeType + super::SpatialRefAspect + std::fmt::Debug {
2185        ///Try to capture the input method with the given handler. When the handler does not get input from the method, it will be released.
2186        fn try_capture(
2187            &self,
2188            handler: &impl InputHandlerAspect,
2189        ) -> crate::node::NodeResult<()> {
2190            let mut _fds = Vec::new();
2191            let data = (handler.node().id);
2192            self.node()
2193                .send_signal(
2194                    2611007814387963428u64,
2195                    12158986667525139020u64,
2196                    &data,
2197                    _fds,
2198                )?;
2199            let (handler) = data;
2200            tracing::trace!(
2201                ? handler, "Sent signal to server, {}::{}", "InputMethodRef",
2202                "try_capture"
2203            );
2204            Ok(())
2205        }
2206        ///If captured by this handler, release it (e.g. the object is let go of after grabbing).
2207        fn release(
2208            &self,
2209            handler: &impl InputHandlerAspect,
2210        ) -> crate::node::NodeResult<()> {
2211            let mut _fds = Vec::new();
2212            let data = (handler.node().id);
2213            self.node()
2214                .send_signal(
2215                    2611007814387963428u64,
2216                    11905596878821798323u64,
2217                    &data,
2218                    _fds,
2219                )?;
2220            let (handler) = data;
2221            tracing::trace!(
2222                ? handler, "Sent signal to server, {}::{}", "InputMethodRef", "release"
2223            );
2224            Ok(())
2225        }
2226    }
2227    ///Node representing a spatial input device
2228    #[derive(Debug, Clone)]
2229    pub struct InputMethod {
2230        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
2231        pub(crate) input_method_event: std::sync::Arc<
2232            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<InputMethodEvent>>,
2233        >,
2234    }
2235    impl InputMethod {
2236        pub(crate) fn from_id(
2237            client: &std::sync::Arc<crate::client::ClientHandle>,
2238            id: u64,
2239            owned: bool,
2240        ) -> Self {
2241            let core = std::sync::Arc::new(
2242                crate::node::NodeCore::new(client.clone(), id, owned),
2243            );
2244            let input_method_event = std::sync::Arc::new(
2245                client.registry.add_aspect(id, 14883688361483968991u64).into(),
2246            );
2247            InputMethod {
2248                core,
2249                input_method_event,
2250            }
2251        }
2252        pub fn as_input_method_ref(self) -> super::InputMethodRef {
2253            super::InputMethodRef {
2254                core: self.core,
2255            }
2256        }
2257        pub fn as_spatial_ref(self) -> super::SpatialRef {
2258            super::SpatialRef {
2259                core: self.core,
2260            }
2261        }
2262        pub fn as_spatial(self) -> super::Spatial {
2263            super::Spatial { core: self.core }
2264        }
2265    }
2266    impl crate::node::NodeType for InputMethod {
2267        fn node(&self) -> &crate::node::NodeCore {
2268            &self.core
2269        }
2270    }
2271    impl std::hash::Hash for InputMethod {
2272        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
2273            self.core.id.hash(state);
2274        }
2275    }
2276    impl std::cmp::PartialEq for InputMethod {
2277        fn eq(&self, other: &Self) -> bool {
2278            self.core.id == other.core.id
2279        }
2280    }
2281    impl std::cmp::Eq for InputMethod {}
2282    impl serde::Serialize for InputMethod {
2283        fn serialize<S: serde::Serializer>(
2284            &self,
2285            serializer: S,
2286        ) -> Result<S::Ok, S::Error> {
2287            serializer.serialize_u64(self.core.id)
2288        }
2289    }
2290    impl InputMethodRefAspect for InputMethod {}
2291    impl SpatialRefAspect for InputMethod {}
2292    impl SpatialAspect for InputMethod {}
2293    impl OwnedAspect for InputMethod {}
2294    impl InputMethodAspect for InputMethod {
2295        fn recv_input_method_event(&self) -> Option<InputMethodEvent> {
2296            self.input_method_event.lock().unwrap().try_recv().ok()
2297        }
2298    }
2299    #[derive(Debug)]
2300    pub enum InputMethodEvent {
2301        CreateHandler { handler: InputHandler, field: Field },
2302        RequestCaptureHandler { id: u64 },
2303        ReleaseHandler { id: u64 },
2304        DestroyHandler { id: u64 },
2305    }
2306    impl crate::scenegraph::EventParser for InputMethodEvent {
2307        const ASPECT_ID: u64 = 14883688361483968991u64;
2308        fn parse_signal(
2309            _client: &std::sync::Arc<crate::client::ClientHandle>,
2310            signal_id: u64,
2311            _data: &[u8],
2312            _fds: Vec<std::os::fd::OwnedFd>,
2313        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
2314            match signal_id {
2315                6944316585732678571u64 => {
2316                    let (handler, field): (u64, u64) = stardust_xr::schemas::flex::deserialize(
2317                        _data,
2318                    )?;
2319                    tracing::trace!(
2320                        ? handler, ? field, "Got signal from server, {}::{}",
2321                        "InputMethod", "create_handler"
2322                    );
2323                    Ok(InputMethodEvent::CreateHandler {
2324                        handler: InputHandler::from_id(_client, handler, false),
2325                        field: Field::from_id(_client, field, false),
2326                    })
2327                }
2328                11807638350036597049u64 => {
2329                    let (id): (u64) = stardust_xr::schemas::flex::deserialize(_data)?;
2330                    tracing::trace!(
2331                        ? id, "Got signal from server, {}::{}", "InputMethod",
2332                        "request_capture_handler"
2333                    );
2334                    Ok(InputMethodEvent::RequestCaptureHandler {
2335                        id: id,
2336                    })
2337                }
2338                9300665394087171854u64 => {
2339                    let (id): (u64) = stardust_xr::schemas::flex::deserialize(_data)?;
2340                    tracing::trace!(
2341                        ? id, "Got signal from server, {}::{}", "InputMethod",
2342                        "release_handler"
2343                    );
2344                    Ok(InputMethodEvent::ReleaseHandler {
2345                        id: id,
2346                    })
2347                }
2348                7635230773176050803u64 => {
2349                    let (id): (u64) = stardust_xr::schemas::flex::deserialize(_data)?;
2350                    tracing::trace!(
2351                        ? id, "Got signal from server, {}::{}", "InputMethod",
2352                        "destroy_handler"
2353                    );
2354                    Ok(InputMethodEvent::DestroyHandler {
2355                        id: id,
2356                    })
2357                }
2358                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
2359            }
2360        }
2361        fn parse_method(
2362            _client: &std::sync::Arc<crate::client::ClientHandle>,
2363            method_id: u64,
2364            _data: &[u8],
2365            _fds: Vec<std::os::fd::OwnedFd>,
2366            response: stardust_xr::messenger::MethodResponse,
2367        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
2368            match method_id {
2369                _ => {
2370                    let _ = response
2371                        .send(
2372                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
2373                        );
2374                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
2375                }
2376            }
2377        }
2378    }
2379    ///Node representing a spatial input device
2380    pub trait InputMethodAspect: crate::node::NodeType + super::InputMethodRefAspect + super::SpatialRefAspect + super::SpatialAspect + super::OwnedAspect + std::fmt::Debug {
2381        fn recv_input_method_event(&self) -> Option<InputMethodEvent>;
2382        ///Set the spatial input component of this input method. You must keep the same input data type throughout the entire thing.
2383        fn set_input(&self, input: InputDataType) -> crate::node::NodeResult<()> {
2384            let mut _fds = Vec::new();
2385            let data = (input);
2386            self.node()
2387                .send_signal(
2388                    14883688361483968991u64,
2389                    17348904196349853573u64,
2390                    &data,
2391                    _fds,
2392                )?;
2393            let (input) = data;
2394            tracing::trace!(
2395                ? input, "Sent signal to server, {}::{}", "InputMethod", "set_input"
2396            );
2397            Ok(())
2398        }
2399        ///Set the datamap of this input method
2400        fn set_datamap(
2401            &self,
2402            datamap: &stardust_xr::values::Datamap,
2403        ) -> crate::node::NodeResult<()> {
2404            let mut _fds = Vec::new();
2405            let data = (datamap);
2406            self.node()
2407                .send_signal(
2408                    14883688361483968991u64,
2409                    9666763984937627751u64,
2410                    &data,
2411                    _fds,
2412                )?;
2413            let (datamap) = data;
2414            tracing::trace!(
2415                ? datamap, "Sent signal to server, {}::{}", "InputMethod", "set_datamap"
2416            );
2417            Ok(())
2418        }
2419        ///Set the order of handlers to propagate input to.
2420        fn set_handler_order(
2421            &self,
2422            handlers: &[InputHandler],
2423        ) -> crate::node::NodeResult<()> {
2424            let mut _fds = Vec::new();
2425            let data = (handlers
2426                .iter()
2427                .map(|a| Ok(a.node().id))
2428                .collect::<crate::node::NodeResult<Vec<_>>>()?);
2429            self.node()
2430                .send_signal(
2431                    14883688361483968991u64,
2432                    4447101880184876824u64,
2433                    &data,
2434                    _fds,
2435                )?;
2436            let (handlers) = data;
2437            tracing::trace!(
2438                ? handlers, "Sent signal to server, {}::{}", "InputMethod",
2439                "set_handler_order"
2440            );
2441            Ok(())
2442        }
2443        ///Set which handlers are captured.
2444        fn set_captures(
2445            &self,
2446            handlers: &[InputHandler],
2447        ) -> crate::node::NodeResult<()> {
2448            let mut _fds = Vec::new();
2449            let data = (handlers
2450                .iter()
2451                .map(|a| Ok(a.node().id))
2452                .collect::<crate::node::NodeResult<Vec<_>>>()?);
2453            self.node()
2454                .send_signal(
2455                    14883688361483968991u64,
2456                    4141712352465076448u64,
2457                    &data,
2458                    _fds,
2459                )?;
2460            let (handlers) = data;
2461            tracing::trace!(
2462                ? handlers, "Sent signal to server, {}::{}", "InputMethod",
2463                "set_captures"
2464            );
2465            Ok(())
2466        }
2467    }
2468    ///Receives input from input methods.
2469    #[derive(Debug, Clone)]
2470    pub struct InputHandler {
2471        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
2472        pub(crate) input_handler_event: std::sync::Arc<
2473            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<InputHandlerEvent>>,
2474        >,
2475    }
2476    impl InputHandler {
2477        pub(crate) fn from_id(
2478            client: &std::sync::Arc<crate::client::ClientHandle>,
2479            id: u64,
2480            owned: bool,
2481        ) -> Self {
2482            let core = std::sync::Arc::new(
2483                crate::node::NodeCore::new(client.clone(), id, owned),
2484            );
2485            let input_handler_event = std::sync::Arc::new(
2486                client.registry.add_aspect(id, 537028132086008694u64).into(),
2487            );
2488            InputHandler {
2489                core,
2490                input_handler_event,
2491            }
2492        }
2493        pub fn as_spatial(self) -> super::Spatial {
2494            super::Spatial { core: self.core }
2495        }
2496        pub fn as_spatial_ref(self) -> super::SpatialRef {
2497            super::SpatialRef {
2498                core: self.core,
2499            }
2500        }
2501    }
2502    impl crate::node::NodeType for InputHandler {
2503        fn node(&self) -> &crate::node::NodeCore {
2504            &self.core
2505        }
2506    }
2507    impl std::hash::Hash for InputHandler {
2508        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
2509            self.core.id.hash(state);
2510        }
2511    }
2512    impl std::cmp::PartialEq for InputHandler {
2513        fn eq(&self, other: &Self) -> bool {
2514            self.core.id == other.core.id
2515        }
2516    }
2517    impl std::cmp::Eq for InputHandler {}
2518    impl serde::Serialize for InputHandler {
2519        fn serialize<S: serde::Serializer>(
2520            &self,
2521            serializer: S,
2522        ) -> Result<S::Ok, S::Error> {
2523            serializer.serialize_u64(self.core.id)
2524        }
2525    }
2526    impl SpatialAspect for InputHandler {}
2527    impl OwnedAspect for InputHandler {}
2528    impl SpatialRefAspect for InputHandler {}
2529    impl InputHandlerAspect for InputHandler {
2530        fn recv_input_handler_event(&self) -> Option<InputHandlerEvent> {
2531            self.input_handler_event.lock().unwrap().try_recv().ok()
2532        }
2533    }
2534    #[derive(Debug)]
2535    pub enum InputHandlerEvent {
2536        Input { methods: Vec<InputMethodRef>, data: Vec<InputData> },
2537    }
2538    impl crate::scenegraph::EventParser for InputHandlerEvent {
2539        const ASPECT_ID: u64 = 537028132086008694u64;
2540        fn parse_signal(
2541            _client: &std::sync::Arc<crate::client::ClientHandle>,
2542            signal_id: u64,
2543            _data: &[u8],
2544            _fds: Vec<std::os::fd::OwnedFd>,
2545        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
2546            match signal_id {
2547                5305312459121645740u64 => {
2548                    let (methods, data): (Vec<u64>, Vec<InputData>) = stardust_xr::schemas::flex::deserialize(
2549                        _data,
2550                    )?;
2551                    tracing::trace!(
2552                        ? methods, ? data, "Got signal from server, {}::{}",
2553                        "InputHandler", "input"
2554                    );
2555                    Ok(InputHandlerEvent::Input {
2556                        methods: methods
2557                            .into_iter()
2558                            .map(|a| Ok(InputMethodRef::from_id(_client, a, false)))
2559                            .collect::<Result<Vec<_>, crate::node::NodeError>>()?,
2560                        data: data
2561                            .into_iter()
2562                            .map(|a| Ok(a))
2563                            .collect::<Result<Vec<_>, crate::node::NodeError>>()?,
2564                    })
2565                }
2566                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
2567            }
2568        }
2569        fn parse_method(
2570            _client: &std::sync::Arc<crate::client::ClientHandle>,
2571            method_id: u64,
2572            _data: &[u8],
2573            _fds: Vec<std::os::fd::OwnedFd>,
2574            response: stardust_xr::messenger::MethodResponse,
2575        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
2576            match method_id {
2577                _ => {
2578                    let _ = response
2579                        .send(
2580                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
2581                        );
2582                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
2583                }
2584            }
2585        }
2586    }
2587    ///Receives input from input methods.
2588    pub trait InputHandlerAspect: crate::node::NodeType + super::SpatialAspect + super::OwnedAspect + super::SpatialRefAspect + std::fmt::Debug {
2589        fn recv_input_handler_event(&self) -> Option<InputHandlerEvent>;
2590    }
2591    ///Create an input method node
2592    pub fn create_input_method(
2593        _client: &std::sync::Arc<crate::client::ClientHandle>,
2594        id: u64,
2595        parent: &impl SpatialRefAspect,
2596        transform: Transform,
2597        initial_data: InputDataType,
2598        datamap: &stardust_xr::values::Datamap,
2599    ) -> crate::node::NodeResult<InputMethod> {
2600        {
2601            let mut _fds = Vec::new();
2602            let data = (id, parent.node().id, transform, initial_data, datamap);
2603            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
2604            _client
2605                .message_sender_handle
2606                .signal(3u64, 0u64, 11977582531774730283u64, &serialized_data, _fds)?;
2607            let (id, parent, transform, initial_data, datamap) = data;
2608            tracing::trace!(
2609                ? id, ? parent, ? transform, ? initial_data, ? datamap,
2610                "Sent signal to server, {}::{}", "Interface", "create_input_method"
2611            );
2612        }
2613        Ok(InputMethod::from_id(_client, id, true))
2614    }
2615    ///Create an input handler node
2616    pub fn create_input_handler(
2617        _client: &std::sync::Arc<crate::client::ClientHandle>,
2618        id: u64,
2619        parent: &impl SpatialRefAspect,
2620        transform: Transform,
2621        field: &impl FieldAspect,
2622    ) -> crate::node::NodeResult<InputHandler> {
2623        {
2624            let mut _fds = Vec::new();
2625            let data = (id, parent.node().id, transform, field.node().id);
2626            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
2627            _client
2628                .message_sender_handle
2629                .signal(3u64, 0u64, 1654491336591158898u64, &serialized_data, _fds)?;
2630            let (id, parent, transform, field) = data;
2631            tracing::trace!(
2632                ? id, ? parent, ? transform, ? field, "Sent signal to server, {}::{}",
2633                "Interface", "create_input_handler"
2634            );
2635        }
2636        Ok(InputHandler::from_id(_client, id, true))
2637    }
2638}
2639#[allow(unused_imports)]
2640use item::*;
2641pub mod item {
2642    #[allow(unused_imports)]
2643    use super::*;
2644    pub(crate) const INTERFACE_VERSION: u32 = 1u32;
2645    pub(crate) const INTERFACE_NODE_ID: u64 = 10u64;
2646    ///
2647    #[derive(Debug, Clone)]
2648    pub struct Item {
2649        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
2650    }
2651    impl Item {
2652        pub(crate) fn from_id(
2653            client: &std::sync::Arc<crate::client::ClientHandle>,
2654            id: u64,
2655            owned: bool,
2656        ) -> Self {
2657            let core = std::sync::Arc::new(
2658                crate::node::NodeCore::new(client.clone(), id, owned),
2659            );
2660            Item { core }
2661        }
2662        pub fn as_spatial(self) -> super::Spatial {
2663            super::Spatial { core: self.core }
2664        }
2665        pub fn as_spatial_ref(self) -> super::SpatialRef {
2666            super::SpatialRef {
2667                core: self.core,
2668            }
2669        }
2670    }
2671    impl crate::node::NodeType for Item {
2672        fn node(&self) -> &crate::node::NodeCore {
2673            &self.core
2674        }
2675    }
2676    impl std::hash::Hash for Item {
2677        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
2678            self.core.id.hash(state);
2679        }
2680    }
2681    impl std::cmp::PartialEq for Item {
2682        fn eq(&self, other: &Self) -> bool {
2683            self.core.id == other.core.id
2684        }
2685    }
2686    impl std::cmp::Eq for Item {}
2687    impl serde::Serialize for Item {
2688        fn serialize<S: serde::Serializer>(
2689            &self,
2690            serializer: S,
2691        ) -> Result<S::Ok, S::Error> {
2692            serializer.serialize_u64(self.core.id)
2693        }
2694    }
2695    impl SpatialAspect for Item {}
2696    impl OwnedAspect for Item {}
2697    impl SpatialRefAspect for Item {}
2698    impl ItemAspect for Item {}
2699    #[derive(Debug)]
2700    pub enum ItemEvent {}
2701    ///
2702    pub trait ItemAspect: crate::node::NodeType + super::SpatialAspect + super::OwnedAspect + super::SpatialRefAspect + std::fmt::Debug {
2703        ///
2704        fn release(&self) -> crate::node::NodeResult<()> {
2705            let mut _fds = Vec::new();
2706            let data = ();
2707            self.node()
2708                .send_signal(
2709                    18318655529277677339u64,
2710                    11905596878821798323u64,
2711                    &data,
2712                    _fds,
2713                )?;
2714            let () = data;
2715            tracing::trace!("Sent signal to server, {}::{}", "Item", "release");
2716            Ok(())
2717        }
2718    }
2719    ///
2720    #[derive(Debug, Clone)]
2721    pub struct ItemAcceptor {
2722        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
2723        pub(crate) item_acceptor_event: std::sync::Arc<
2724            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<ItemAcceptorEvent>>,
2725        >,
2726    }
2727    impl ItemAcceptor {
2728        pub(crate) fn from_id(
2729            client: &std::sync::Arc<crate::client::ClientHandle>,
2730            id: u64,
2731            owned: bool,
2732        ) -> Self {
2733            let core = std::sync::Arc::new(
2734                crate::node::NodeCore::new(client.clone(), id, owned),
2735            );
2736            let item_acceptor_event = std::sync::Arc::new(
2737                client.registry.add_aspect(id, 10274055739447304636u64).into(),
2738            );
2739            ItemAcceptor {
2740                core,
2741                item_acceptor_event,
2742            }
2743        }
2744        pub fn as_spatial(self) -> super::Spatial {
2745            super::Spatial { core: self.core }
2746        }
2747        pub fn as_spatial_ref(self) -> super::SpatialRef {
2748            super::SpatialRef {
2749                core: self.core,
2750            }
2751        }
2752    }
2753    impl crate::node::NodeType for ItemAcceptor {
2754        fn node(&self) -> &crate::node::NodeCore {
2755            &self.core
2756        }
2757    }
2758    impl std::hash::Hash for ItemAcceptor {
2759        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
2760            self.core.id.hash(state);
2761        }
2762    }
2763    impl std::cmp::PartialEq for ItemAcceptor {
2764        fn eq(&self, other: &Self) -> bool {
2765            self.core.id == other.core.id
2766        }
2767    }
2768    impl std::cmp::Eq for ItemAcceptor {}
2769    impl serde::Serialize for ItemAcceptor {
2770        fn serialize<S: serde::Serializer>(
2771            &self,
2772            serializer: S,
2773        ) -> Result<S::Ok, S::Error> {
2774            serializer.serialize_u64(self.core.id)
2775        }
2776    }
2777    impl SpatialAspect for ItemAcceptor {}
2778    impl OwnedAspect for ItemAcceptor {}
2779    impl SpatialRefAspect for ItemAcceptor {}
2780    impl ItemAcceptorAspect for ItemAcceptor {
2781        fn recv_item_acceptor_event(&self) -> Option<ItemAcceptorEvent> {
2782            self.item_acceptor_event.lock().unwrap().try_recv().ok()
2783        }
2784    }
2785    #[derive(Debug)]
2786    pub enum ItemAcceptorEvent {
2787        ReleaseItem { item_id: u64 },
2788    }
2789    impl crate::scenegraph::EventParser for ItemAcceptorEvent {
2790        const ASPECT_ID: u64 = 10274055739447304636u64;
2791        fn parse_signal(
2792            _client: &std::sync::Arc<crate::client::ClientHandle>,
2793            signal_id: u64,
2794            _data: &[u8],
2795            _fds: Vec<std::os::fd::OwnedFd>,
2796        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
2797            match signal_id {
2798                14821884892980204849u64 => {
2799                    let (item_id): (u64) = stardust_xr::schemas::flex::deserialize(
2800                        _data,
2801                    )?;
2802                    tracing::trace!(
2803                        ? item_id, "Got signal from server, {}::{}", "ItemAcceptor",
2804                        "release_item"
2805                    );
2806                    Ok(ItemAcceptorEvent::ReleaseItem {
2807                        item_id: item_id,
2808                    })
2809                }
2810                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
2811            }
2812        }
2813        fn parse_method(
2814            _client: &std::sync::Arc<crate::client::ClientHandle>,
2815            method_id: u64,
2816            _data: &[u8],
2817            _fds: Vec<std::os::fd::OwnedFd>,
2818            response: stardust_xr::messenger::MethodResponse,
2819        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
2820            match method_id {
2821                _ => {
2822                    let _ = response
2823                        .send(
2824                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
2825                        );
2826                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
2827                }
2828            }
2829        }
2830    }
2831    ///
2832    pub trait ItemAcceptorAspect: crate::node::NodeType + super::SpatialAspect + super::OwnedAspect + super::SpatialRefAspect + std::fmt::Debug {
2833        fn recv_item_acceptor_event(&self) -> Option<ItemAcceptorEvent>;
2834    }
2835    ///
2836    #[derive(Debug, Clone)]
2837    pub struct ItemUi {
2838        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
2839        pub(crate) item_ui_event: std::sync::Arc<
2840            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<ItemUiEvent>>,
2841        >,
2842    }
2843    impl ItemUi {
2844        pub(crate) fn from_id(
2845            client: &std::sync::Arc<crate::client::ClientHandle>,
2846            id: u64,
2847            owned: bool,
2848        ) -> Self {
2849            let core = std::sync::Arc::new(
2850                crate::node::NodeCore::new(client.clone(), id, owned),
2851            );
2852            let item_ui_event = std::sync::Arc::new(
2853                client.registry.add_aspect(id, 7265392688253796589u64).into(),
2854            );
2855            ItemUi { core, item_ui_event }
2856        }
2857    }
2858    impl crate::node::NodeType for ItemUi {
2859        fn node(&self) -> &crate::node::NodeCore {
2860            &self.core
2861        }
2862    }
2863    impl std::hash::Hash for ItemUi {
2864        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
2865            self.core.id.hash(state);
2866        }
2867    }
2868    impl std::cmp::PartialEq for ItemUi {
2869        fn eq(&self, other: &Self) -> bool {
2870            self.core.id == other.core.id
2871        }
2872    }
2873    impl std::cmp::Eq for ItemUi {}
2874    impl serde::Serialize for ItemUi {
2875        fn serialize<S: serde::Serializer>(
2876            &self,
2877            serializer: S,
2878        ) -> Result<S::Ok, S::Error> {
2879            serializer.serialize_u64(self.core.id)
2880        }
2881    }
2882    impl ItemUiAspect for ItemUi {
2883        fn recv_item_ui_event(&self) -> Option<ItemUiEvent> {
2884            self.item_ui_event.lock().unwrap().try_recv().ok()
2885        }
2886    }
2887    #[derive(Debug)]
2888    pub enum ItemUiEvent {
2889        CaptureItem { item_id: u64, acceptor_id: u64 },
2890        ReleaseItem { item_id: u64, acceptor_id: u64 },
2891        DestroyItem { id: u64 },
2892        DestroyAcceptor { id: u64 },
2893    }
2894    impl crate::scenegraph::EventParser for ItemUiEvent {
2895        const ASPECT_ID: u64 = 7265392688253796589u64;
2896        fn parse_signal(
2897            _client: &std::sync::Arc<crate::client::ClientHandle>,
2898            signal_id: u64,
2899            _data: &[u8],
2900            _fds: Vec<std::os::fd::OwnedFd>,
2901        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
2902            match signal_id {
2903                1751367302976798762u64 => {
2904                    let (item_id, acceptor_id): (u64, u64) = stardust_xr::schemas::flex::deserialize(
2905                        _data,
2906                    )?;
2907                    tracing::trace!(
2908                        ? item_id, ? acceptor_id, "Got signal from server, {}::{}",
2909                        "ItemUi", "capture_item"
2910                    );
2911                    Ok(ItemUiEvent::CaptureItem {
2912                        item_id: item_id,
2913                        acceptor_id: acceptor_id,
2914                    })
2915                }
2916                14821884892980204849u64 => {
2917                    let (item_id, acceptor_id): (u64, u64) = stardust_xr::schemas::flex::deserialize(
2918                        _data,
2919                    )?;
2920                    tracing::trace!(
2921                        ? item_id, ? acceptor_id, "Got signal from server, {}::{}",
2922                        "ItemUi", "release_item"
2923                    );
2924                    Ok(ItemUiEvent::ReleaseItem {
2925                        item_id: item_id,
2926                        acceptor_id: acceptor_id,
2927                    })
2928                }
2929                11215449886948753686u64 => {
2930                    let (id): (u64) = stardust_xr::schemas::flex::deserialize(_data)?;
2931                    tracing::trace!(
2932                        ? id, "Got signal from server, {}::{}", "ItemUi", "destroy_item"
2933                    );
2934                    Ok(ItemUiEvent::DestroyItem { id: id })
2935                }
2936                3521554848760623636u64 => {
2937                    let (id): (u64) = stardust_xr::schemas::flex::deserialize(_data)?;
2938                    tracing::trace!(
2939                        ? id, "Got signal from server, {}::{}", "ItemUi",
2940                        "destroy_acceptor"
2941                    );
2942                    Ok(ItemUiEvent::DestroyAcceptor {
2943                        id: id,
2944                    })
2945                }
2946                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
2947            }
2948        }
2949        fn parse_method(
2950            _client: &std::sync::Arc<crate::client::ClientHandle>,
2951            method_id: u64,
2952            _data: &[u8],
2953            _fds: Vec<std::os::fd::OwnedFd>,
2954            response: stardust_xr::messenger::MethodResponse,
2955        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
2956            match method_id {
2957                _ => {
2958                    let _ = response
2959                        .send(
2960                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
2961                        );
2962                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
2963                }
2964            }
2965        }
2966    }
2967    ///
2968    pub trait ItemUiAspect: crate::node::NodeType + std::fmt::Debug {
2969        fn recv_item_ui_event(&self) -> Option<ItemUiEvent>;
2970    }
2971}
2972#[allow(unused_imports)]
2973use item_camera::*;
2974pub mod item_camera {
2975    #[allow(unused_imports)]
2976    use super::*;
2977    pub(crate) const INTERFACE_VERSION: u32 = 1u32;
2978    pub(crate) const INTERFACE_NODE_ID: u64 = 11u64;
2979    ///
2980    #[derive(Debug, Clone)]
2981    pub struct CameraItem {
2982        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
2983    }
2984    impl CameraItem {
2985        pub(crate) fn from_id(
2986            client: &std::sync::Arc<crate::client::ClientHandle>,
2987            id: u64,
2988            owned: bool,
2989        ) -> Self {
2990            let core = std::sync::Arc::new(
2991                crate::node::NodeCore::new(client.clone(), id, owned),
2992            );
2993            CameraItem { core }
2994        }
2995        pub fn as_item(self) -> super::Item {
2996            super::Item { core: self.core }
2997        }
2998        pub fn as_spatial_ref(self) -> super::SpatialRef {
2999            super::SpatialRef {
3000                core: self.core,
3001            }
3002        }
3003        pub fn as_spatial(self) -> super::Spatial {
3004            super::Spatial { core: self.core }
3005        }
3006    }
3007    impl crate::node::NodeType for CameraItem {
3008        fn node(&self) -> &crate::node::NodeCore {
3009            &self.core
3010        }
3011    }
3012    impl std::hash::Hash for CameraItem {
3013        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
3014            self.core.id.hash(state);
3015        }
3016    }
3017    impl std::cmp::PartialEq for CameraItem {
3018        fn eq(&self, other: &Self) -> bool {
3019            self.core.id == other.core.id
3020        }
3021    }
3022    impl std::cmp::Eq for CameraItem {}
3023    impl serde::Serialize for CameraItem {
3024        fn serialize<S: serde::Serializer>(
3025            &self,
3026            serializer: S,
3027        ) -> Result<S::Ok, S::Error> {
3028            serializer.serialize_u64(self.core.id)
3029        }
3030    }
3031    impl ItemAspect for CameraItem {}
3032    impl SpatialRefAspect for CameraItem {}
3033    impl OwnedAspect for CameraItem {}
3034    impl SpatialAspect for CameraItem {}
3035    impl CameraItemAspect for CameraItem {}
3036    #[derive(Debug)]
3037    pub enum CameraItemEvent {}
3038    ///
3039    pub trait CameraItemAspect: crate::node::NodeType + super::ItemAspect + super::SpatialRefAspect + super::OwnedAspect + super::SpatialAspect + std::fmt::Debug {}
3040    ///
3041    #[derive(Debug, Clone)]
3042    pub struct CameraItemUi {
3043        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
3044        pub(crate) camera_item_ui_event: std::sync::Arc<
3045            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<CameraItemUiEvent>>,
3046        >,
3047    }
3048    impl CameraItemUi {
3049        pub(crate) fn from_id(
3050            client: &std::sync::Arc<crate::client::ClientHandle>,
3051            id: u64,
3052            owned: bool,
3053        ) -> Self {
3054            let core = std::sync::Arc::new(
3055                crate::node::NodeCore::new(client.clone(), id, owned),
3056            );
3057            let camera_item_ui_event = std::sync::Arc::new(
3058                client.registry.add_aspect(id, 708021061010127172u64).into(),
3059            );
3060            CameraItemUi {
3061                core,
3062                camera_item_ui_event,
3063            }
3064        }
3065    }
3066    impl crate::node::NodeType for CameraItemUi {
3067        fn node(&self) -> &crate::node::NodeCore {
3068            &self.core
3069        }
3070    }
3071    impl std::hash::Hash for CameraItemUi {
3072        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
3073            self.core.id.hash(state);
3074        }
3075    }
3076    impl std::cmp::PartialEq for CameraItemUi {
3077        fn eq(&self, other: &Self) -> bool {
3078            self.core.id == other.core.id
3079        }
3080    }
3081    impl std::cmp::Eq for CameraItemUi {}
3082    impl serde::Serialize for CameraItemUi {
3083        fn serialize<S: serde::Serializer>(
3084            &self,
3085            serializer: S,
3086        ) -> Result<S::Ok, S::Error> {
3087            serializer.serialize_u64(self.core.id)
3088        }
3089    }
3090    impl CameraItemUiAspect for CameraItemUi {
3091        fn recv_camera_item_ui_event(&self) -> Option<CameraItemUiEvent> {
3092            self.camera_item_ui_event.lock().unwrap().try_recv().ok()
3093        }
3094    }
3095    #[derive(Debug)]
3096    pub enum CameraItemUiEvent {
3097        CreateItem { item: CameraItem },
3098        CreateAcceptor { acceptor: CameraItemAcceptor, acceptor_field: Field },
3099    }
3100    impl crate::scenegraph::EventParser for CameraItemUiEvent {
3101        const ASPECT_ID: u64 = 708021061010127172u64;
3102        fn parse_signal(
3103            _client: &std::sync::Arc<crate::client::ClientHandle>,
3104            signal_id: u64,
3105            _data: &[u8],
3106            _fds: Vec<std::os::fd::OwnedFd>,
3107        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
3108            match signal_id {
3109                15524466827491111758u64 => {
3110                    let (item): (u64) = stardust_xr::schemas::flex::deserialize(_data)?;
3111                    tracing::trace!(
3112                        ? item, "Got signal from server, {}::{}", "CameraItemUi",
3113                        "create_item"
3114                    );
3115                    Ok(CameraItemUiEvent::CreateItem {
3116                        item: CameraItem::from_id(_client, item, false),
3117                    })
3118                }
3119                16628549773568263004u64 => {
3120                    let (acceptor, acceptor_field): (u64, u64) = stardust_xr::schemas::flex::deserialize(
3121                        _data,
3122                    )?;
3123                    tracing::trace!(
3124                        ? acceptor, ? acceptor_field, "Got signal from server, {}::{}",
3125                        "CameraItemUi", "create_acceptor"
3126                    );
3127                    Ok(CameraItemUiEvent::CreateAcceptor {
3128                        acceptor: CameraItemAcceptor::from_id(_client, acceptor, false),
3129                        acceptor_field: Field::from_id(_client, acceptor_field, false),
3130                    })
3131                }
3132                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
3133            }
3134        }
3135        fn parse_method(
3136            _client: &std::sync::Arc<crate::client::ClientHandle>,
3137            method_id: u64,
3138            _data: &[u8],
3139            _fds: Vec<std::os::fd::OwnedFd>,
3140            response: stardust_xr::messenger::MethodResponse,
3141        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
3142            match method_id {
3143                _ => {
3144                    let _ = response
3145                        .send(
3146                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
3147                        );
3148                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
3149                }
3150            }
3151        }
3152    }
3153    ///
3154    pub trait CameraItemUiAspect: crate::node::NodeType + std::fmt::Debug {
3155        fn recv_camera_item_ui_event(&self) -> Option<CameraItemUiEvent>;
3156    }
3157    ///
3158    #[derive(Debug, Clone)]
3159    pub struct CameraItemAcceptor {
3160        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
3161        pub(crate) item_acceptor_event: std::sync::Arc<
3162            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<ItemAcceptorEvent>>,
3163        >,
3164        pub(crate) camera_item_acceptor_event: std::sync::Arc<
3165            std::sync::Mutex<
3166                tokio::sync::mpsc::UnboundedReceiver<CameraItemAcceptorEvent>,
3167            >,
3168        >,
3169    }
3170    impl CameraItemAcceptor {
3171        pub(crate) fn from_id(
3172            client: &std::sync::Arc<crate::client::ClientHandle>,
3173            id: u64,
3174            owned: bool,
3175        ) -> Self {
3176            let core = std::sync::Arc::new(
3177                crate::node::NodeCore::new(client.clone(), id, owned),
3178            );
3179            let item_acceptor_event = std::sync::Arc::new(
3180                client.registry.add_aspect(id, 10274055739447304636u64).into(),
3181            );
3182            let camera_item_acceptor_event = std::sync::Arc::new(
3183                client.registry.add_aspect(id, 5036088114779304421u64).into(),
3184            );
3185            CameraItemAcceptor {
3186                core,
3187                item_acceptor_event,
3188                camera_item_acceptor_event,
3189            }
3190        }
3191        pub fn as_item_acceptor(self) -> super::ItemAcceptor {
3192            super::ItemAcceptor {
3193                core: self.core,
3194                item_acceptor_event: self.item_acceptor_event,
3195            }
3196        }
3197        pub fn as_spatial_ref(self) -> super::SpatialRef {
3198            super::SpatialRef {
3199                core: self.core,
3200            }
3201        }
3202        pub fn as_spatial(self) -> super::Spatial {
3203            super::Spatial { core: self.core }
3204        }
3205    }
3206    impl crate::node::NodeType for CameraItemAcceptor {
3207        fn node(&self) -> &crate::node::NodeCore {
3208            &self.core
3209        }
3210    }
3211    impl std::hash::Hash for CameraItemAcceptor {
3212        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
3213            self.core.id.hash(state);
3214        }
3215    }
3216    impl std::cmp::PartialEq for CameraItemAcceptor {
3217        fn eq(&self, other: &Self) -> bool {
3218            self.core.id == other.core.id
3219        }
3220    }
3221    impl std::cmp::Eq for CameraItemAcceptor {}
3222    impl serde::Serialize for CameraItemAcceptor {
3223        fn serialize<S: serde::Serializer>(
3224            &self,
3225            serializer: S,
3226        ) -> Result<S::Ok, S::Error> {
3227            serializer.serialize_u64(self.core.id)
3228        }
3229    }
3230    impl ItemAcceptorAspect for CameraItemAcceptor {
3231        fn recv_item_acceptor_event(&self) -> Option<ItemAcceptorEvent> {
3232            self.item_acceptor_event.lock().unwrap().try_recv().ok()
3233        }
3234    }
3235    impl SpatialRefAspect for CameraItemAcceptor {}
3236    impl OwnedAspect for CameraItemAcceptor {}
3237    impl SpatialAspect for CameraItemAcceptor {}
3238    impl CameraItemAcceptorAspect for CameraItemAcceptor {
3239        fn recv_camera_item_acceptor_event(&self) -> Option<CameraItemAcceptorEvent> {
3240            self.camera_item_acceptor_event.lock().unwrap().try_recv().ok()
3241        }
3242    }
3243    #[derive(Debug)]
3244    pub enum CameraItemAcceptorEvent {
3245        CaptureItem { item: CameraItem },
3246    }
3247    impl crate::scenegraph::EventParser for CameraItemAcceptorEvent {
3248        const ASPECT_ID: u64 = 5036088114779304421u64;
3249        fn parse_signal(
3250            _client: &std::sync::Arc<crate::client::ClientHandle>,
3251            signal_id: u64,
3252            _data: &[u8],
3253            _fds: Vec<std::os::fd::OwnedFd>,
3254        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
3255            match signal_id {
3256                1751367302976798762u64 => {
3257                    let (item): (u64) = stardust_xr::schemas::flex::deserialize(_data)?;
3258                    tracing::trace!(
3259                        ? item, "Got signal from server, {}::{}", "CameraItemAcceptor",
3260                        "capture_item"
3261                    );
3262                    Ok(CameraItemAcceptorEvent::CaptureItem {
3263                        item: CameraItem::from_id(_client, item, false),
3264                    })
3265                }
3266                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
3267            }
3268        }
3269        fn parse_method(
3270            _client: &std::sync::Arc<crate::client::ClientHandle>,
3271            method_id: u64,
3272            _data: &[u8],
3273            _fds: Vec<std::os::fd::OwnedFd>,
3274            response: stardust_xr::messenger::MethodResponse,
3275        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
3276            match method_id {
3277                _ => {
3278                    let _ = response
3279                        .send(
3280                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
3281                        );
3282                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
3283                }
3284            }
3285        }
3286    }
3287    ///
3288    pub trait CameraItemAcceptorAspect: crate::node::NodeType + super::ItemAcceptorAspect + super::SpatialRefAspect + super::OwnedAspect + super::SpatialAspect + std::fmt::Debug {
3289        fn recv_camera_item_acceptor_event(&self) -> Option<CameraItemAcceptorEvent>;
3290        ///
3291        fn capture_item(
3292            &self,
3293            item: &impl CameraItemAspect,
3294        ) -> crate::node::NodeResult<()> {
3295            let mut _fds = Vec::new();
3296            let data = (item.node().id);
3297            self.node()
3298                .send_signal(
3299                    5036088114779304421u64,
3300                    1751367302976798762u64,
3301                    &data,
3302                    _fds,
3303                )?;
3304            let (item) = data;
3305            tracing::trace!(
3306                ? item, "Sent signal to server, {}::{}", "CameraItemAcceptor",
3307                "capture_item"
3308            );
3309            Ok(())
3310        }
3311    }
3312    ///Create a camera item at a specific location
3313    pub fn create_camera_item(
3314        _client: &std::sync::Arc<crate::client::ClientHandle>,
3315        id: u64,
3316        parent: &impl SpatialRefAspect,
3317        transform: Transform,
3318        proj_matrix: impl Into<stardust_xr::values::Mat4>,
3319        px_size: impl Into<stardust_xr::values::Vector2<u32>>,
3320    ) -> crate::node::NodeResult<CameraItem> {
3321        {
3322            let mut _fds = Vec::new();
3323            let data = (
3324                id,
3325                parent.node().id,
3326                transform,
3327                proj_matrix.into(),
3328                px_size.into(),
3329            );
3330            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
3331            _client
3332                .message_sender_handle
3333                .signal(11u64, 0u64, 16398826726504952950u64, &serialized_data, _fds)?;
3334            let (id, parent, transform, proj_matrix, px_size) = data;
3335            tracing::trace!(
3336                ? id, ? parent, ? transform, ? proj_matrix, ? px_size,
3337                "Sent signal to server, {}::{}", "Interface", "create_camera_item"
3338            );
3339        }
3340        Ok(CameraItem::from_id(_client, id, true))
3341    }
3342    ///Register this client to manage camera items and create default 3D UI for them.
3343    pub fn register_camera_item_ui(
3344        _client: &std::sync::Arc<crate::client::ClientHandle>,
3345    ) -> crate::node::NodeResult<()> {
3346        let mut _fds = Vec::new();
3347        let data = ();
3348        let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
3349        _client
3350            .message_sender_handle
3351            .signal(11u64, 0u64, 13470969625663359032u64, &serialized_data, _fds)?;
3352        let () = data;
3353        tracing::trace!(
3354            "Sent signal to server, {}::{}", "Interface", "register_camera_item_ui"
3355        );
3356        Ok(())
3357    }
3358    ///Create an item acceptor to allow temporary ownership of a given type of item. Creates a node at `/item/camera/acceptor/<name>`.
3359    pub fn create_camera_item_acceptor(
3360        _client: &std::sync::Arc<crate::client::ClientHandle>,
3361        id: u64,
3362        parent: &impl SpatialRefAspect,
3363        transform: Transform,
3364        field: &impl FieldAspect,
3365    ) -> crate::node::NodeResult<CameraItemAcceptor> {
3366        {
3367            let mut _fds = Vec::new();
3368            let data = (id, parent.node().id, transform, field.node().id);
3369            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
3370            _client
3371                .message_sender_handle
3372                .signal(11u64, 0u64, 13070169044031356364u64, &serialized_data, _fds)?;
3373            let (id, parent, transform, field) = data;
3374            tracing::trace!(
3375                ? id, ? parent, ? transform, ? field, "Sent signal to server, {}::{}",
3376                "Interface", "create_camera_item_acceptor"
3377            );
3378        }
3379        Ok(CameraItemAcceptor::from_id(_client, id, true))
3380    }
3381}
3382#[allow(unused_imports)]
3383use item_panel::*;
3384pub mod item_panel {
3385    #[allow(unused_imports)]
3386    use super::*;
3387    pub(crate) const INTERFACE_VERSION: u32 = 1u32;
3388    pub(crate) const INTERFACE_NODE_ID: u64 = 12u64;
3389    ///
3390    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
3391    #[serde(tag = "t", content = "c")]
3392    pub enum SurfaceId {
3393        Toplevel(()),
3394        Child(u64),
3395    }
3396    ///The origin and size of the surface's "solid" part.
3397    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
3398    pub struct Geometry {
3399        pub origin: stardust_xr::values::Vector2<i32>,
3400        pub size: stardust_xr::values::Vector2<u32>,
3401    }
3402    ///The state of the panel item's toplevel.
3403    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
3404    pub struct ToplevelInfo {
3405        pub parent: Option<u64>,
3406        pub title: Option<String>,
3407        pub app_id: Option<String>,
3408        pub size: stardust_xr::values::Vector2<u32>,
3409        pub min_size: Option<stardust_xr::values::Vector2<f32>>,
3410        pub max_size: Option<stardust_xr::values::Vector2<f32>>,
3411        pub logical_rectangle: Geometry,
3412    }
3413    ///Data on positioning a child.
3414    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
3415    pub struct ChildInfo {
3416        pub id: u64,
3417        pub parent: SurfaceId,
3418        pub geometry: Geometry,
3419        pub z_order: i32,
3420        pub receives_input: bool,
3421    }
3422    ///The init data for the panel item.
3423    #[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
3424    pub struct PanelItemInitData {
3425        pub cursor: Option<Geometry>,
3426        pub toplevel: ToplevelInfo,
3427        pub children: Vec<ChildInfo>,
3428        pub pointer_grab: Option<SurfaceId>,
3429        pub keyboard_grab: Option<SurfaceId>,
3430    }
3431    ///An item that represents a toplevel 2D window's surface (base window) and all its children (context menus, modals, etc.).
3432    #[derive(Debug, Clone)]
3433    pub struct PanelItem {
3434        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
3435        pub(crate) panel_item_event: std::sync::Arc<
3436            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<PanelItemEvent>>,
3437        >,
3438    }
3439    impl PanelItem {
3440        pub(crate) fn from_id(
3441            client: &std::sync::Arc<crate::client::ClientHandle>,
3442            id: u64,
3443            owned: bool,
3444        ) -> Self {
3445            let core = std::sync::Arc::new(
3446                crate::node::NodeCore::new(client.clone(), id, owned),
3447            );
3448            let panel_item_event = std::sync::Arc::new(
3449                client.registry.add_aspect(id, 16007573185838633179u64).into(),
3450            );
3451            PanelItem {
3452                core,
3453                panel_item_event,
3454            }
3455        }
3456        pub fn as_item(self) -> super::Item {
3457            super::Item { core: self.core }
3458        }
3459        pub fn as_spatial_ref(self) -> super::SpatialRef {
3460            super::SpatialRef {
3461                core: self.core,
3462            }
3463        }
3464        pub fn as_spatial(self) -> super::Spatial {
3465            super::Spatial { core: self.core }
3466        }
3467    }
3468    impl crate::node::NodeType for PanelItem {
3469        fn node(&self) -> &crate::node::NodeCore {
3470            &self.core
3471        }
3472    }
3473    impl std::hash::Hash for PanelItem {
3474        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
3475            self.core.id.hash(state);
3476        }
3477    }
3478    impl std::cmp::PartialEq for PanelItem {
3479        fn eq(&self, other: &Self) -> bool {
3480            self.core.id == other.core.id
3481        }
3482    }
3483    impl std::cmp::Eq for PanelItem {}
3484    impl serde::Serialize for PanelItem {
3485        fn serialize<S: serde::Serializer>(
3486            &self,
3487            serializer: S,
3488        ) -> Result<S::Ok, S::Error> {
3489            serializer.serialize_u64(self.core.id)
3490        }
3491    }
3492    impl ItemAspect for PanelItem {}
3493    impl SpatialRefAspect for PanelItem {}
3494    impl OwnedAspect for PanelItem {}
3495    impl SpatialAspect for PanelItem {}
3496    impl PanelItemAspect for PanelItem {
3497        fn recv_panel_item_event(&self) -> Option<PanelItemEvent> {
3498            self.panel_item_event.lock().unwrap().try_recv().ok()
3499        }
3500    }
3501    #[derive(Debug)]
3502    pub enum PanelItemEvent {
3503        ToplevelParentChanged { parent_id: u64 },
3504        ToplevelTitleChanged { title: String },
3505        ToplevelAppIdChanged { app_id: String },
3506        ToplevelFullscreenActive { active: bool },
3507        ToplevelMoveRequest {},
3508        ToplevelResizeRequest { up: bool, down: bool, left: bool, right: bool },
3509        ToplevelSizeChanged { size: stardust_xr::values::Vector2<u32> },
3510        SetCursor { geometry: Geometry },
3511        HideCursor {},
3512        CreateChild { uid: u64, info: ChildInfo },
3513        RepositionChild { uid: u64, geometry: Geometry },
3514        DestroyChild { uid: u64 },
3515    }
3516    impl crate::scenegraph::EventParser for PanelItemEvent {
3517        const ASPECT_ID: u64 = 16007573185838633179u64;
3518        fn parse_signal(
3519            _client: &std::sync::Arc<crate::client::ClientHandle>,
3520            signal_id: u64,
3521            _data: &[u8],
3522            _fds: Vec<std::os::fd::OwnedFd>,
3523        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
3524            match signal_id {
3525                1408884359956576105u64 => {
3526                    let (parent_id): (u64) = stardust_xr::schemas::flex::deserialize(
3527                        _data,
3528                    )?;
3529                    tracing::trace!(
3530                        ? parent_id, "Got signal from server, {}::{}", "PanelItem",
3531                        "toplevel_parent_changed"
3532                    );
3533                    Ok(PanelItemEvent::ToplevelParentChanged {
3534                        parent_id: parent_id,
3535                    })
3536                }
3537                566483566315648641u64 => {
3538                    let (title): (String) = stardust_xr::schemas::flex::deserialize(
3539                        _data,
3540                    )?;
3541                    tracing::trace!(
3542                        ? title, "Got signal from server, {}::{}", "PanelItem",
3543                        "toplevel_title_changed"
3544                    );
3545                    Ok(PanelItemEvent::ToplevelTitleChanged {
3546                        title: title,
3547                    })
3548                }
3549                8706869778156655494u64 => {
3550                    let (app_id): (String) = stardust_xr::schemas::flex::deserialize(
3551                        _data,
3552                    )?;
3553                    tracing::trace!(
3554                        ? app_id, "Got signal from server, {}::{}", "PanelItem",
3555                        "toplevel_app_id_changed"
3556                    );
3557                    Ok(PanelItemEvent::ToplevelAppIdChanged {
3558                        app_id: app_id,
3559                    })
3560                }
3561                11059551561818960198u64 => {
3562                    let (active): (bool) = stardust_xr::schemas::flex::deserialize(
3563                        _data,
3564                    )?;
3565                    tracing::trace!(
3566                        ? active, "Got signal from server, {}::{}", "PanelItem",
3567                        "toplevel_fullscreen_active"
3568                    );
3569                    Ok(PanelItemEvent::ToplevelFullscreenActive {
3570                        active: active,
3571                    })
3572                }
3573                3715781852227007625u64 => {
3574                    let (): () = stardust_xr::schemas::flex::deserialize(_data)?;
3575                    tracing::trace!(
3576                        "Got signal from server, {}::{}", "PanelItem",
3577                        "toplevel_move_request"
3578                    );
3579                    Ok(PanelItemEvent::ToplevelMoveRequest {
3580                    })
3581                }
3582                4540754955116125050u64 => {
3583                    let (up, down, left, right): (bool, bool, bool, bool) = stardust_xr::schemas::flex::deserialize(
3584                        _data,
3585                    )?;
3586                    tracing::trace!(
3587                        ? up, ? down, ? left, ? right, "Got signal from server, {}::{}",
3588                        "PanelItem", "toplevel_resize_request"
3589                    );
3590                    Ok(PanelItemEvent::ToplevelResizeRequest {
3591                        up: up,
3592                        down: down,
3593                        left: left,
3594                        right: right,
3595                    })
3596                }
3597                3665525014775618530u64 => {
3598                    let (size): (stardust_xr::values::Vector2<u32>) = stardust_xr::schemas::flex::deserialize(
3599                        _data,
3600                    )?;
3601                    tracing::trace!(
3602                        ? size, "Got signal from server, {}::{}", "PanelItem",
3603                        "toplevel_size_changed"
3604                    );
3605                    Ok(PanelItemEvent::ToplevelSizeChanged {
3606                        size: size,
3607                    })
3608                }
3609                6092877811616586203u64 => {
3610                    let (geometry): (Geometry) = stardust_xr::schemas::flex::deserialize(
3611                        _data,
3612                    )?;
3613                    tracing::trace!(
3614                        ? geometry, "Got signal from server, {}::{}", "PanelItem",
3615                        "set_cursor"
3616                    );
3617                    Ok(PanelItemEvent::SetCursor {
3618                        geometry: geometry,
3619                    })
3620                }
3621                12365625385177885025u64 => {
3622                    let (): () = stardust_xr::schemas::flex::deserialize(_data)?;
3623                    tracing::trace!(
3624                        "Got signal from server, {}::{}", "PanelItem", "hide_cursor"
3625                    );
3626                    Ok(PanelItemEvent::HideCursor {})
3627                }
3628                13878060402106144481u64 => {
3629                    let (uid, info): (u64, ChildInfo) = stardust_xr::schemas::flex::deserialize(
3630                        _data,
3631                    )?;
3632                    tracing::trace!(
3633                        ? uid, ? info, "Got signal from server, {}::{}", "PanelItem",
3634                        "create_child"
3635                    );
3636                    Ok(PanelItemEvent::CreateChild {
3637                        uid: uid,
3638                        info: info,
3639                    })
3640                }
3641                4614990113965355127u64 => {
3642                    let (uid, geometry): (u64, Geometry) = stardust_xr::schemas::flex::deserialize(
3643                        _data,
3644                    )?;
3645                    tracing::trace!(
3646                        ? uid, ? geometry, "Got signal from server, {}::{}", "PanelItem",
3647                        "reposition_child"
3648                    );
3649                    Ok(PanelItemEvent::RepositionChild {
3650                        uid: uid,
3651                        geometry: geometry,
3652                    })
3653                }
3654                7048616010698587017u64 => {
3655                    let (uid): (u64) = stardust_xr::schemas::flex::deserialize(_data)?;
3656                    tracing::trace!(
3657                        ? uid, "Got signal from server, {}::{}", "PanelItem",
3658                        "destroy_child"
3659                    );
3660                    Ok(PanelItemEvent::DestroyChild {
3661                        uid: uid,
3662                    })
3663                }
3664                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
3665            }
3666        }
3667        fn parse_method(
3668            _client: &std::sync::Arc<crate::client::ClientHandle>,
3669            method_id: u64,
3670            _data: &[u8],
3671            _fds: Vec<std::os::fd::OwnedFd>,
3672            response: stardust_xr::messenger::MethodResponse,
3673        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
3674            match method_id {
3675                _ => {
3676                    let _ = response
3677                        .send(
3678                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
3679                        );
3680                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
3681                }
3682            }
3683        }
3684    }
3685    ///An item that represents a toplevel 2D window's surface (base window) and all its children (context menus, modals, etc.).
3686    pub trait PanelItemAspect: crate::node::NodeType + super::ItemAspect + super::SpatialRefAspect + super::OwnedAspect + super::SpatialAspect + std::fmt::Debug {
3687        fn recv_panel_item_event(&self) -> Option<PanelItemEvent>;
3688        ///Apply the cursor as a material to a model.
3689        fn apply_cursor_material(
3690            &self,
3691            model_part: &impl ModelPartAspect,
3692        ) -> crate::node::NodeResult<()> {
3693            let mut _fds = Vec::new();
3694            let data = (model_part.node().id);
3695            self.node()
3696                .send_signal(
3697                    16007573185838633179u64,
3698                    12984352657777750687u64,
3699                    &data,
3700                    _fds,
3701                )?;
3702            let (model_part) = data;
3703            tracing::trace!(
3704                ? model_part, "Sent signal to server, {}::{}", "PanelItem",
3705                "apply_cursor_material"
3706            );
3707            Ok(())
3708        }
3709        ///Apply a surface's visuals as a material to a model.
3710        fn apply_surface_material(
3711            &self,
3712            surface: SurfaceId,
3713            model_part: &impl ModelPartAspect,
3714        ) -> crate::node::NodeResult<()> {
3715            let mut _fds = Vec::new();
3716            let data = (surface, model_part.node().id);
3717            self.node()
3718                .send_signal(
3719                    16007573185838633179u64,
3720                    5538717944649978650u64,
3721                    &data,
3722                    _fds,
3723                )?;
3724            let (surface, model_part) = data;
3725            tracing::trace!(
3726                ? surface, ? model_part, "Sent signal to server, {}::{}", "PanelItem",
3727                "apply_surface_material"
3728            );
3729            Ok(())
3730        }
3731        /**Try to close the toplevel.
3732
3733        The panel item UI handler or panel item acceptor will drop the panel item if this succeeds.*/
3734        fn close_toplevel(&self) -> crate::node::NodeResult<()> {
3735            let mut _fds = Vec::new();
3736            let data = ();
3737            self.node()
3738                .send_signal(
3739                    16007573185838633179u64,
3740                    11149391162473273576u64,
3741                    &data,
3742                    _fds,
3743                )?;
3744            let () = data;
3745            tracing::trace!(
3746                "Sent signal to server, {}::{}", "PanelItem", "close_toplevel"
3747            );
3748            Ok(())
3749        }
3750        ///Request a resize of the surface to whatever size the 2D app wants.
3751        fn auto_size_toplevel(&self) -> crate::node::NodeResult<()> {
3752            let mut _fds = Vec::new();
3753            let data = ();
3754            self.node()
3755                .send_signal(
3756                    16007573185838633179u64,
3757                    7177229187692151305u64,
3758                    &data,
3759                    _fds,
3760                )?;
3761            let () = data;
3762            tracing::trace!(
3763                "Sent signal to server, {}::{}", "PanelItem", "auto_size_toplevel"
3764            );
3765            Ok(())
3766        }
3767        ///Request a resize of the surface (in pixels).
3768        fn set_toplevel_size(
3769            &self,
3770            size: impl Into<stardust_xr::values::Vector2<u32>>,
3771        ) -> crate::node::NodeResult<()> {
3772            let mut _fds = Vec::new();
3773            let data = (size.into());
3774            self.node()
3775                .send_signal(
3776                    16007573185838633179u64,
3777                    8102855835344875634u64,
3778                    &data,
3779                    _fds,
3780                )?;
3781            let (size) = data;
3782            tracing::trace!(
3783                ? size, "Sent signal to server, {}::{}", "PanelItem", "set_toplevel_size"
3784            );
3785            Ok(())
3786        }
3787        ///Tell the toplevel to appear focused visually if true, or unfocused if false.
3788        fn set_toplevel_focused_visuals(
3789            &self,
3790            focused: bool,
3791        ) -> crate::node::NodeResult<()> {
3792            let mut _fds = Vec::new();
3793            let data = (focused);
3794            self.node()
3795                .send_signal(
3796                    16007573185838633179u64,
3797                    3934600665134956080u64,
3798                    &data,
3799                    _fds,
3800                )?;
3801            let (focused) = data;
3802            tracing::trace!(
3803                ? focused, "Sent signal to server, {}::{}", "PanelItem",
3804                "set_toplevel_focused_visuals"
3805            );
3806            Ok(())
3807        }
3808        ///Send an event to set the pointer's position (in pixels, relative to top-left of surface). This will activate the pointer.
3809        fn pointer_motion(
3810            &self,
3811            surface: SurfaceId,
3812            position: impl Into<stardust_xr::values::Vector2<f32>>,
3813        ) -> crate::node::NodeResult<()> {
3814            let mut _fds = Vec::new();
3815            let data = (surface, position.into());
3816            self.node()
3817                .send_signal(
3818                    16007573185838633179u64,
3819                    651662101921814334u64,
3820                    &data,
3821                    _fds,
3822                )?;
3823            let (surface, position) = data;
3824            tracing::trace!(
3825                ? surface, ? position, "Sent signal to server, {}::{}", "PanelItem",
3826                "pointer_motion"
3827            );
3828            Ok(())
3829        }
3830        ///Send an event to set a pointer button's state if the pointer's active. The `button` is from the `input_event_codes` crate (e.g. BTN_LEFT for left click).
3831        fn pointer_button(
3832            &self,
3833            surface: SurfaceId,
3834            button: u32,
3835            pressed: bool,
3836        ) -> crate::node::NodeResult<()> {
3837            let mut _fds = Vec::new();
3838            let data = (surface, button, pressed);
3839            self.node()
3840                .send_signal(
3841                    16007573185838633179u64,
3842                    1617963334017359776u64,
3843                    &data,
3844                    _fds,
3845                )?;
3846            let (surface, button, pressed) = data;
3847            tracing::trace!(
3848                ? surface, ? button, ? pressed, "Sent signal to server, {}::{}",
3849                "PanelItem", "pointer_button"
3850            );
3851            Ok(())
3852        }
3853        /**Send an event to scroll the pointer if it's active.
3854Scroll distance is a value in pixels corresponding to the `distance` the surface should be scrolled.
3855Scroll steps is a value in columns/rows corresponding to the wheel clicks of a mouse or such. This also supports fractions of a wheel click.*/
3856        fn pointer_scroll(
3857            &self,
3858            surface: SurfaceId,
3859            scroll_distance: impl Into<stardust_xr::values::Vector2<f32>>,
3860            scroll_steps: impl Into<stardust_xr::values::Vector2<f32>>,
3861        ) -> crate::node::NodeResult<()> {
3862            let mut _fds = Vec::new();
3863            let data = (surface, scroll_distance.into(), scroll_steps.into());
3864            self.node()
3865                .send_signal(
3866                    16007573185838633179u64,
3867                    18077910517219850499u64,
3868                    &data,
3869                    _fds,
3870                )?;
3871            let (surface, scroll_distance, scroll_steps) = data;
3872            tracing::trace!(
3873                ? surface, ? scroll_distance, ? scroll_steps,
3874                "Sent signal to server, {}::{}", "PanelItem", "pointer_scroll"
3875            );
3876            Ok(())
3877        }
3878        ///Send an event to stop scrolling the pointer.
3879        fn pointer_stop_scroll(
3880            &self,
3881            surface: SurfaceId,
3882        ) -> crate::node::NodeResult<()> {
3883            let mut _fds = Vec::new();
3884            let data = (surface);
3885            self.node()
3886                .send_signal(
3887                    16007573185838633179u64,
3888                    13177724628894942354u64,
3889                    &data,
3890                    _fds,
3891                )?;
3892            let (surface) = data;
3893            tracing::trace!(
3894                ? surface, "Sent signal to server, {}::{}", "PanelItem",
3895                "pointer_stop_scroll"
3896            );
3897            Ok(())
3898        }
3899        ///Send a key press or release event with the given keymap ID.
3900        fn keyboard_key(
3901            &self,
3902            surface: SurfaceId,
3903            keymap_id: u64,
3904            key: u32,
3905            pressed: bool,
3906        ) -> crate::node::NodeResult<()> {
3907            let mut _fds = Vec::new();
3908            let data = (surface, keymap_id, key, pressed);
3909            self.node()
3910                .send_signal(
3911                    16007573185838633179u64,
3912                    18230480350930328965u64,
3913                    &data,
3914                    _fds,
3915                )?;
3916            let (surface, keymap_id, key, pressed) = data;
3917            tracing::trace!(
3918                ? surface, ? keymap_id, ? key, ? pressed,
3919                "Sent signal to server, {}::{}", "PanelItem", "keyboard_key"
3920            );
3921            Ok(())
3922        }
3923        ///Put a touch down on this surface with the unique ID `uid` at `position` (in pixels) from top left corner of the surface.
3924        fn touch_down(
3925            &self,
3926            surface: SurfaceId,
3927            uid: u32,
3928            position: impl Into<stardust_xr::values::Vector2<f32>>,
3929        ) -> crate::node::NodeResult<()> {
3930            let mut _fds = Vec::new();
3931            let data = (surface, uid, position.into());
3932            self.node()
3933                .send_signal(
3934                    16007573185838633179u64,
3935                    10543081656468919422u64,
3936                    &data,
3937                    _fds,
3938                )?;
3939            let (surface, uid, position) = data;
3940            tracing::trace!(
3941                ? surface, ? uid, ? position, "Sent signal to server, {}::{}",
3942                "PanelItem", "touch_down"
3943            );
3944            Ok(())
3945        }
3946        ///Move an existing touch point.
3947        fn touch_move(
3948            &self,
3949            uid: u32,
3950            position: impl Into<stardust_xr::values::Vector2<f32>>,
3951        ) -> crate::node::NodeResult<()> {
3952            let mut _fds = Vec::new();
3953            let data = (uid, position.into());
3954            self.node()
3955                .send_signal(
3956                    16007573185838633179u64,
3957                    15126475688563381777u64,
3958                    &data,
3959                    _fds,
3960                )?;
3961            let (uid, position) = data;
3962            tracing::trace!(
3963                ? uid, ? position, "Sent signal to server, {}::{}", "PanelItem",
3964                "touch_move"
3965            );
3966            Ok(())
3967        }
3968        ///Release a touch from its surface.
3969        fn touch_up(&self, uid: u32) -> crate::node::NodeResult<()> {
3970            let mut _fds = Vec::new();
3971            let data = (uid);
3972            self.node()
3973                .send_signal(
3974                    16007573185838633179u64,
3975                    6589027081119653997u64,
3976                    &data,
3977                    _fds,
3978                )?;
3979            let (uid) = data;
3980            tracing::trace!(
3981                ? uid, "Sent signal to server, {}::{}", "PanelItem", "touch_up"
3982            );
3983            Ok(())
3984        }
3985        ///Reset all input, such as pressed keys and pointer clicks and touches. Useful for when it's newly captured into an item acceptor to make sure no input gets stuck.
3986        fn reset_input(&self) -> crate::node::NodeResult<()> {
3987            let mut _fds = Vec::new();
3988            let data = ();
3989            self.node()
3990                .send_signal(
3991                    16007573185838633179u64,
3992                    14629122800709746500u64,
3993                    &data,
3994                    _fds,
3995                )?;
3996            let () = data;
3997            tracing::trace!("Sent signal to server, {}::{}", "PanelItem", "reset_input");
3998            Ok(())
3999        }
4000    }
4001    ///
4002    #[derive(Debug, Clone)]
4003    pub struct PanelItemUi {
4004        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
4005        pub(crate) item_ui_event: std::sync::Arc<
4006            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<ItemUiEvent>>,
4007        >,
4008        pub(crate) panel_item_ui_event: std::sync::Arc<
4009            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<PanelItemUiEvent>>,
4010        >,
4011    }
4012    impl PanelItemUi {
4013        pub(crate) fn from_id(
4014            client: &std::sync::Arc<crate::client::ClientHandle>,
4015            id: u64,
4016            owned: bool,
4017        ) -> Self {
4018            let core = std::sync::Arc::new(
4019                crate::node::NodeCore::new(client.clone(), id, owned),
4020            );
4021            let item_ui_event = std::sync::Arc::new(
4022                client.registry.add_aspect(id, 7265392688253796589u64).into(),
4023            );
4024            let panel_item_ui_event = std::sync::Arc::new(
4025                client.registry.add_aspect(id, 11713374794499719853u64).into(),
4026            );
4027            PanelItemUi {
4028                core,
4029                item_ui_event,
4030                panel_item_ui_event,
4031            }
4032        }
4033        pub fn as_item_ui(self) -> super::ItemUi {
4034            super::ItemUi {
4035                core: self.core,
4036                item_ui_event: self.item_ui_event,
4037            }
4038        }
4039    }
4040    impl crate::node::NodeType for PanelItemUi {
4041        fn node(&self) -> &crate::node::NodeCore {
4042            &self.core
4043        }
4044    }
4045    impl std::hash::Hash for PanelItemUi {
4046        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
4047            self.core.id.hash(state);
4048        }
4049    }
4050    impl std::cmp::PartialEq for PanelItemUi {
4051        fn eq(&self, other: &Self) -> bool {
4052            self.core.id == other.core.id
4053        }
4054    }
4055    impl std::cmp::Eq for PanelItemUi {}
4056    impl serde::Serialize for PanelItemUi {
4057        fn serialize<S: serde::Serializer>(
4058            &self,
4059            serializer: S,
4060        ) -> Result<S::Ok, S::Error> {
4061            serializer.serialize_u64(self.core.id)
4062        }
4063    }
4064    impl ItemUiAspect for PanelItemUi {
4065        fn recv_item_ui_event(&self) -> Option<ItemUiEvent> {
4066            self.item_ui_event.lock().unwrap().try_recv().ok()
4067        }
4068    }
4069    impl PanelItemUiAspect for PanelItemUi {
4070        fn recv_panel_item_ui_event(&self) -> Option<PanelItemUiEvent> {
4071            self.panel_item_ui_event.lock().unwrap().try_recv().ok()
4072        }
4073    }
4074    #[derive(Debug)]
4075    pub enum PanelItemUiEvent {
4076        CreateItem { item: PanelItem, initial_data: PanelItemInitData },
4077        CreateAcceptor { acceptor: PanelItemAcceptor, acceptor_field: Field },
4078    }
4079    impl crate::scenegraph::EventParser for PanelItemUiEvent {
4080        const ASPECT_ID: u64 = 11713374794499719853u64;
4081        fn parse_signal(
4082            _client: &std::sync::Arc<crate::client::ClientHandle>,
4083            signal_id: u64,
4084            _data: &[u8],
4085            _fds: Vec<std::os::fd::OwnedFd>,
4086        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
4087            match signal_id {
4088                15524466827491111758u64 => {
4089                    let (item, initial_data): (u64, PanelItemInitData) = stardust_xr::schemas::flex::deserialize(
4090                        _data,
4091                    )?;
4092                    tracing::trace!(
4093                        ? item, ? initial_data, "Got signal from server, {}::{}",
4094                        "PanelItemUi", "create_item"
4095                    );
4096                    Ok(PanelItemUiEvent::CreateItem {
4097                        item: PanelItem::from_id(_client, item, false),
4098                        initial_data: initial_data,
4099                    })
4100                }
4101                16628549773568263004u64 => {
4102                    let (acceptor, acceptor_field): (u64, u64) = stardust_xr::schemas::flex::deserialize(
4103                        _data,
4104                    )?;
4105                    tracing::trace!(
4106                        ? acceptor, ? acceptor_field, "Got signal from server, {}::{}",
4107                        "PanelItemUi", "create_acceptor"
4108                    );
4109                    Ok(PanelItemUiEvent::CreateAcceptor {
4110                        acceptor: PanelItemAcceptor::from_id(_client, acceptor, false),
4111                        acceptor_field: Field::from_id(_client, acceptor_field, false),
4112                    })
4113                }
4114                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
4115            }
4116        }
4117        fn parse_method(
4118            _client: &std::sync::Arc<crate::client::ClientHandle>,
4119            method_id: u64,
4120            _data: &[u8],
4121            _fds: Vec<std::os::fd::OwnedFd>,
4122            response: stardust_xr::messenger::MethodResponse,
4123        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
4124            match method_id {
4125                _ => {
4126                    let _ = response
4127                        .send(
4128                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
4129                        );
4130                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
4131                }
4132            }
4133        }
4134    }
4135    ///
4136    pub trait PanelItemUiAspect: crate::node::NodeType + super::ItemUiAspect + std::fmt::Debug {
4137        fn recv_panel_item_ui_event(&self) -> Option<PanelItemUiEvent>;
4138    }
4139    ///
4140    #[derive(Debug, Clone)]
4141    pub struct PanelItemAcceptor {
4142        pub(crate) core: std::sync::Arc<crate::node::NodeCore>,
4143        pub(crate) item_acceptor_event: std::sync::Arc<
4144            std::sync::Mutex<tokio::sync::mpsc::UnboundedReceiver<ItemAcceptorEvent>>,
4145        >,
4146        pub(crate) panel_item_acceptor_event: std::sync::Arc<
4147            std::sync::Mutex<
4148                tokio::sync::mpsc::UnboundedReceiver<PanelItemAcceptorEvent>,
4149            >,
4150        >,
4151    }
4152    impl PanelItemAcceptor {
4153        pub(crate) fn from_id(
4154            client: &std::sync::Arc<crate::client::ClientHandle>,
4155            id: u64,
4156            owned: bool,
4157        ) -> Self {
4158            let core = std::sync::Arc::new(
4159                crate::node::NodeCore::new(client.clone(), id, owned),
4160            );
4161            let item_acceptor_event = std::sync::Arc::new(
4162                client.registry.add_aspect(id, 10274055739447304636u64).into(),
4163            );
4164            let panel_item_acceptor_event = std::sync::Arc::new(
4165                client.registry.add_aspect(id, 6398932320740499836u64).into(),
4166            );
4167            PanelItemAcceptor {
4168                core,
4169                item_acceptor_event,
4170                panel_item_acceptor_event,
4171            }
4172        }
4173        pub fn as_item_acceptor(self) -> super::ItemAcceptor {
4174            super::ItemAcceptor {
4175                core: self.core,
4176                item_acceptor_event: self.item_acceptor_event,
4177            }
4178        }
4179        pub fn as_spatial_ref(self) -> super::SpatialRef {
4180            super::SpatialRef {
4181                core: self.core,
4182            }
4183        }
4184        pub fn as_spatial(self) -> super::Spatial {
4185            super::Spatial { core: self.core }
4186        }
4187    }
4188    impl crate::node::NodeType for PanelItemAcceptor {
4189        fn node(&self) -> &crate::node::NodeCore {
4190            &self.core
4191        }
4192    }
4193    impl std::hash::Hash for PanelItemAcceptor {
4194        fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
4195            self.core.id.hash(state);
4196        }
4197    }
4198    impl std::cmp::PartialEq for PanelItemAcceptor {
4199        fn eq(&self, other: &Self) -> bool {
4200            self.core.id == other.core.id
4201        }
4202    }
4203    impl std::cmp::Eq for PanelItemAcceptor {}
4204    impl serde::Serialize for PanelItemAcceptor {
4205        fn serialize<S: serde::Serializer>(
4206            &self,
4207            serializer: S,
4208        ) -> Result<S::Ok, S::Error> {
4209            serializer.serialize_u64(self.core.id)
4210        }
4211    }
4212    impl ItemAcceptorAspect for PanelItemAcceptor {
4213        fn recv_item_acceptor_event(&self) -> Option<ItemAcceptorEvent> {
4214            self.item_acceptor_event.lock().unwrap().try_recv().ok()
4215        }
4216    }
4217    impl SpatialRefAspect for PanelItemAcceptor {}
4218    impl OwnedAspect for PanelItemAcceptor {}
4219    impl SpatialAspect for PanelItemAcceptor {}
4220    impl PanelItemAcceptorAspect for PanelItemAcceptor {
4221        fn recv_panel_item_acceptor_event(&self) -> Option<PanelItemAcceptorEvent> {
4222            self.panel_item_acceptor_event.lock().unwrap().try_recv().ok()
4223        }
4224    }
4225    #[derive(Debug)]
4226    pub enum PanelItemAcceptorEvent {
4227        CaptureItem { item: PanelItem, initial_data: PanelItemInitData },
4228    }
4229    impl crate::scenegraph::EventParser for PanelItemAcceptorEvent {
4230        const ASPECT_ID: u64 = 6398932320740499836u64;
4231        fn parse_signal(
4232            _client: &std::sync::Arc<crate::client::ClientHandle>,
4233            signal_id: u64,
4234            _data: &[u8],
4235            _fds: Vec<std::os::fd::OwnedFd>,
4236        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
4237            match signal_id {
4238                1751367302976798762u64 => {
4239                    let (item, initial_data): (u64, PanelItemInitData) = stardust_xr::schemas::flex::deserialize(
4240                        _data,
4241                    )?;
4242                    tracing::trace!(
4243                        ? item, ? initial_data, "Got signal from server, {}::{}",
4244                        "PanelItemAcceptor", "capture_item"
4245                    );
4246                    Ok(PanelItemAcceptorEvent::CaptureItem {
4247                        item: PanelItem::from_id(_client, item, false),
4248                        initial_data: initial_data,
4249                    })
4250                }
4251                _ => Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
4252            }
4253        }
4254        fn parse_method(
4255            _client: &std::sync::Arc<crate::client::ClientHandle>,
4256            method_id: u64,
4257            _data: &[u8],
4258            _fds: Vec<std::os::fd::OwnedFd>,
4259            response: stardust_xr::messenger::MethodResponse,
4260        ) -> Result<Self, stardust_xr::scenegraph::ScenegraphError> {
4261            match method_id {
4262                _ => {
4263                    let _ = response
4264                        .send(
4265                            Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound),
4266                        );
4267                    Err(stardust_xr::scenegraph::ScenegraphError::MemberNotFound)
4268                }
4269            }
4270        }
4271    }
4272    ///
4273    pub trait PanelItemAcceptorAspect: crate::node::NodeType + super::ItemAcceptorAspect + super::SpatialRefAspect + super::OwnedAspect + super::SpatialAspect + std::fmt::Debug {
4274        fn recv_panel_item_acceptor_event(&self) -> Option<PanelItemAcceptorEvent>;
4275        ///
4276        fn capture_item(
4277            &self,
4278            item: &impl PanelItemAspect,
4279        ) -> crate::node::NodeResult<()> {
4280            let mut _fds = Vec::new();
4281            let data = (item.node().id);
4282            self.node()
4283                .send_signal(
4284                    6398932320740499836u64,
4285                    1751367302976798762u64,
4286                    &data,
4287                    _fds,
4288                )?;
4289            let (item) = data;
4290            tracing::trace!(
4291                ? item, "Sent signal to server, {}::{}", "PanelItemAcceptor",
4292                "capture_item"
4293            );
4294            Ok(())
4295        }
4296    }
4297    ///Register a keymap with the server to easily identify it later
4298    pub async fn register_keymap(
4299        _client: &std::sync::Arc<crate::client::ClientHandle>,
4300        keymap: &str,
4301    ) -> crate::node::NodeResult<u64> {
4302        let mut _fds = Vec::new();
4303        let data = (keymap);
4304        {
4305            let (keymap) = &data;
4306            tracing::trace!(
4307                ? keymap, "Called method on server, {}::{}", "Interface",
4308                "register_keymap"
4309            );
4310        }
4311        let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
4312        let message = _client
4313            .message_sender_handle
4314            .method(12u64, 0u64, 13267771052011565359u64, &serialized_data, _fds)
4315            .await?
4316            .map_err(|e| crate::node::NodeError::ReturnedError {
4317                e,
4318            })?
4319            .into_message();
4320        let result: u64 = stardust_xr::schemas::flex::deserialize(&message)?;
4321        let deserialized = result;
4322        tracing::trace!(
4323            "return" = ? deserialized, "Method return from server, {}::{}", "Interface",
4324            "register_keymap"
4325        );
4326        Ok(deserialized)
4327    }
4328    ///Get the keymap string representation from an ID
4329    pub async fn get_keymap(
4330        _client: &std::sync::Arc<crate::client::ClientHandle>,
4331        keymap_id: u64,
4332    ) -> crate::node::NodeResult<String> {
4333        let mut _fds = Vec::new();
4334        let data = (keymap_id);
4335        {
4336            let (keymap_id) = &data;
4337            tracing::trace!(
4338                ? keymap_id, "Called method on server, {}::{}", "Interface", "get_keymap"
4339            );
4340        }
4341        let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
4342        let message = _client
4343            .message_sender_handle
4344            .method(12u64, 0u64, 18393315648981916968u64, &serialized_data, _fds)
4345            .await?
4346            .map_err(|e| crate::node::NodeError::ReturnedError {
4347                e,
4348            })?
4349            .into_message();
4350        let result: String = stardust_xr::schemas::flex::deserialize(&message)?;
4351        let deserialized = result;
4352        tracing::trace!(
4353            "return" = ? deserialized, "Method return from server, {}::{}", "Interface",
4354            "get_keymap"
4355        );
4356        Ok(deserialized)
4357    }
4358    ///Register this client to manage the items of a certain type and create default 3D UI for them.
4359    pub fn register_panel_item_ui(
4360        _client: &std::sync::Arc<crate::client::ClientHandle>,
4361    ) -> crate::node::NodeResult<()> {
4362        let mut _fds = Vec::new();
4363        let data = ();
4364        let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
4365        _client
4366            .message_sender_handle
4367            .signal(12u64, 0u64, 13016197282381545765u64, &serialized_data, _fds)?;
4368        let () = data;
4369        tracing::trace!(
4370            "Sent signal to server, {}::{}", "Interface", "register_panel_item_ui"
4371        );
4372        Ok(())
4373    }
4374    ///Create an item acceptor to allow temporary ownership of a given type of item. Creates a node at `/item/panel/acceptor/<name>`.
4375    pub fn create_panel_item_acceptor(
4376        _client: &std::sync::Arc<crate::client::ClientHandle>,
4377        id: u64,
4378        parent: &impl SpatialRefAspect,
4379        transform: Transform,
4380        field: &impl FieldAspect,
4381    ) -> crate::node::NodeResult<PanelItemAcceptor> {
4382        {
4383            let mut _fds = Vec::new();
4384            let data = (id, parent.node().id, transform, field.node().id);
4385            let serialized_data = stardust_xr::schemas::flex::serialize(&data)?;
4386            _client
4387                .message_sender_handle
4388                .signal(12u64, 0u64, 793626320493717815u64, &serialized_data, _fds)?;
4389            let (id, parent, transform, field) = data;
4390            tracing::trace!(
4391                ? id, ? parent, ? transform, ? field, "Sent signal to server, {}::{}",
4392                "Interface", "create_panel_item_acceptor"
4393            );
4394        }
4395        Ok(PanelItemAcceptor::from_id(_client, id, true))
4396    }
4397}