fx: json files

This commit is contained in:
djaidjai committed 2026-05-03 16:06:54 +02:00
1 parent 10f9c0984d
commit 549707fbb3
4 files changed
+29 -56

No files matched your search

+8 -3
View File
@@ -7,7 +7,7 @@ mod raytracer;
mod scenes;
mod vec3;
use std::fs;
use std::{env, fs};
use std::sync::Arc;
use crate::camera::Camera;
@@ -27,8 +27,13 @@ fn main() {
dotenv().ok();
pretty_env_logger::init();
// TODO: use cli arg for scenefile
let json_file = "./scenes/scene.json";
// TODO: better cli parsing
let mut json_file = "./scenes/scene.json";
let args: Vec<String> = env::args().collect();
if args.len() > 1 {
json_file = &args[1];
}
let json_str = fs::read_to_string(json_file).expect("Reading specified scene file failed!");
let mut scene: Scene = serde_json::from_str(&json_str).unwrap();
render(&mut scene);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.