A big commit
This commit is contained in:
+36
-3
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user