forked from StudioInfinity/dyna3
51 lines
No EOL
1.5 KiB
Rust
51 lines
No EOL
1.5 KiB
Rust
mod assembly;
|
|
mod display;
|
|
mod outline;
|
|
|
|
use nalgebra::DVector;
|
|
use sycamore::prelude::*;
|
|
|
|
use assembly::{Assembly, Element};
|
|
use display::Display;
|
|
use outline::Outline;
|
|
|
|
#[derive(Clone)]
|
|
struct AppState {
|
|
assembly: Assembly
|
|
}
|
|
|
|
fn main() {
|
|
sycamore::render(|| {
|
|
provide_context(
|
|
AppState {
|
|
assembly: Assembly {
|
|
elements: create_signal(vec![
|
|
Element {
|
|
id: String::from("wing_a"),
|
|
label: String::from("Wing A"),
|
|
color: [1.00_f32, 0.25_f32, 0.00_f32],
|
|
rep: DVector::<f64>::from_column_slice(&[0.5, 0.5, 0.0, 0.5, -0.25])
|
|
},
|
|
Element {
|
|
id: String::from("wing_b"),
|
|
label: String::from("Wing B"),
|
|
color: [0.00_f32, 0.25_f32, 1.00_f32],
|
|
rep: DVector::<f64>::from_column_slice(&[-0.5, -0.5, 0.0, 0.5, -0.25])
|
|
},
|
|
Element {
|
|
id: String::from("central"),
|
|
label: String::from("Central"),
|
|
color: [0.75_f32, 0.75_f32, 0.75_f32],
|
|
rep: DVector::<f64>::from_column_slice(&[0.0, 0.0, 0.0, 0.4, -0.625])
|
|
}
|
|
])
|
|
}
|
|
}
|
|
);
|
|
|
|
view! {
|
|
Outline {}
|
|
Display {}
|
|
}
|
|
});
|
|
} |