From 0e65a75e2ba0e896509825dd1a3ed1520369b16a Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 27 Mar 2020 12:12:54 +0100 Subject: [PATCH] library: render: mesh: fix panic when parsing OBJ --- pathtracer/src/render/mesh.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pathtracer/src/render/mesh.rs b/pathtracer/src/render/mesh.rs index e1ca64c..e63163b 100644 --- a/pathtracer/src/render/mesh.rs +++ b/pathtracer/src/render/mesh.rs @@ -59,9 +59,9 @@ impl TryFrom for Mesh { mesh.indices[i * 3 + 2] as usize, ); - let pos_a = transform * Point::from_slice(&mesh.positions[(a * 3)..(a * 3 + 2)]); - let pos_b = transform * Point::from_slice(&mesh.positions[(b * 3)..(b * 3 + 2)]); - let pos_c = transform * Point::from_slice(&mesh.positions[(c * 3)..(c * 3 + 2)]); + let pos_a = transform * Point::from_slice(&mesh.positions[(a * 3)..(a * 3 + 3)]); + let pos_b = transform * Point::from_slice(&mesh.positions[(b * 3)..(b * 3 + 3)]); + let pos_c = transform * Point::from_slice(&mesh.positions[(c * 3)..(c * 3 + 3)]); let triangle: ShapeEnum = if mesh.normals.is_empty() { Triangle::new(pos_a, pos_b, pos_c).into()