Skip to content

Commit

Permalink
Improve error handling in when updating shape
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed May 25, 2022
1 parent 7634d13 commit 72239d0
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions crates/fj-viewer/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,22 @@ pub fn run(
let now = Instant::now();

if let Some(new_shape) = watcher.receive() {
let new_shape = shape_processor.process(&new_shape).unwrap();
renderer.update_geometry(
(&new_shape.mesh).into(),
(&new_shape.debug_info).into(),
new_shape.aabb,
);

if camera.is_none() {
camera = Some(Camera::new(&new_shape.aabb));
}
match shape_processor.process(&new_shape) {
Ok(new_shape) => {
renderer.update_geometry(
(&new_shape.mesh).into(),
(&new_shape.debug_info).into(),
new_shape.aabb,
);

if camera.is_none() {
camera = Some(Camera::new(&new_shape.aabb));
}

shape = Some(new_shape);
shape = Some(new_shape);
}
Err(err) => println!("Shape processing error: {}", err),
}
}

match event {
Expand Down

0 comments on commit 72239d0

Please sign in to comment.