feat: update molecules
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,3 +8,4 @@ Cargo.lock
|
|||||||
|
|
||||||
# These are backup files generated by rustfmt
|
# These are backup files generated by rustfmt
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
Cargo.lock
|
||||||
|
|||||||
29
Cargo.lock
generated
29
Cargo.lock
generated
@@ -1012,7 +1012,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "protostar"
|
name = "protostar"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"dirs",
|
"dirs",
|
||||||
@@ -1350,13 +1350,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stardust-xr"
|
name = "stardust-xr"
|
||||||
version = "0.8.2"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "751ea9078f39d03844a1cc967577ef0f2aab6818d4ce3f26861730f22e0d59f4"
|
checksum = "80780cd08fefcb6a67da0a92672fdd90f92873311940b5ca1c88b5132eaa70f7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"cluFlock",
|
"cluFlock",
|
||||||
"color-rs",
|
"color-rs",
|
||||||
|
"dirs",
|
||||||
"mint",
|
"mint",
|
||||||
"parking_lot 0.12.1",
|
"parking_lot 0.12.1",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
@@ -1365,14 +1366,13 @@ dependencies = [
|
|||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"xdg",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stardust-xr-fusion"
|
name = "stardust-xr-fusion"
|
||||||
version = "0.26.0"
|
version = "0.28.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c772d18b62dbb7c39ccb10640df7aa5f46205fbe42691398b007a85925f9b43f"
|
checksum = "009583e25bc59823abd97460f5823f4d91eb9b863665d61e3acaa91d404f02d3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"buildstructor",
|
"buildstructor",
|
||||||
@@ -1394,9 +1394,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stardust-xr-molecules"
|
name = "stardust-xr-molecules"
|
||||||
version = "0.8.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b04c8d70abfa2f120bb6b1ec92563e8e856b32a725422f4b28cb4c76a956abc7"
|
checksum = "39e22bf433fca1ff7794fd9e5d29c0cf43d8b76f78205ed814450a0d644222ca"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"color-rs",
|
"color-rs",
|
||||||
"flexbuffers",
|
"flexbuffers",
|
||||||
@@ -1412,9 +1412,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stardust-xr-schemas"
|
name = "stardust-xr-schemas"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9a60a7c0c8ace5604f1b010edc3507c95b7517c3c5957c44eaad4f4fa26e9617"
|
checksum = "12b2b760187d18535aadf608d6221506b1364a4fff14653f31c51a2fd6696fd9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"flatbuffers",
|
"flatbuffers",
|
||||||
"flexbuffers",
|
"flexbuffers",
|
||||||
@@ -1953,15 +1953,6 @@ version = "0.42.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
|
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "xdg"
|
|
||||||
version = "2.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6"
|
|
||||||
dependencies = [
|
|
||||||
"dirs",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "xkbcommon"
|
name = "xkbcommon"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "protostar"
|
name = "protostar"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -14,7 +14,7 @@ mint = "0.5.9"
|
|||||||
nix = "0.26.1"
|
nix = "0.26.1"
|
||||||
resvg = "0.28.0"
|
resvg = "0.28.0"
|
||||||
rustc-hash = "1.1.0"
|
rustc-hash = "1.1.0"
|
||||||
stardust-xr-molecules = "0.8.0"
|
stardust-xr-molecules = "0.10.0"
|
||||||
tokio = { version = "1.22.0", features = ["full"] }
|
tokio = { version = "1.22.0", features = ["full"] }
|
||||||
tween = "1.0.1"
|
tween = "1.0.1"
|
||||||
ustr = "0.9.0"
|
ustr = "0.9.0"
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ use nix::unistd::{execv, fork};
|
|||||||
use stardust_xr_molecules::{
|
use stardust_xr_molecules::{
|
||||||
fusion::{
|
fusion::{
|
||||||
client::{Client, LifeCycleHandler, LogicStepInfo},
|
client::{Client, LifeCycleHandler, LogicStepInfo},
|
||||||
|
core::values::Transform,
|
||||||
drawable::Model,
|
drawable::Model,
|
||||||
fields::SphereField,
|
fields::SphereField,
|
||||||
node::NodeType,
|
node::NodeType,
|
||||||
startup_settings::StartupSettings,
|
startup_settings::StartupSettings,
|
||||||
},
|
},
|
||||||
Grabbable,
|
GrabData, Grabbable,
|
||||||
};
|
};
|
||||||
use std::{ffi::CString, path::PathBuf, sync::Arc};
|
use std::{ffi::CString, path::PathBuf, sync::Arc};
|
||||||
use tween::{QuartInOut, Tweener};
|
use tween::{QuartInOut, Tweener};
|
||||||
@@ -26,21 +27,27 @@ pub struct ProtoStar {
|
|||||||
}
|
}
|
||||||
impl ProtoStar {
|
impl ProtoStar {
|
||||||
pub fn new(client: Arc<Client>, icon: PathBuf, size: f32, executable_path: PathBuf) -> Self {
|
pub fn new(client: Arc<Client>, icon: PathBuf, size: f32, executable_path: PathBuf) -> Self {
|
||||||
let field = SphereField::builder()
|
let field =
|
||||||
.spatial_parent(client.get_root())
|
SphereField::create(client.get_root(), Vector3::from([0.0; 3]), size * 0.5).unwrap();
|
||||||
.radius(size * 0.5)
|
let grabbable = Grabbable::new(
|
||||||
.build()
|
client.get_root(),
|
||||||
.unwrap();
|
Transform::default(),
|
||||||
let grabbable = Grabbable::new(client.get_root(), &field, 0.05).unwrap();
|
&field,
|
||||||
|
GrabData { max_distance: 0.05 },
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
field
|
field
|
||||||
.set_spatial_parent(grabbable.content_parent())
|
.set_spatial_parent(grabbable.content_parent())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let icon = Model::builder()
|
let icon = Model::create(
|
||||||
.spatial_parent(grabbable.content_parent())
|
grabbable.content_parent(),
|
||||||
.resource(&icon)
|
Transform {
|
||||||
.scale(Vector3::from([size; 3]))
|
scale: Vector3::from([size; 3]),
|
||||||
.build()
|
..Default::default()
|
||||||
.unwrap();
|
},
|
||||||
|
&icon,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
ProtoStar {
|
ProtoStar {
|
||||||
client,
|
client,
|
||||||
grabbable,
|
grabbable,
|
||||||
@@ -65,8 +72,7 @@ impl LifeCycleHandler for ProtoStar {
|
|||||||
self.client.stop_loop();
|
self.client.stop_loop();
|
||||||
}
|
}
|
||||||
} else if self.grabbable.grab_action().actor_stopped() {
|
} else if self.grabbable.grab_action().actor_stopped() {
|
||||||
let startup_settings =
|
let startup_settings = StartupSettings::create(&self.field.client().unwrap()).unwrap();
|
||||||
StartupSettings::create(&self.field.spatial.client().unwrap()).unwrap();
|
|
||||||
self.icon
|
self.icon
|
||||||
.set_spatial_parent_in_place(self.client.get_root())
|
.set_spatial_parent_in_place(self.client.get_root())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user