From 938240e90d52ff4094e4562fd287b49556733494 Mon Sep 17 00:00:00 2001 From: _ <_@_> Date: Tue, 22 Feb 2022 01:16:27 +0000 Subject: [PATCH] :heavy_plus_sign: add `--scale` arg --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 2b2842c..956f467 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ use std::{ fs::File, io::Write, + str::FromStr, }; use glam::{ @@ -16,6 +17,7 @@ fn main () { let mut input_path = None; let mut output_path = None; + let mut scale = 1.0; while let Some (arg) = args.next () { if arg == "--input" || arg == "-i" { @@ -24,6 +26,9 @@ fn main () { else if arg == "--output" || arg == "-o" { output_path = args.next (); } + else if arg == "--scale" { + scale = f32::from_str (&args.next ().unwrap ()).unwrap (); + } } let input_path = input_path.unwrap (); @@ -266,7 +271,7 @@ fn main () { for v in &vertexes { for x in v.position { - f.write_all (&(f32::to_le_bytes (x))).unwrap (); + f.write_all (&(f32::to_le_bytes (x * scale))).unwrap (); } }