A big commit

This commit is contained in:
Thomas Forgione
2018-04-11 17:03:32 +02:00
parent 6cb76e9986
commit 211f7fc5c5
7 changed files with 129 additions and 30 deletions
+36 -3
View File
@@ -1,6 +1,9 @@
extern crate glium;
extern crate model_converter;
use std::env;
use std::process::exit;
use glium::Display;
use glium::glutin;
use glium::glutin::{
@@ -14,15 +17,45 @@ use glium::glutin::VirtualKeyCode;
use model_converter::math::vector::Vector3;
use model_converter::parser::{parse, parse_into_model};
use model_converter::parser::parse_into_model;
use model_converter::renderer::Renderer;
use model_converter::renderer::controls::OrbitControls;
use model_converter::renderer::camera::Camera;
use model_converter::model::Model;
fn main() {
let mut model = parse("./assets/models/link/link.mtl").unwrap();
parse_into_model("./assets/models/link/link.obj", &mut model).unwrap();
let mut model = Model::new();
let mut inputs = vec![];
let mut iterator = env::args();
// Skip the name of the program
iterator.next();
while let Some(argument) = iterator.next() {
match argument.as_ref() {
"-i" | "--input" => {
if let Some(path) = iterator.next() {
inputs.push(path);
} else {
eprintln!("Expecting path after {}", argument);
exit(-1);
}
},
arg => {
eprintln!("Argument unkown: {}", arg);
exit(-1);
},
}
}
for input in inputs {
if let Err(e) = parse_into_model(&input, &mut model) {
eprintln!("Error while parsing file: {}", e);
exit(1);
}
}
let mut events_loop = EventsLoop::new();
let window = WindowBuilder::new();