Skip to content

Commit

Permalink
Explain how RegularPolygon mesh is generated (bevyengine#10927)
Browse files Browse the repository at this point in the history
I didn't notice minus where vertices are generated, so could not
understand the order there.

Adding a comment to help the next person who is going to understand Bevy
by reading its code.
  • Loading branch information
stepancheg committed Dec 12, 2023
1 parent a7a5d17 commit ff7497c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/bevy_render/src/mesh/shape/regular_polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ impl From<RegularPolygon> for Mesh {

let mut indices = Vec::with_capacity((sides - 2) * 3);
for i in 1..(sides as u32 - 1) {
// Vertices are generated in CW order above, hence the reversed indices here
// to emit triangle vertices in CCW order.
indices.extend_from_slice(&[0, i + 1, i]);
}

Expand Down

0 comments on commit ff7497c

Please sign in to comment.