pub fn update_world(&self, player_pos: Point3f) {
        self.load_world_around(Point2f::new(player_pos.x, player_pos.y));

        let mut shared = self.shared.borrow_mut();
        let mut changed = false;

        loop {
            let (pos, chunk) = match shared.provided_chunks.try_recv() {
                Err(TryRecvError::Empty) => {
                    // No new chunks for us, we will check again next time ;-)
                    break;
                }
                Err(TryRecvError::Disconnected) => {
                    // The worker thread has shut down: this should never happen
                    // thus we can just panic, too.
                    error!("chunk providing worker thread shut down");
                    panic!("chunk providing worker thread shut down");
                }
                Ok(val) => val,
            };

            changed = true;
            shared
                .world_view
                .refresh_chunk(pos, &chunk, self.context.get_facade());

            shared.sent_requests.remove(&pos);
            let res = shared.world.add_chunk(pos, chunk);
            if res.is_err() {
                warn!("chunk at {:?} already exists!", pos);
            }
        }

        if changed {
            debug!("{} chunks loaded", shared.world.chunks.len());
        }
    }
/// Applies all queued updated to the actual world. Notably, all generated
/// chunks are added.
Applies all queued updated to the actual world. Notably, all generated
chunks are added.
Applies all queued updated to the actual world . Notably all generated chunks are added .
pub fn update_world(&self, player_pos: Point3f) {
        self.load_world_around(Point2f::new(player_pos.x, player_pos.y));
        let mut shared = self.shared.borrow_mut();
        let mut changed = false;
        loop {
            let (pos, chunk) = match shared.provided_chunks.try_recv() {
                Err(TryRecvError::Empty) => {
                    // No new chunks for us, we will check again next time ;-)
                    break;
                }
                Err(TryRecvError::Disconnected) => {
                    // The worker thread has shut down: this should never happen
                    // thus we can just panic, too.
                    error!("chunk providing worker thread shut down");
                    panic!("chunk providing worker thread shut down");
                }
                Ok(val) => val,
            };
            changed = true;
            shared
                .world_view
                .refresh_chunk(pos, &chunk, self.context.get_facade());
            shared.sent_requests.remove(&pos);
            let res = shared.world.add_chunk(pos, chunk);
            if res.is_err() {
                warn!("chunk at {:?} already exists!", pos);
            }
        }
        if changed {
            debug!("{} chunks loaded", shared.world.chunks.len());
        }
    }
pub fn update_world ( & self , player_pos : Point3f ) { self . load_world_around ( Point2f :: new ( player_pos . x , player_pos . y ) ) ; let mut shared = self . shared . borrow_mut ( ) ; let mut changed = false ; loop { let ( pos , chunk ) = match shared . provided_chunks . try_recv ( ) { Err ( TryRecvError :: Empty ) => { // No new chunks for us, we will check again next time ;-) break ; } Err ( TryRecvError :: Disconnected ) => { // The worker thread has shut down: this should never happen // thus we can just panic, too. error ! ( " " ) ; panic ! ( " " ) ; } Ok ( val ) => val , } ; changed = true ; shared . world_view . refresh_chunk ( pos , & chunk , self . context . get_facade ( ) ) ; shared . sent_requests . remove ( & pos ) ; let res = shared . world . add_chunk ( pos , chunk ) ; if res . is_err ( ) { warn ! ( " " pos ) ; } } if changed { debug ! ( " " shared world chunks len ( ) ) ; } }
Applies all queued updated to the actual world.
Applies all queued updated to the actual world .
&self
player_pos
Point3f