/// Finish generating a sector whose terrain and geometry
/// has been generated in the worldgen thread, if the
/// sector is ready.
Finish generating a sector whose terrain and geometry
has been generated in the worldgen thread, if the
sector is ready.
Finish generating a sector whose terrain and geometry has been generated in the worldgen thread if the sector is ready .
pub fn finalize_sectors(&mut self, ctx: &mut impl GraphicsContext) {
        match self.generator.receiver().try_recv() {
            Ok(message) => {
                let tess = message.pre_geometry.map(|pre_geo| {                    
                    TessBuilder::new(ctx)
                        .add_vertices(pre_geo.vertices)
                        .set_indices(pre_geo.indices)
                        .set_mode(Mode::Triangle)
                        .build()
                        .unwrap()
                });
                let new_sector = Sector::new(message.world_pos, message.sector_data, tess);
                self.sectors.insert(message.world_pos, new_sector);
            }
            Err(_) => {}
        }
    }
pub fn finalize_sectors ( & mut self , ctx : & mut impl GraphicsContext ) { match self . generator . receiver ( ) . try_recv ( ) { Ok ( message ) => { let tess = message . pre_geometry . map ( | pre_geo | { TessBuilder :: new ( ctx ) . add_vertices ( pre_geo . vertices ) . set_indices ( pre_geo . indices ) . set_mode ( Mode :: Triangle ) . build ( ) . unwrap ( ) } ) ; let new_sector = Sector :: new ( message . world_pos , message . sector_data , tess ) ; self . sectors . insert ( message . world_pos , new_sector ) ; } Err ( _ ) => { } } }
Finish generating a sector whose terrain and geometry
has been generated in the worldgen thread, if the
sector is ready.
Finish generating a sector whose terrain and geometry has been generated in the worldgen thread if the sector is ready .
&mut self
ctx
&mut impl GraphicsContext