wavefront_lighthouse/
wavefront-lighthouse.rs1extern crate mash;
2
3type Vertex = mash::Vector;
4type Index = u32;
5
6type Model = mash::Model<Vertex, Index>;
7
8fn main() {
9 let wavefront = mash::load::wavefront::from_path("res/lighthouse.obj").unwrap();
10
11 let pylon_obj = wavefront.objects().find(|o| o.name() == "pylon_rectangle").unwrap();
12 let lights_obj = wavefront.objects().find(|o| o.name() == "rotating_lights_cylinder").unwrap();
13
14 let pylon = Model::new(pylon_obj).unwrap();
15 let lights = Model::new(lights_obj).unwrap();
16
17 print_information("pylon", &pylon);
18 print_information("lights", &lights);
19}
20
21fn print_information(name: &str, model: &Model) {
22 println!("{}", name);
23 println!("-----------------------------");
24 println!("vertices: {}", model.mesh.vertices.len());
25 println!("indices: {}", model.mesh.indices.len());
26 println!("triangles: {}", model.mesh.triangles().count());
27 println!("");
28}
29