Skip to content

Commit

Permalink
Chap 15: triangles
Browse files Browse the repository at this point in the history
(smooth triangles)
  • Loading branch information
fremag committed Feb 19, 2024
1 parent b1d7c0e commit 9e985db
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ray-tracer-lib/src/tests/obj_reader_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,16 @@ f 1/0/3 2/102/1 3/14/2

let mut obj_reader = ObjReader::new(str.as_bytes());
obj_reader.read();
let t1 = &obj_reader.smooth_triangles[0];
let smooth_model = &obj_reader.smooth_models["Default"];

let t1 = &smooth_model.smooth_triangles[0];
assert_eq!(t1.triangle.p1, point(0.0, 1.0, 0.0));
assert_eq!(t1.triangle.p2, point(-1.0, 0.0, 0.0));
assert_eq!(t1.triangle.p3, point(1.0, 0.0, 0.0));
assert_eq!(t1.n1, vector(0.0, 1.0, 0.0));
assert_eq!(t1.n2, vector(-1.0, 0.0, 0.0));
assert_eq!(t1.n3, vector(1.0, 0.0, 0.0));
let t2 = &obj_reader.smooth_triangles[1];
let t2 = &smooth_model.smooth_triangles[1];
assert_eq!(t2.triangle.p1, point(0.0, 1.0, 0.0));
assert_eq!(t2.triangle.p2, point(-1.0, 0.0, 0.0));
assert_eq!(t2.triangle.p3, point(1.0, 0.0, 0.0));
Expand Down

0 comments on commit 9e985db

Please sign in to comment.