From e09b0a9e1d37004d45c52ed317e3b5fc22cec384 Mon Sep 17 00:00:00 2001 From: Jonathan Flueren <11487762+JonOfUs@users.noreply.github.com> Date: Sun, 17 Jul 2022 02:22:09 +0200 Subject: [PATCH] First mesh render --- src/main.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index 7556afa..8bea18f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -171,7 +171,6 @@ fn random_world() -> HittableList { } fn from_obj(path: &str) -> HittableList { - let mut world = HittableList::new(); let material_ground = Arc::new(Lambertian::new(&Color::new(0.05, 0.05, 0.05))); @@ -216,30 +215,31 @@ fn from_obj(path: &str) -> HittableList { Point3::new( mesh.positions[3 * index_a] as f64, mesh.positions[3 * index_a + 1] as f64, - mesh.positions[3 * index_a + 2] as f64 + mesh.positions[3 * index_a + 2] as f64, ), Point3::new( mesh.positions[3 * index_b] as f64, mesh.positions[3 * index_b + 1] as f64, - mesh.positions[3 * index_b + 2] as f64 + mesh.positions[3 * index_b + 2] as f64, ), Point3::new( mesh.positions[3 * index_c] as f64, mesh.positions[3 * index_c + 1] as f64, - mesh.positions[3 * index_c + 2] as f64 + mesh.positions[3 * index_c + 2] as f64, ), - material.clone() + material.clone(), ))); } } return world; - } // The output is wrapped in a Result to allow matching on errors // Returns an Iterator to the Reader of the lines of the file. fn read_lines
(filename: P) -> io::Result