From aff137abe80a5a8dd461208feec076123a33499e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 6 Jun 2023 12:35:14 +0200 Subject: [PATCH 1/8] Update argument name --- crates/fj-viewer/src/camera.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-viewer/src/camera.rs b/crates/fj-viewer/src/camera.rs index 5f328f186..45066fb84 100644 --- a/crates/fj-viewer/src/camera.rs +++ b/crates/fj-viewer/src/camera.rs @@ -82,10 +82,10 @@ impl Camera { pub fn focus_point( &self, cursor: Option, - shape: &Model, + model: &Model, ) -> FocusPoint { - self.calculate_focus_point(cursor, &shape.mesh) - .unwrap_or_else(|| FocusPoint(shape.aabb.center())) + self.calculate_focus_point(cursor, &model.mesh) + .unwrap_or_else(|| FocusPoint(model.aabb.center())) } fn calculate_focus_point( From f4946eee98be98a92ccc95955d076d4d4d98c50c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 6 Jun 2023 12:36:28 +0200 Subject: [PATCH 2/8] Update struct field name --- crates/fj-viewer/src/viewer.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index 24cbc25e7..faf0512b0 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -28,7 +28,7 @@ pub struct Viewer { pub renderer: Renderer, /// The shape - pub shape: Option, + pub model: Option, } impl Viewer { @@ -43,7 +43,7 @@ impl Viewer { focus_point: None, input_handler: InputHandler::default(), renderer, - shape: None, + model: None, }) } @@ -64,7 +64,7 @@ impl Viewer { self.renderer.update_geometry((&shape.mesh).into()); let aabb = shape.aabb; - if self.shape.replace(shape).is_none() { + if self.model.replace(shape).is_none() { self.camera.init_planes(&aabb); } } @@ -84,7 +84,7 @@ impl Viewer { /// Compute and store a focus point, unless one is already stored pub fn add_focus_point(&mut self) { // Don't recompute the focus point unnecessarily. - if let Some(shape) = &self.shape { + if let Some(shape) = &self.model { if self.focus_point.is_none() { self.focus_point = Some(self.camera.focus_point(self.cursor, shape)); @@ -100,7 +100,7 @@ impl Viewer { /// Draw the graphics pub fn draw(&mut self) { let aabb = self - .shape + .model .as_ref() .map(|shape| shape.aabb) .unwrap_or_else(Aabb::default); From 0cd4ea88b402456b2ac2b54e5b5026115fae491b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 6 Jun 2023 12:36:54 +0200 Subject: [PATCH 3/8] Update doc comment --- crates/fj-viewer/src/viewer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index faf0512b0..e48069ef3 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -27,7 +27,7 @@ pub struct Viewer { /// The renderer pub renderer: Renderer, - /// The shape + /// The model pub model: Option, } From 2f822d0f4f93a5402b58ff19ba663301ce773db9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 6 Jun 2023 12:37:38 +0200 Subject: [PATCH 4/8] Update argument name --- crates/fj-viewer/src/viewer.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index e48069ef3..c61f53e76 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -60,11 +60,11 @@ impl Viewer { } /// Handle the shape being updated - pub fn handle_shape_update(&mut self, shape: Model) { - self.renderer.update_geometry((&shape.mesh).into()); + pub fn handle_shape_update(&mut self, model: Model) { + self.renderer.update_geometry((&model.mesh).into()); - let aabb = shape.aabb; - if self.model.replace(shape).is_none() { + let aabb = model.aabb; + if self.model.replace(model).is_none() { self.camera.init_planes(&aabb); } } From c75adde136557fcc9326d8b88b3b8a5831bd1b5c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 6 Jun 2023 12:38:11 +0200 Subject: [PATCH 5/8] Update method name --- crates/fj-viewer/src/viewer.rs | 2 +- crates/fj-window/src/display.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index c61f53e76..b07127dae 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -60,7 +60,7 @@ impl Viewer { } /// Handle the shape being updated - pub fn handle_shape_update(&mut self, model: Model) { + pub fn handle_model_update(&mut self, model: Model) { self.renderer.update_geometry((&model.mesh).into()); let aabb = model.aabb; diff --git a/crates/fj-window/src/display.rs b/crates/fj-window/src/display.rs index fb9ca48aa..209a9bca9 100644 --- a/crates/fj-window/src/display.rs +++ b/crates/fj-window/src/display.rs @@ -22,7 +22,7 @@ pub fn display(mesh: Mesh>, invert_zoom: bool) -> Result<(), Error> { let window = Window::new(&event_loop)?; let mut viewer = block_on(Viewer::new(&window))?; - viewer.handle_shape_update(Model { + viewer.handle_model_update(Model { aabb: Aabb::<3>::from_points(mesh.vertices()), mesh, }); From 765e7fb30915f0308eeebd5d6c987f9a82e891f8 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 6 Jun 2023 12:38:33 +0200 Subject: [PATCH 6/8] Update doc comment --- crates/fj-viewer/src/viewer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index b07127dae..6d6211fed 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -59,7 +59,7 @@ impl Viewer { } } - /// Handle the shape being updated + /// Handle the model being updated pub fn handle_model_update(&mut self, model: Model) { self.renderer.update_geometry((&model.mesh).into()); From 9c61771ecd59a617ac8d4d930c75cb4f4e1c53dc Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 6 Jun 2023 12:39:32 +0200 Subject: [PATCH 7/8] Update variable name --- crates/fj-viewer/src/viewer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index 6d6211fed..b50842c4e 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -84,10 +84,10 @@ impl Viewer { /// Compute and store a focus point, unless one is already stored pub fn add_focus_point(&mut self) { // Don't recompute the focus point unnecessarily. - if let Some(shape) = &self.model { + if let Some(model) = &self.model { if self.focus_point.is_none() { self.focus_point = - Some(self.camera.focus_point(self.cursor, shape)); + Some(self.camera.focus_point(self.cursor, model)); } } } From c8d5bef84015ec313f19aa58a0bde7280e2a90c6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 6 Jun 2023 12:40:01 +0200 Subject: [PATCH 8/8] Remove redundant comment --- crates/fj-viewer/src/viewer.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index b50842c4e..7abf32eb1 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -83,7 +83,6 @@ impl Viewer { /// Compute and store a focus point, unless one is already stored pub fn add_focus_point(&mut self) { - // Don't recompute the focus point unnecessarily. if let Some(model) = &self.model { if self.focus_point.is_none() { self.focus_point =