pub fn load_mesh(name: &str) -> Mesh {
    let mut mesh = Mesh {
        name: name.to_string(),
        vertices: Vec::new(),
        indices: Vec::new(),
    };
    let path = format!("assets/models/{}.obj", name);

    let text = fs::read_to_string(path).expect("Unable to load mesh!");
    let obj = parse_obj_file(text);

    for face in &obj.faces {
        let v1 = add_vertex(&mut mesh, &obj, &face.x);
        let v2 = add_vertex(&mut mesh, &obj, &face.y);
        let v3 = add_vertex(&mut mesh, &obj, &face.z);

        mesh.indices.push(v1 as u16);
        mesh.indices.push(v2 as u16);
        mesh.indices.push(v3 as u16);
    }

    mesh
}
/// Loads a mesh from the assets using the default pallete
Loads a mesh from the assets using the default pallete
Loads a mesh from the assets using the default pallete
pub fn load_mesh(name: &str) -> Mesh {
    let mut mesh = Mesh {
        name: name.to_string(),
        vertices: Vec::new(),
        indices: Vec::new(),
    };
    let path = format!("assets/models/{}.obj", name);
    let text = fs::read_to_string(path).expect("Unable to load mesh!");
    let obj = parse_obj_file(text);
    for face in &obj.faces {
        let v1 = add_vertex(&mut mesh, &obj, &face.x);
        let v2 = add_vertex(&mut mesh, &obj, &face.y);
        let v3 = add_vertex(&mut mesh, &obj, &face.z);
        mesh.indices.push(v1 as u16);
        mesh.indices.push(v2 as u16);
        mesh.indices.push(v3 as u16);
    }
    mesh
}
pub fn load_mesh ( name : & str ) -> Mesh { let mut mesh = Mesh { name : name . to_string ( ) , vertices : Vec :: new ( ) , indices : Vec :: new ( ) , } ; let path = format ! ( " " name ) ; let text = fs :: read_to_string ( path ) . expect ( " " ) ; let obj = parse_obj_file ( text ) ; for face in & obj . faces { let v1 = add_vertex ( & mut mesh , & obj , & face . x ) ; let v2 = add_vertex ( & mut mesh , & obj , & face . y ) ; let v3 = add_vertex ( & mut mesh , & obj , & face . z ) ; mesh . indices . push ( v1 as u16 ) ; mesh . indices . push ( v2 as u16 ) ; mesh . indices . push ( v3 as u16 ) ; } mesh }
Loads a mesh from the assets using the default pallete
Loads a mesh from the assets using the default pallete
name
&str
name
&str