stardust_xr_fusion/
fields.rs

1//! Analog SDFs to define boundaries for input, interaction, and behavior.
2
3use std::sync::Arc;
4
5use crate::{
6	client::ClientHandle,
7	node::NodeResult,
8	spatial::{SpatialRefAspect, Transform},
9};
10
11pub use crate::protocol::field::*;
12
13impl FieldRef {
14	pub async fn import(client: &Arc<ClientHandle>, uid: u64) -> NodeResult<Self> {
15		import_field_ref(client, uid).await
16	}
17}
18impl Field {
19	pub fn create(
20		spatial_parent: &impl SpatialRefAspect,
21		transform: Transform,
22		shape: Shape,
23	) -> NodeResult<Self> {
24		let client = spatial_parent.client();
25		create_field(
26			client,
27			client.generate_id(),
28			spatial_parent,
29			transform,
30			shape,
31		)
32	}
33}
34
35// TODO: write proper tests for each field shape and setting shape