Skip to content

Commit

Permalink
update to use new apis
Browse files Browse the repository at this point in the history
  • Loading branch information
cart committed Jun 15, 2022
1 parent 65d1e94 commit 7e4f535
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions crates/bevy_render/src/mesh/mesh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,19 @@ impl Mesh {
}

/// Returns an iterator that yields references to the data of each vertex attribute.
pub fn attributes(&self) -> impl Iterator<Item = (&str, &VertexAttributeValues)> {
self.attributes
.iter()
.map(|(name, values)| (name.as_ref(), values))
pub fn attributes(
&self,
) -> impl Iterator<Item = (MeshVertexAttributeId, &VertexAttributeValues)> {
self.attributes.iter().map(|(id, data)| (*id, &data.values))
}

/// Returns an iterator that yields mutable references to the data of each vertex attribute.
pub fn attributes_mut(&mut self) -> impl Iterator<Item = (&str, &mut VertexAttributeValues)> {
pub fn attributes_mut(
&mut self,
) -> impl Iterator<Item = (MeshVertexAttributeId, &mut VertexAttributeValues)> {
self.attributes
.iter_mut()
.map(|(name, values)| (name.as_ref(), values))
.map(|(id, data)| (*id, &mut data.values))
}

/// Sets the vertex indices of the mesh. They describe how triangles are constructed out of the
Expand Down

0 comments on commit 7e4f535

Please sign in to comment.