From 1e59e15dfed9a1ca5561cbaca8b34cf4d9c549d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 7 Jul 2024 13:33:34 +0200 Subject: [PATCH] followup --- benches/baking.rs | 4 ++-- src/input/triangulation.rs | 2 +- src/input/trimesh.rs | 2 +- src/lib.rs | 3 +++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/benches/baking.rs b/benches/baking.rs index 4d2c15b..e1c54ba 100644 --- a/benches/baking.rs +++ b/benches/baking.rs @@ -7,8 +7,8 @@ fn baking(c: &mut Criterion) { .unwrap(); c.bench_function(&"baking".to_string(), |b| { b.iter(|| { - mesh.unbake(); - mesh.bake(); + mesh.layers[0].unbake(); + mesh.layers[0].bake(); }) }); } diff --git a/src/input/triangulation.rs b/src/input/triangulation.rs index 82aae24..c2517c1 100644 --- a/src/input/triangulation.rs +++ b/src/input/triangulation.rs @@ -1,4 +1,4 @@ -use std::{collections::VecDeque, default}; +use std::collections::VecDeque; #[cfg(feature = "tracing")] use tracing::instrument; diff --git a/src/input/trimesh.rs b/src/input/trimesh.rs index 5195569..01804d1 100644 --- a/src/input/trimesh.rs +++ b/src/input/trimesh.rs @@ -1,7 +1,7 @@ use crate::{Layer, Mesh, MeshError, Polygon, Vertex}; use glam::Vec2; use std::cmp::Ordering; -use std::{default, iter}; +use std::iter; trait Triangle { fn get_clockwise_neighbor(&self, index: usize) -> usize; diff --git a/src/lib.rs b/src/lib.rs index 4b08b0c..872b139 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,6 +63,7 @@ pub struct Path { pub path: Vec, } +/// Layer of a NavMesh #[derive(Debug, Clone)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Layer { @@ -89,6 +90,7 @@ impl Default for Layer { #[derive(Debug, Clone)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Mesh { + /// Layers of the NavMesh pub layers: Vec, delta: f32, #[cfg(feature = "stats")] @@ -107,6 +109,7 @@ impl Default for Mesh { } impl Mesh { + /// Create a new single layer NavMesh pub fn new(vertices: Vec, polygons: Vec) -> Result { let layer = Layer::new(vertices, polygons)?; Ok(Mesh {