fn create_target_vertices(face: usize) -> Vec<SkyboxVertex> {
    // TODO: simplify this
    let mut vertices = Vec::new();
    fn vpos(i: i32, j: i32, k: i32, face: usize) -> SkyboxVertex {
        let mut v = [i as f32, j as f32, k as f32];
        for i in 0..3 {
            if i == face / 2 {
                // Move face forward
                v[i] += 0.001 * (if face % 2 == 0 { 1.0 } else { -1.0 });
            } else {
                // Move edges inside the face
                if v[i] == 1.0 {
                    v[i] = 0.999;
                } else {
                    v[i] = 0.001;
                }
            }
        }
        SkyboxVertex { position: v }
    }
    let end_coord = [
        if face == 1 { 1 } else { 2 },
        if face == 3 { 1 } else { 2 },
        if face == 5 { 1 } else { 2 },
    ];
    let start_coord = [
        if face == 0 { 1 } else { 0 },
        if face == 2 { 1 } else { 0 },
        if face == 4 { 1 } else { 0 },
    ];
    for i in start_coord[0]..end_coord[0] {
        for j in start_coord[1]..end_coord[1] {
            for k in start_coord[2]..end_coord[2] {
                let mut id = [i, j, k];
                for i in 0..3 {
                    if id[i] > start_coord[i] {
                        let v1 = vpos(id[0], id[1], id[2], face);
                        id[i] = 0;
                        let v2 = vpos(id[0], id[1], id[2], face);
                        id[i] = 1;
                        vertices.extend([v1, v2].iter());
                    }
                }
            }
        }
    }
    vertices
}
/// Create target vertices for some given face
Create target vertices for some given face
Create target vertices for some given face
fn create_target_vertices(face: usize) -> Vec<SkyboxVertex> {
    // TODO: simplify this
    let mut vertices = Vec::new();
    fn vpos(i: i32, j: i32, k: i32, face: usize) -> SkyboxVertex {
        let mut v = [i as f32, j as f32, k as f32];
        for i in 0..3 {
            if i == face / 2 {
                // Move face forward
                v[i] += 0.001 * (if face % 2 == 0 { 1.0 } else { -1.0 });
            } else {
                // Move edges inside the face
                if v[i] == 1.0 {
                    v[i] = 0.999;
                } else {
                    v[i] = 0.001;
                }
            }
        }
        SkyboxVertex { position: v }
    }
    let end_coord = [
        if face == 1 { 1 } else { 2 },
        if face == 3 { 1 } else { 2 },
        if face == 5 { 1 } else { 2 },
    ];
    let start_coord = [
        if face == 0 { 1 } else { 0 },
        if face == 2 { 1 } else { 0 },
        if face == 4 { 1 } else { 0 },
    ];
    for i in start_coord[0]..end_coord[0] {
        for j in start_coord[1]..end_coord[1] {
            for k in start_coord[2]..end_coord[2] {
                let mut id = [i, j, k];
                for i in 0..3 {
                    if id[i] > start_coord[i] {
                        let v1 = vpos(id[0], id[1], id[2], face);
                        id[i] = 0;
                        let v2 = vpos(id[0], id[1], id[2], face);
                        id[i] = 1;
                        vertices.extend([v1, v2].iter());
                    }
                }
            }
        }
    }
    vertices
}
fn create_target_vertices ( face : usize ) -> Vec < SkyboxVertex > { // TODO: simplify this let mut vertices = Vec :: new ( ) ; fn vpos ( i : i32 , j : i32 , k : i32 , face : usize ) -> SkyboxVertex { let mut v = [ i as f32 , j as f32 , k as f32 ] ; for i in 0 .. 3 { if i == face / 2 { // Move face forward v [ i ] += 0.001 * ( if face % 2 == 0 { 1.0 } else { - 1.0 } ) ; } else { // Move edges inside the face if v [ i ] == 1.0 { v [ i ] = 0.999 ; } else { v [ i ] = 0.001 ; } } } SkyboxVertex { position : v } } let end_coord = [ if face == 1 { 1 } else { 2 } , if face == 3 { 1 } else { 2 } , if face == 5 { 1 } else { 2 } , ] ; let start_coord = [ if face == 0 { 1 } else { 0 } , if face == 2 { 1 } else { 0 } , if face == 4 { 1 } else { 0 } , ] ; for i in start_coord [ 0 ] .. end_coord [ 0 ] { for j in start_coord [ 1 ] .. end_coord [ 1 ] { for k in start_coord [ 2 ] .. end_coord [ 2 ] { let mut id = [ i , j , k ] ; for i in 0 .. 3 { if id [ i ] > start_coord [ i ] { let v1 = vpos ( id [ 0 ] , id [ 1 ] , id [ 2 ] , face ) ; id [ i ] = 0 ; let v2 = vpos ( id [ 0 ] , id [ 1 ] , id [ 2 ] , face ) ; id [ i ] = 1 ; vertices . extend ( [ v1 , v2 ] . iter ( ) ) ; } } } } } vertices }
Create target vertices for some given face
Create target vertices for some given face
face
usize
face
usize