|
|
@ -156,18 +156,16 @@ fn update_fj_model_system(
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
FjConvertedFlag
|
|
|
|
FjConvertedFlag
|
|
|
|
|
|
|
|
|
|
|
|
));
|
|
|
|
));
|
|
|
|
add_debug_info_to_entity(&mut commands, solid, &mut meshes, &mut materials);
|
|
|
|
add_debug_info_to_entity(&mut commands, solid, &mut meshes, &mut materials);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn render_line(mut commands: &mut Commands,
|
|
|
|
fn render_line<const T: usize>(mut commands: &mut Commands,
|
|
|
|
fj_model: &FjMeshWrapper,
|
|
|
|
fj_model: &FjMeshWrapper,
|
|
|
|
mut meshes: &mut ResMut<Assets<Mesh>>,
|
|
|
|
mut meshes: &mut ResMut<Assets<Mesh>>,
|
|
|
|
mut materials: &mut ResMut<Assets<StandardMaterial>>,
|
|
|
|
mut materials: &mut ResMut<Assets<StandardMaterial>>,
|
|
|
|
line: Line<2>) {
|
|
|
|
line: Line<T>) {
|
|
|
|
|
|
|
|
|
|
|
|
let origin = line.origin().to_xyz();
|
|
|
|
let origin = line.origin().to_xyz();
|
|
|
|
let direction = line.direction().to_xyz();
|
|
|
|
let direction = line.direction().to_xyz();
|
|
|
|
let opposite_corner = Vec3::new(
|
|
|
|
let opposite_corner = Vec3::new(
|
|
|
@ -199,15 +197,13 @@ fn render_line(mut commands: &mut Commands,
|
|
|
|
// RaycastPickTarget::default(), // <- Needed for the raycast backend.
|
|
|
|
// RaycastPickTarget::default(), // <- Needed for the raycast backend.
|
|
|
|
// PickableBundle::default() // <- This one too
|
|
|
|
// PickableBundle::default() // <- This one too
|
|
|
|
));
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn add_debug_info_to_entity(mut commands: &mut Commands,
|
|
|
|
fn add_debug_info_to_entity(mut commands: &mut Commands,
|
|
|
|
fj_model: &FjMeshWrapper,
|
|
|
|
fj_model: &FjMeshWrapper,
|
|
|
|
mut meshes: &mut ResMut<Assets<Mesh>>,
|
|
|
|
mut meshes: &mut ResMut<Assets<Mesh>>,
|
|
|
|
mut materials: &mut ResMut<Assets<StandardMaterial>>
|
|
|
|
mut materials: &mut ResMut<Assets<StandardMaterial>>,
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
|
|
for region in fj_model.sketch.regions() {
|
|
|
|
for region in fj_model.sketch.regions() {
|
|
|
|
for cycle in region.all_cycles() {
|
|
|
|
for cycle in region.all_cycles() {
|
|
|
|
for half_edge in cycle.half_edges() {
|
|
|
|
for half_edge in cycle.half_edges() {
|
|
|
@ -225,7 +221,6 @@ fn add_debug_info_to_entity(mut commands: &mut Commands,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for shell in fj_model.handle.shells() {
|
|
|
|
for shell in fj_model.handle.shells() {
|
|
|
|
println!("{:?}. shell", shell);
|
|
|
|
println!("{:?}. shell", shell);
|
|
|
|
for face in shell.faces() {
|
|
|
|
for face in shell.faces() {
|
|
|
@ -238,6 +233,8 @@ fn add_debug_info_to_entity(mut commands: &mut Commands,
|
|
|
|
x.aabb();
|
|
|
|
x.aabb();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
GlobalPath::Line(x) => {
|
|
|
|
GlobalPath::Line(x) => {
|
|
|
|
|
|
|
|
render_line(commands, fj_model, meshes, materials, x);
|
|
|
|
|
|
|
|
|
|
|
|
let origin = x.origin();
|
|
|
|
let origin = x.origin();
|
|
|
|
let direction = x.direction();
|
|
|
|
let direction = x.direction();
|
|
|
|
let opposite_corner = Vec3::new(
|
|
|
|
let opposite_corner = Vec3::new(
|
|
|
@ -249,16 +246,6 @@ fn add_debug_info_to_entity(mut commands: &mut Commands,
|
|
|
|
let red: f32 = rng.gen_range(0.0..1.0);
|
|
|
|
let red: f32 = rng.gen_range(0.0..1.0);
|
|
|
|
let green: f32 = rng.gen_range(0.0..1.0);
|
|
|
|
let green: f32 = rng.gen_range(0.0..1.0);
|
|
|
|
let blue: f32 = rng.gen_range(0.0..1.0);
|
|
|
|
let blue: f32 = rng.gen_range(0.0..1.0);
|
|
|
|
commands.spawn(( // line on base of sweep
|
|
|
|
|
|
|
|
PbrBundle {
|
|
|
|
|
|
|
|
mesh: meshes.add(Mesh::from(shape::Box::from_corners(opposite_corner.into(), origin.to_vec3()))),
|
|
|
|
|
|
|
|
material: materials.add(Color::rgb(red, green, blue).into()),
|
|
|
|
|
|
|
|
transform: Transform::from_xyz(0.0, 0.0, 0.0),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// RaycastPickTarget::default(), // <- Needed for the raycast backend.
|
|
|
|
|
|
|
|
// PickableBundle::default() // <- This one too
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
commands.spawn(( // line on top of sweep, just offset by the sweep vector
|
|
|
|
commands.spawn(( // line on top of sweep, just offset by the sweep vector
|
|
|
|
PbrBundle {
|
|
|
|
PbrBundle {
|
|
|
|
mesh: meshes.add(Mesh::from(shape::Box::from_corners(opposite_corner.into(), origin.to_vec3()))),
|
|
|
|
mesh: meshes.add(Mesh::from(shape::Box::from_corners(opposite_corner.into(), origin.to_vec3()))),
|
|
|
@ -279,16 +266,6 @@ fn add_debug_info_to_entity(mut commands: &mut Commands,
|
|
|
|
// RaycastPickTarget::default(), // <- Needed for the raycast backend.
|
|
|
|
// RaycastPickTarget::default(), // <- Needed for the raycast backend.
|
|
|
|
// PickableBundle::default() // <- This one too
|
|
|
|
// PickableBundle::default() // <- This one too
|
|
|
|
));
|
|
|
|
));
|
|
|
|
commands.spawn(( // vertex
|
|
|
|
|
|
|
|
PbrBundle {
|
|
|
|
|
|
|
|
mesh: meshes.add(Mesh::from(shape::Cube { size: 0.025 })),
|
|
|
|
|
|
|
|
material: materials.add(Color::rgb(1.0, 1.0, 1.0).into()),
|
|
|
|
|
|
|
|
transform: Transform::from_xyz(origin.to_xyz().x.into_f32(), origin.to_xyz().y.into_f32(), origin.to_xyz().z.into_f32()),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// RaycastPickTarget::default(), // <- Needed for the raycast backend.
|
|
|
|
|
|
|
|
// PickableBundle::default() // <- This one too
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
commands.spawn(( // swept vertex
|
|
|
|
commands.spawn(( // swept vertex
|
|
|
|
PbrBundle {
|
|
|
|
PbrBundle {
|
|
|
|
mesh: meshes.add(Mesh::from(shape::Cube { size: 0.025 })),
|
|
|
|
mesh: meshes.add(Mesh::from(shape::Cube { size: 0.025 })),
|
|
|
|