feat: initial IDL

This commit is contained in:
Nova
2024-02-03 04:53:19 -05:00
parent f0200be990
commit 6eb36516b0
26 changed files with 945 additions and 186 deletions

View File

@@ -13,12 +13,13 @@ use once_cell::sync::OnceCell;
use parking_lot::Mutex;
use serde::Deserialize;
use stardust_xr::schemas::flex::{deserialize, serialize};
use stardust_xr::values::Transform;
use std::fmt::Debug;
use std::ptr;
use std::sync::{Arc, Weak};
use stereokit::{bounds_grow_to_fit_box, Bounds};
stardust_xr_server_codegen::codegen_spatial_protocol!();
static ZONEABLE_REGISTRY: Registry<Spatial> = Registry::new();
pub struct Spatial {
@@ -143,7 +144,7 @@ impl Spatial {
let (mut reference_space_scl, mut reference_space_rot, mut reference_space_pos) =
local_transform_in_reference_space.to_scale_rotation_translation();
if let Some(pos) = transform.position {
if let Some(pos) = transform.translation {
reference_space_pos = pos.into()
}
if let Some(rot) = transform.rotation {
@@ -467,7 +468,7 @@ impl Drop for Spatial {
pub fn parse_transform(transform: Transform, position: bool, rotation: bool, scale: bool) -> Mat4 {
let position = position
.then_some(transform.position)
.then_some(transform.translation)
.flatten()
.unwrap_or_else(|| Vector3::from([0.0; 3]));
let rotation = rotation