rtiow: add commented out failing test.
This commit is contained in:
@@ -33,6 +33,7 @@ strum_macros = "0.24.3"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.4"
|
||||
pretty_assertions = "1.3.0"
|
||||
|
||||
[features]
|
||||
profile = ["cpuprofiler"]
|
||||
|
||||
@@ -360,7 +360,7 @@ mod tests {
|
||||
ray::Ray,
|
||||
texture::ConstantTexture,
|
||||
};
|
||||
//use pretty_assertions::assert_eq;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::{
|
||||
io::{BufReader, Cursor},
|
||||
sync::Arc,
|
||||
@@ -448,18 +448,50 @@ mod tests {
|
||||
let x = x as f32;
|
||||
let y = y as f32;
|
||||
vec![
|
||||
// Outward in angle
|
||||
Ray::new([-1., x, y], [1., 0., 0.], 0.),
|
||||
Ray::new([21., x, y], [-1., 0., 0.], 0.),
|
||||
Ray::new([x, -1., y], [0., 1., 0.], 0.),
|
||||
Ray::new([x, 21., y], [0., -1., 0.], 0.),
|
||||
Ray::new([x, y, -1.], [0., 0., 1.], 0.),
|
||||
Ray::new([x, y, 21.], [0., 0., -1.], 0.),
|
||||
// Inward out (
|
||||
Ray::new([x, y, 10.], [1., 0., 0.], 0.),
|
||||
Ray::new([x, y, 10.], [-1., 0., 0.], 0.),
|
||||
Ray::new([x, 10., y], [1., 0., 0.], 0.),
|
||||
Ray::new([x, 10., y], [-1., 0., 0.], 0.),
|
||||
Ray::new([10., x, y], [1., 0., 0.], 0.),
|
||||
Ray::new([10., x, y], [-1., 0., 0.], 0.),
|
||||
Ray::new([x, y, 10.], [0., 1., 0.], 0.),
|
||||
Ray::new([x, y, 10.], [0., -1., 0.], 0.),
|
||||
Ray::new([x, 10., y], [0., 1., 0.], 0.),
|
||||
Ray::new([x, 10., y], [0., -1., 0.], 0.),
|
||||
Ray::new([10., x, y], [0., 1., 0.], 0.),
|
||||
Ray::new([10., x, y], [0., -1., 0.], 0.),
|
||||
Ray::new([x, y, 10.], [0., 0., 1.], 0.),
|
||||
Ray::new([x, y, 10.], [0., 0., -1.], 0.),
|
||||
Ray::new([x, 10., y], [0., 0., 1.], 0.),
|
||||
Ray::new([x, 10., y], [0., 0., -1.], 0.),
|
||||
Ray::new([10., x, y], [0., 0., 1.], 0.),
|
||||
Ray::new([10., x, y], [0., 0., -1.], 0.),
|
||||
]
|
||||
.into_iter()
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
rays.push(Ray::new([10., 10., 10.], [1., 0., 0.], 0.));
|
||||
// These currently differ between STL and cuboid.
|
||||
if false {
|
||||
// Outward in at an angle.
|
||||
let sqrt2 = 2f32.sqrt();
|
||||
rays.extend(vec![
|
||||
Ray::new([-1., 10., 10.], [sqrt2, sqrt2, 0.], 0.),
|
||||
Ray::new([-1., 10., 10.], [sqrt2, -sqrt2, 0.], 0.),
|
||||
Ray::new([-1., 10., 10.], [sqrt2, 0., sqrt2], 0.),
|
||||
Ray::new([-1., 10., 10.], [sqrt2, 0., -sqrt2], 0.),
|
||||
]);
|
||||
}
|
||||
|
||||
// TODO(wathiede): proptest this, it's still not perfectly equal when rendering.
|
||||
|
||||
for r in rays.into_iter() {
|
||||
let c_hit = c
|
||||
@@ -468,15 +500,15 @@ mod tests {
|
||||
let s_hit = s
|
||||
.hit(r, 0., f32::MAX)
|
||||
.expect(&format!("s_hit missed {r:#?}"));
|
||||
assert_eq!(
|
||||
c_hit.t, s_hit.t,
|
||||
assert!(
|
||||
(c_hit.t - s_hit.t).abs() < EPSILON,
|
||||
"{r:?} [t] c_hit: {c_hit:#?}, s_hit: {s_hit:#?}"
|
||||
);
|
||||
// uv isn't valid for BVHTriangles.
|
||||
// assert_eq!( c_hit.uv, s_hit.uv, "{i}: [uv] c_hit: {c_hit:?}, s_hit: {s_hit:?}");
|
||||
assert_eq!(
|
||||
c_hit.p, s_hit.p,
|
||||
"{r:?}: [p] c_hit: {c_hit:?}, s_hit: {s_hit:?}"
|
||||
"{r:?}: [p] c_hit: {c_hit:#?}, s_hit: {s_hit:#?}"
|
||||
);
|
||||
assert_eq!(
|
||||
c_hit.normal, s_hit.normal,
|
||||
|
||||
Reference in New Issue
Block a user