Skip to content

Commit

Permalink
Document None conditions on compute_aabb (#11051)
Browse files Browse the repository at this point in the history
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.

---------

Co-authored-by: Alice Cecile <[email protected]>
  • Loading branch information
nicopap and alice-i-cecile authored Dec 21, 2023
1 parent 049de6f commit fcb49a5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/bevy_render/src/mesh/mesh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 vertices.
pub fn compute_aabb(&self) -> Option<Aabb> {
let Some(VertexAttributeValues::Float32x3(values)) =
self.attribute(Mesh::ATTRIBUTE_POSITION)
Expand Down

0 comments on commit fcb49a5

Please sign in to comment.