Made Mesh::merge take a reference of Mesh. (#13710)

# Objective

`Mesh::merge` does not need ownership of the right hand side mesh.

## Solution

Made `Mesh::merge` take a reference.

## Testing

Modified existing tests.

---

## Changelog

Made `Mesh::merge` take a reference.


## Migration Guide

* `Mesh::merge` now take a reference of a mesh instead of an owned mesh.
This commit is contained in:
Mincong Lu 2024-06-06 19:57:10 +08:00 committed by GitHub
parent 9389de5c71
commit 31be32ff10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -741,7 +741,7 @@ impl Mesh {
/// Panics if the vertex attribute values of `other` are incompatible with `self`.
/// For example, [`VertexAttributeValues::Float32`] is incompatible with [`VertexAttributeValues::Float32x3`].
#[allow(clippy::match_same_arms)]
pub fn merge(&mut self, other: Mesh) {
pub fn merge(&mut self, other: &Mesh) {
use VertexAttributeValues::*;
// The indices of `other` should start after the last vertex of `self`.

View file

@ -207,7 +207,7 @@ where
// An extrusion of depth 0 does not need a mantel
if self.half_depth == 0. {
front_face.merge(back_face);
front_face.merge(&back_face);
return front_face;
}
@ -374,8 +374,8 @@ where
.with_inserted_attribute(Mesh::ATTRIBUTE_UV_0, uvs)
};
front_face.merge(back_face);
front_face.merge(mantel);
front_face.merge(&back_face);
front_face.merge(&mantel);
front_face
}
}