➕ add CLI args
parent
ce29ce6ad1
commit
7d70c8af21
|
@ -1 +1,5 @@
|
|||
/target
|
||||
|
||||
*.blend
|
||||
*.glb
|
||||
*.iqm
|
||||
|
|
24
src/main.rs
24
src/main.rs
|
@ -9,7 +9,27 @@ use glam::{
|
|||
};
|
||||
|
||||
fn main () {
|
||||
let (document, buffers, _images) = gltf::import ("input.glb").unwrap ();
|
||||
// The `clap` crate is very popular but also very slow to compile,
|
||||
// so I'll do my own CLI parsing
|
||||
let mut args = std::env::args ();
|
||||
let _exe_name = args.next ().unwrap ();
|
||||
|
||||
let mut input_path = None;
|
||||
let mut output_path = None;
|
||||
|
||||
while let Some (arg) = args.next () {
|
||||
if arg == "--input" || arg == "-i" {
|
||||
input_path = args.next ();
|
||||
}
|
||||
else if arg == "--output" || arg == "-o" {
|
||||
output_path = args.next ();
|
||||
}
|
||||
}
|
||||
|
||||
let input_path = input_path.unwrap ();
|
||||
let output_path = output_path.unwrap ();
|
||||
|
||||
let (document, buffers, _images) = gltf::import (input_path).unwrap ();
|
||||
let buffer = buffers.get (0).unwrap ();
|
||||
|
||||
let mut vertexes = Vec::default ();
|
||||
|
@ -121,7 +141,7 @@ fn main () {
|
|||
|
||||
let filesize = ofs_text + num_text;
|
||||
|
||||
let mut f = File::create ("output.iqm").unwrap ();
|
||||
let mut f = File::create (output_path).unwrap ();
|
||||
|
||||
f.write_all (b"INTERQUAKEMODEL\0").unwrap ();
|
||||
|
||||
|
|
Loading…
Reference in New Issue