Explain how RegularPolygon mesh is generated (#10927)
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.
This commit is contained in:
		
							parent
							
								
									a7a5d17ae1
								
							
						
					
					
						commit
						ff7497cb9a
					
				@ -50,6 +50,8 @@ impl From<RegularPolygon> for Mesh {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        let mut indices = Vec::with_capacity((sides - 2) * 3);
 | 
					        let mut indices = Vec::with_capacity((sides - 2) * 3);
 | 
				
			||||||
        for i in 1..(sides as u32 - 1) {
 | 
					        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]);
 | 
					            indices.extend_from_slice(&[0, i + 1, i]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user