///
/// Iterates over all triangles in this mesh and calls the callback function with the three indices, one for each vertex in the triangle.
///
Iterates over all triangles in this mesh and calls the callback function with the three indices, one for each vertex in the triangle.
Iterates over all triangles in this mesh and calls the callback function with the three indices one for each vertex in the triangle .
pub fn for_each_triangle(&self, mut callback: impl FnMut(usize, usize, usize)) {
        match self.indices {
            Some(Indices::U8(ref indices)) => {
                for face in 0..indices.len() / 3 {
                    let index0 = indices[face * 3] as usize;
                    let index1 = indices[face * 3 + 1] as usize;
                    let index2 = indices[face * 3 + 2] as usize;
                    callback(index0, index1, index2);
                }
            }
            Some(Indices::U16(ref indices)) => {
                for face in 0..indices.len() / 3 {
                    let index0 = indices[face * 3] as usize;
                    let index1 = indices[face * 3 + 1] as usize;
                    let index2 = indices[face * 3 + 2] as usize;
                    callback(index0, index1, index2);
                }
            }
            Some(Indices::U32(ref indices)) => {
                for face in 0..indices.len() / 3 {
                    let index0 = indices[face * 3] as usize;
                    let index1 = indices[face * 3 + 1] as usize;
                    let index2 = indices[face * 3 + 2] as usize;
                    callback(index0, index1, index2);
                }
            }
            None => {
                for face in 0..self.positions.len() / 3 {
                    callback(face * 3, face * 3 + 1, face * 3 + 2);
                }
            }
        }
    }
pub fn for_each_triangle ( & self , mut callback : impl FnMut ( usize , usize , usize ) ) { match self . indices { Some ( Indices :: U8 ( ref indices ) ) => { for face in 0 .. indices . len ( ) / 3 { let index0 = indices [ face * 3 ] as usize ; let index1 = indices [ face * 3 + 1 ] as usize ; let index2 = indices [ face * 3 + 2 ] as usize ; callback ( index0 , index1 , index2 ) ; } } Some ( Indices :: U16 ( ref indices ) ) => { for face in 0 .. indices . len ( ) / 3 { let index0 = indices [ face * 3 ] as usize ; let index1 = indices [ face * 3 + 1 ] as usize ; let index2 = indices [ face * 3 + 2 ] as usize ; callback ( index0 , index1 , index2 ) ; } } Some ( Indices :: U32 ( ref indices ) ) => { for face in 0 .. indices . len ( ) / 3 { let index0 = indices [ face * 3 ] as usize ; let index1 = indices [ face * 3 + 1 ] as usize ; let index2 = indices [ face * 3 + 2 ] as usize ; callback ( index0 , index1 , index2 ) ; } } None => { for face in 0 .. self . positions . len ( ) / 3 { callback ( face * 3 , face * 3 + 1 , face * 3 + 2 ) ; } } } }
Iterates over all triangles in this mesh and calls the callback function with the three indices, one for each vertex in the triangle.
Iterates over all triangles in this mesh and calls the callback function with the three indices one for each vertex in the triangle .
&self
callback
impl FnMut(usize, usize, usize)