Rename ProcessedShape to Model

This commit is contained in:
Hanno Braun 2023-06-06 12:31:50 +02:00
parent 6d735f9c11
commit d6d657d401
4 changed files with 8 additions and 8 deletions

View File

@ -6,7 +6,7 @@ use crate::mesh::Mesh;
/// A processed shape /// A processed shape
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct ProcessedShape { pub struct Model {
/// The axis-aligned bounding box of the shape /// The axis-aligned bounding box of the shape
pub aabb: Aabb<3>, pub aabb: Aabb<3>,

View File

@ -1,7 +1,7 @@
//! Viewer camera module //! Viewer camera module
use std::f64::consts::FRAC_PI_2; use std::f64::consts::FRAC_PI_2;
use fj_interop::{mesh::Mesh, processed_shape::ProcessedShape}; use fj_interop::{mesh::Mesh, processed_shape::Model};
use fj_math::{Aabb, Point, Scalar, Transform, Vector}; use fj_math::{Aabb, Point, Scalar, Transform, Vector};
use crate::screen::NormalizedScreenPosition; use crate::screen::NormalizedScreenPosition;
@ -82,7 +82,7 @@ impl Camera {
pub fn focus_point( pub fn focus_point(
&self, &self,
cursor: Option<NormalizedScreenPosition>, cursor: Option<NormalizedScreenPosition>,
shape: &ProcessedShape, shape: &Model,
) -> FocusPoint { ) -> FocusPoint {
self.calculate_focus_point(cursor, &shape.mesh) self.calculate_focus_point(cursor, &shape.mesh)
.unwrap_or_else(|| FocusPoint(shape.aabb.center())) .unwrap_or_else(|| FocusPoint(shape.aabb.center()))

View File

@ -1,4 +1,4 @@
use fj_interop::processed_shape::ProcessedShape; use fj_interop::processed_shape::Model;
use fj_math::Aabb; use fj_math::Aabb;
use tracing::warn; use tracing::warn;
@ -28,7 +28,7 @@ pub struct Viewer {
pub renderer: Renderer, pub renderer: Renderer,
/// The shape /// The shape
pub shape: Option<ProcessedShape>, pub shape: Option<Model>,
} }
impl Viewer { impl Viewer {
@ -60,7 +60,7 @@ impl Viewer {
} }
/// Handle the shape being updated /// Handle the shape being updated
pub fn handle_shape_update(&mut self, shape: ProcessedShape) { pub fn handle_shape_update(&mut self, shape: Model) {
self.renderer.update_geometry((&shape.mesh).into()); self.renderer.update_geometry((&shape.mesh).into());
let aabb = shape.aabb; let aabb = shape.aabb;

View File

@ -1,4 +1,4 @@
use fj_interop::{mesh::Mesh, processed_shape::ProcessedShape}; use fj_interop::{mesh::Mesh, processed_shape::Model};
use fj_math::{Aabb, Point}; use fj_math::{Aabb, Point};
use fj_viewer::{ use fj_viewer::{
InputEvent, NormalizedScreenPosition, RendererInitError, Screen, InputEvent, NormalizedScreenPosition, RendererInitError, Screen,
@ -22,7 +22,7 @@ pub fn display(mesh: Mesh<Point<3>>, invert_zoom: bool) -> Result<(), Error> {
let window = Window::new(&event_loop)?; let window = Window::new(&event_loop)?;
let mut viewer = block_on(Viewer::new(&window))?; let mut viewer = block_on(Viewer::new(&window))?;
viewer.handle_shape_update(ProcessedShape { viewer.handle_shape_update(Model {
aabb: Aabb::<3>::from_points(mesh.vertices()), aabb: Aabb::<3>::from_points(mesh.vertices()),
mesh, mesh,
}); });