ft: deserialization

This commit is contained in:
2026-04-26 23:49:03 +02:00
parent 430bdf63bc
commit 076bcc7155
5 changed files with 55 additions and 27 deletions

View File

@@ -72,14 +72,15 @@ fn random_sphere_on_floor<T: Hittable>(
sphere
}
// FIXME: bunch of unwraps/expects in deserialization code
// TODO: implement scene serialization
fn main() {
dotenv().ok();
pretty_env_logger::init();
// TODO: use cli arg for scenefile
let json_str = fs::read_to_string("./scenes/scene.json").expect("waddehell!");
let json_file = "./scenes/scenes.json";
// let json_file = "./scenes/failsMatBounds.json";
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();
scene.render();