diff --git a/src/compiler.rs b/src/compiler.rs index 1c017f6..dcae291 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -61,7 +61,14 @@ pub fn compile(data: &str) -> String { 0, tokens[1].parse::().expect("non numeric value given"), )), - "sphere" => result.push_str(&sphere(Point::new(0.0, 0.0, 0.0), 1.0, 10).unwrap()), + "sphere" => result.push_str( + &sphere( + Point::new(0.0, 0.0, 0.0), + tokens[1].parse::().expect("non numeric value given"), + 10, + ) + .unwrap(), + ), "#" => todo!(), &_ => eprintln!("{} not supported", tokens[0]), } diff --git a/src/main.rs b/src/main.rs index 58f056b..f3c454c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,12 +13,11 @@ use std::path::Path; struct Args { #[arg(help = "source file")] source: String, - #[arg(help = "output file", default_value="")] + #[arg(help = "output file", default_value = "")] output: String, } fn main() { - println!("{}", compile("sphere 1")); let args = Args::parse(); diff --git a/src/shape.rs b/src/shape.rs index 6706a7b..df230c8 100644 --- a/src/shape.rs +++ b/src/shape.rs @@ -75,13 +75,13 @@ pub fn sphere(origin: Point, radius: f32, _detail: u32) -> Result