From bcea7e677e493805a3289dfb237b02408da69150 Mon Sep 17 00:00:00 2001 From: Nicola Papale Date: Thu, 21 Dec 2023 11:47:55 +0100 Subject: [PATCH 1/2] Document None conditions on compute_aabb The error conditions were not documented, this requires the user to inspect the source code to know when to expect a `None`. Error conditions should always be documented, so we document them. --- crates/bevy_render/src/mesh/mesh/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/bevy_render/src/mesh/mesh/mod.rs b/crates/bevy_render/src/mesh/mesh/mod.rs index 12713ce23b3d8..cfdecb9b38bd5 100644 --- a/crates/bevy_render/src/mesh/mesh/mod.rs +++ b/crates/bevy_render/src/mesh/mesh/mod.rs @@ -566,6 +566,9 @@ impl Mesh { } /// Compute the Axis-Aligned Bounding Box of the mesh vertices in model space + /// + /// Returns `None` if `self` doesn't have [`Mesh::ATTRIBUTE_POSITION`] of + /// type [`VertexAttributeValues::Float32x3`], or if `self` doesn't have any vertex. pub fn compute_aabb(&self) -> Option { let Some(VertexAttributeValues::Float32x3(values)) = self.attribute(Mesh::ATTRIBUTE_POSITION) From 84722678c5fef20665a041e31ea7cdf668cafd13 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Thu, 21 Dec 2023 18:15:31 -0500 Subject: [PATCH 2/2] Nit from JMS55 --- crates/bevy_render/src/mesh/mesh/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_render/src/mesh/mesh/mod.rs b/crates/bevy_render/src/mesh/mesh/mod.rs index cfdecb9b38bd5..84ff716c01eaf 100644 --- a/crates/bevy_render/src/mesh/mesh/mod.rs +++ b/crates/bevy_render/src/mesh/mesh/mod.rs @@ -568,7 +568,7 @@ impl Mesh { /// Compute the Axis-Aligned Bounding Box of the mesh vertices in model space /// /// Returns `None` if `self` doesn't have [`Mesh::ATTRIBUTE_POSITION`] of - /// type [`VertexAttributeValues::Float32x3`], or if `self` doesn't have any vertex. + /// type [`VertexAttributeValues::Float32x3`], or if `self` doesn't have any vertices. pub fn compute_aabb(&self) -> Option { let Some(VertexAttributeValues::Float32x3(values)) = self.attribute(Mesh::ATTRIBUTE_POSITION)