feat: update dependencies to use local paths for StardustXR crates; enhance reify method to include Axes elements for tracked nodes
This commit is contained in:
@@ -15,12 +15,10 @@ zbus = { version = "5.5.0", features = ["tokio"] }
|
|||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
|
||||||
[dependencies.stardust-xr-asteroids]
|
[dependencies.stardust-xr-asteroids]
|
||||||
git = "https://github.com/StardustXR/asteroids.git"
|
path = "../third_party/asteroids"
|
||||||
branch = "dev"
|
|
||||||
|
|
||||||
[dependencies.stardust-xr-fusion]
|
[dependencies.stardust-xr-fusion]
|
||||||
git = "https://github.com/StardustXR/core.git"
|
path = "../third_party/core"
|
||||||
branch = "dev"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# Feature enabling real StardustXR integration when crates are present.
|
# Feature enabling real StardustXR integration when crates are present.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use glam::Mat4;
|
|||||||
use stardust_xr_asteroids as ast; // alias for brevity
|
use stardust_xr_asteroids as ast; // alias for brevity
|
||||||
use stardust_xr_asteroids::{
|
use stardust_xr_asteroids::{
|
||||||
client::ClientState,
|
client::ClientState,
|
||||||
elements::PlaySpace,
|
elements::{PlaySpace, Axes},
|
||||||
Migrate, Reify,
|
Migrate, Reify,
|
||||||
};
|
};
|
||||||
use stardust_xr_asteroids::CustomElement;
|
use stardust_xr_asteroids::CustomElement;
|
||||||
@@ -34,8 +34,30 @@ impl ClientState for BridgeState {
|
|||||||
|
|
||||||
impl Reify for BridgeState {
|
impl Reify for BridgeState {
|
||||||
fn reify(&self) -> impl ast::Element<Self> {
|
fn reify(&self) -> impl ast::Element<Self> {
|
||||||
// Root playspace. We attach our dynamic nodes under this.
|
// Root playspace. Attach a visible Axes element per tracked node id.
|
||||||
PlaySpace.build()
|
// We read from the global CTRL so the element tree reflects the latest node registry.
|
||||||
|
let nodes = CTRL.lock().ok()
|
||||||
|
.map(|c| c.nodes.clone())
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
let children = nodes.into_iter().map(|(id, node)| {
|
||||||
|
// Decompose transform into TRS
|
||||||
|
let (scale, rot, trans) = node.transform.to_scale_rotation_translation();
|
||||||
|
// Axes are small; apply a uniform visual scale multiplier based on TRS scale.x
|
||||||
|
let vis_scale = glam::Vec3::new(scale.x, scale.y, scale.z) * 0.2;
|
||||||
|
(
|
||||||
|
id,
|
||||||
|
Axes::default()
|
||||||
|
.pos(trans)
|
||||||
|
.rot(rot)
|
||||||
|
.scl(vis_scale)
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
PlaySpace
|
||||||
|
.build()
|
||||||
|
.stable_children(children)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1
third_party/asteroids
vendored
Submodule
1
third_party/asteroids
vendored
Submodule
Submodule third_party/asteroids added at 38ec7d0470
1
third_party/core
vendored
Submodule
1
third_party/core
vendored
Submodule
Submodule third_party/core added at 5176d1e9d2
Reference in New Issue
Block a user