lambda_platform/obj/
mod.rs

1use std::{
2  fs::File,
3  io::BufReader,
4};
5
6use obj::{
7  load_obj,
8  Obj,
9  TexturedVertex,
10};
11
12/// Loads a untextured obj file from the given path. Wrapper around the obj crate.
13pub fn load_obj_from_file(path: &str) -> Obj {
14  let file = File::open(path).unwrap();
15  let reader = BufReader::new(file);
16  let obj = load_obj(reader).expect("Failed to load the OBJ file.");
17  return obj;
18}
19
20/// Loads a textured obj file from the given path. Wrapper around the obj crate.
21pub fn load_textured_obj_from_file(path: &str) -> Obj<TexturedVertex> {
22  let file = File::open(path).unwrap();
23  let reader = BufReader::new(file);
24  let obj = load_obj(reader).expect("Failed to load obj file.");
25  return obj;
26}