/// Updates polytopes after an operation.
Updates polytopes after an operation.
Updates polytopes after an operation .
pub fn update_changed_polytopes(
    mut meshes: ResMut<'_, Assets<Mesh>>,
    polies: Query<'_, '_, (&Concrete, &Handle<Mesh>, &Children), Changed<Concrete>>,
    wfs: Query<'_, '_, &Handle<Mesh>, Without<Concrete>>,
    mut section_state: ResMut<'_, SectionState>,
    orthogonal: Res<'_, ProjectionType>,
) {
    for (poly, mesh_handle, children) in polies.iter() {
        println!("Polytope updated");
        if cfg!(debug_assertions) {
            poly.assert_valid();
        }
        *meshes.get_mut(mesh_handle).unwrap() = poly.mesh(*orthogonal);
        // Updates all wireframes.
        for child in children.iter() {
            if let Ok(wf_handle) = wfs.get_component::<Handle<Mesh>>(*child) {
                *meshes.get_mut(wf_handle).unwrap() = poly.wireframe(*orthogonal);
            }
        }
        // We reset the cross-section view if we didn't use it to change the polytope.
        if !section_state.is_changed() {
            section_state.close();
        }
    }
}
pub fn update_changed_polytopes ( mut meshes : ResMut < ' _ , Assets < Mesh > > , polies : Query < ' _ , ' _ , ( & Concrete , & Handle < Mesh > , & Children ) , Changed < Concrete > > , wfs : Query < ' _ , ' _ , & Handle < Mesh > , Without < Concrete > > , mut section_state : ResMut < ' _ , SectionState > , orthogonal : Res < ' _ , ProjectionType > , ) { for ( poly , mesh_handle , children ) in polies . iter ( ) { println ! ( " " ) ; if cfg ! ( debug_assertions ) { poly . assert_valid ( ) ; } * meshes . get_mut ( mesh_handle ) . unwrap ( ) = poly . mesh ( * orthogonal ) ; // Updates all wireframes. for child in children . iter ( ) { if let Ok ( wf_handle ) = wfs . get_component :: < Handle < Mesh > > ( * child ) { * meshes . get_mut ( wf_handle ) . unwrap ( ) = poly . wireframe ( * orthogonal ) ; } } // We reset the cross-section view if we didn't use it to change the polytope. if ! section_state . is_changed ( ) { section_state . close ( ) ; } } }
Updates polytopes after an operation.
Updates polytopes after an operation .
meshes
ResMut<'_, Assets<Mesh>>
polies
Query<'_, '_, (&Concrete, &Handle<Mesh>, &Children), Changed<Concrete>>
wfs
Query<'_, '_, &Handle<Mesh>, Without<Concrete>>
section_state
ResMut<'_, SectionState>
orthogonal
Res<'_, ProjectionType>