Compare commits

...

4 commits

Author SHA1 Message Date
d36f4c0ed8 🤮 2024-04-10 08:07:02 -04:00
bd8fa9cebc lines instead? 2024-04-10 06:31:40 -04:00
82070bda11 no vertex colors? 2024-04-10 06:31:27 -04:00
7498e8fa10 nova: fixed model import by removing file extension 2024-04-10 05:26:46 -04:00
6 changed files with 337 additions and 6 deletions

1
Cargo.lock generated
View file

@ -140,6 +140,7 @@ name = "color_cube"
version = "0.1.0"
dependencies = [
"manifest-dir-macros",
"mint",
"stardust-xr-fusion",
"stardust-xr-molecules",
"tokio",

View file

@ -7,6 +7,7 @@ edition = "2021"
[dependencies]
manifest-dir-macros = "0.1.18"
mint = "0.5.9"
stardust-xr-fusion = { git = "https://github.com/StardustXR/core" }
stardust-xr-molecules = { git = "https://github.com/StardustXR/molecules" }
tokio = { version = "1.37.0", features = ["full"] }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,6 +1,6 @@
use manifest_dir_macros::directory_relative_path;
use stardust_xr_fusion::{
client::Client, core::values::ResourceID, drawable::Model, spatial::Transform
client::Client, core::values::Color, drawable::{Line, LinePoint, Lines}, spatial::Transform
};
#[tokio::main]
@ -8,13 +8,342 @@ async fn main() {
let (client, event_loop) = Client::connect_with_async_loop().await.unwrap();
client.set_base_prefixes(&[directory_relative_path!("res")]);
let _model = Model::create(
// stardust_xr_fusion::drawable::Model
// pub fn create(spatial_parent: &impl SpatialAspect, transform: Transform, model: &ResourceID) -> NodeResult<Self>
// let _model = Model::create(
// client.get_root(),
// Transform::identity(),
// &ResourceID::new_namespaced(
// "color_cube",
// "color_cube"
// ),
// ).unwrap();
let thickness = 0.03;
// stardust_xr_fusion::drawable::Lines
// pub fn create(spatial_parent: &impl SpatialAspect, transform: Transform, lines: &[Line]) -> NodeResult<Self>
let back_points = vec![
LinePoint {
point: mint::Vector3 {
x:-1.0,
y:-1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0x000000FF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y:-1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0xFF0000FF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y: 1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0xFFFF00FF),
},
LinePoint {
point: mint::Vector3 {
x:-1.0,
y: 1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0x00FF00FF),
},
];
let back_line = Line {
points: back_points,
cyclic: true,
};
let _back_lines = Lines::create(
client.get_root(),
Transform::identity(),
&ResourceID::new_namespaced(
"color_cube",
"color_cube.glb"
Transform::from_scale(
mint::Vector3 {
x: 0.1,
y: 0.1,
z: 0.1,
}
),
&[back_line]
).unwrap();
let front_points = vec![
LinePoint {
point: mint::Vector3 {
x:-1.0,
y:-1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0x0000FFFF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y:-1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0xFF00FFFF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y: 1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0xFFFFFFFF),
},
LinePoint {
point: mint::Vector3 {
x:-1.0,
y: 1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0x00FFFFFF),
},
];
let front_line = Line {
points: front_points,
cyclic: true,
};
let _front_lines = Lines::create(
client.get_root(),
Transform::from_scale(
mint::Vector3 {
x: 0.1,
y: 0.1,
z: 0.1,
}
),
&[front_line]
).unwrap();
let left_points = vec![
LinePoint {
point: mint::Vector3 {
x:-1.0,
y:-1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0x000000FF),
},
LinePoint {
point: mint::Vector3 {
x:-1.0,
y:-1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0x0000FFFF),
},
LinePoint {
point: mint::Vector3 {
x:-1.0,
y: 1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0x00FFFFFF),
},
LinePoint {
point: mint::Vector3 {
x:-1.0,
y: 1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0x00FF00FF),
},
];
let left_line = Line {
points: left_points,
cyclic: true,
};
let _left_lines = Lines::create(
client.get_root(),
Transform::from_scale(
mint::Vector3 {
x: 0.1,
y: 0.1,
z: 0.1,
}
),
&[left_line]
).unwrap();
let right_points = vec![
LinePoint {
point: mint::Vector3 {
x: 1.0,
y:-1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0xFF0000FF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y:-1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0xFF00FFFF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y: 1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0xFFFFFFFF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y: 1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0xFFFF00FF),
},
];
let right_line = Line {
points: right_points,
cyclic: true,
};
let _right_lines = Lines::create(
client.get_root(),
Transform::from_scale(
mint::Vector3 {
x: 0.1,
y: 0.1,
z: 0.1,
}
),
&[right_line]
).unwrap();
let bottom_points = vec![
LinePoint {
point: mint::Vector3 {
x:-1.0,
y:-1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0x000000FF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y:-1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0xFF0000FF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y:-1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0xFF00FFFF),
},
LinePoint {
point: mint::Vector3 {
x:-1.0,
y:-1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0x0000FFFF),
},
];
let bottom_line = Line {
points: bottom_points,
cyclic: true,
};
let _bottom_lines = Lines::create(
client.get_root(),
Transform::from_scale(
mint::Vector3 {
x: 0.1,
y: 0.1,
z: 0.1,
}
),
&[bottom_line]
).unwrap();
let top_points = vec![
LinePoint {
point: mint::Vector3 {
x:-1.0,
y: 1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0x00FF00FF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y: 1.0,
z:-1.0,
},
thickness: thickness,
color: Color::from_hex(0xFFFF00FF),
},
LinePoint {
point: mint::Vector3 {
x: 1.0,
y: 1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0xFFFFFFFF),
},
LinePoint {
point: mint::Vector3 {
x:-1.0,
y: 1.0,
z: 1.0,
},
thickness: thickness,
color: Color::from_hex(0x00FFFFFF),
},
];
let top_line = Line {
points: top_points,
cyclic: true,
};
let _top_lines = Lines::create(
client.get_root(),
Transform::from_scale(
mint::Vector3 {
x: 0.1,
y: 0.1,
z: 0.1,
}
),
&[top_line]
).unwrap();
tokio::select! {