rtiow: add commented out failing test.
This commit is contained in:
parent
4e62975d56
commit
a0b79ee2fa
44
rtiow/Cargo.lock
generated
44
rtiow/Cargo.lock
generated
@ -812,6 +812,16 @@ dependencies = [
|
|||||||
"subtle",
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ctor"
|
||||||
|
version = "0.1.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
|
||||||
|
dependencies = [
|
||||||
|
"quote 1.0.23",
|
||||||
|
"syn 1.0.107",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ctr"
|
name = "ctr"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
@ -885,6 +895,12 @@ dependencies = [
|
|||||||
"byteorder",
|
"byteorder",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "diff"
|
||||||
|
version = "0.1.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "digest"
|
name = "digest"
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
@ -1910,6 +1926,15 @@ version = "6.4.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
|
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "output_vt100"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66"
|
||||||
|
dependencies = [
|
||||||
|
"winapi 0.3.9",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "owning_ref"
|
name = "owning_ref"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
@ -2076,6 +2101,18 @@ version = "0.2.17"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pretty_assertions"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a25e9bcb20aa780fd0bb16b72403a9064d6b3f22f026946029acb941a50af755"
|
||||||
|
dependencies = [
|
||||||
|
"ctor",
|
||||||
|
"diff",
|
||||||
|
"output_vt100",
|
||||||
|
"yansi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-error"
|
name = "proc-macro-error"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
@ -2434,6 +2471,7 @@ dependencies = [
|
|||||||
"lazy_static 1.4.0",
|
"lazy_static 1.4.0",
|
||||||
"log 0.4.17",
|
"log 0.4.17",
|
||||||
"num_cpus",
|
"num_cpus",
|
||||||
|
"pretty_assertions",
|
||||||
"rand 0.8.5",
|
"rand 0.8.5",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
@ -3695,3 +3733,9 @@ dependencies = [
|
|||||||
"winapi 0.2.8",
|
"winapi 0.2.8",
|
||||||
"winapi-build",
|
"winapi-build",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "yansi"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
|
||||||
|
|||||||
@ -33,6 +33,7 @@ strum_macros = "0.24.3"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.4"
|
criterion = "0.4"
|
||||||
|
pretty_assertions = "1.3.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
profile = ["cpuprofiler"]
|
profile = ["cpuprofiler"]
|
||||||
|
|||||||
@ -360,7 +360,7 @@ mod tests {
|
|||||||
ray::Ray,
|
ray::Ray,
|
||||||
texture::ConstantTexture,
|
texture::ConstantTexture,
|
||||||
};
|
};
|
||||||
//use pretty_assertions::assert_eq;
|
use pretty_assertions::assert_eq;
|
||||||
use std::{
|
use std::{
|
||||||
io::{BufReader, Cursor},
|
io::{BufReader, Cursor},
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
@ -448,18 +448,50 @@ mod tests {
|
|||||||
let x = x as f32;
|
let x = x as f32;
|
||||||
let y = y as f32;
|
let y = y as f32;
|
||||||
vec![
|
vec![
|
||||||
|
// Outward in angle
|
||||||
Ray::new([-1., x, y], [1., 0., 0.], 0.),
|
Ray::new([-1., x, y], [1., 0., 0.], 0.),
|
||||||
Ray::new([21., 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, -1., y], [0., 1., 0.], 0.),
|
||||||
Ray::new([x, 21., 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, -1.], [0., 0., 1.], 0.),
|
||||||
Ray::new([x, y, 21.], [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()
|
.into_iter()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.collect();
|
.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() {
|
for r in rays.into_iter() {
|
||||||
let c_hit = c
|
let c_hit = c
|
||||||
@ -468,15 +500,15 @@ mod tests {
|
|||||||
let s_hit = s
|
let s_hit = s
|
||||||
.hit(r, 0., f32::MAX)
|
.hit(r, 0., f32::MAX)
|
||||||
.expect(&format!("s_hit missed {r:#?}"));
|
.expect(&format!("s_hit missed {r:#?}"));
|
||||||
assert_eq!(
|
assert!(
|
||||||
c_hit.t, s_hit.t,
|
(c_hit.t - s_hit.t).abs() < EPSILON,
|
||||||
"{r:?} [t] c_hit: {c_hit:#?}, s_hit: {s_hit:#?}"
|
"{r:?} [t] c_hit: {c_hit:#?}, s_hit: {s_hit:#?}"
|
||||||
);
|
);
|
||||||
// uv isn't valid for BVHTriangles.
|
// 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.uv, s_hit.uv, "{i}: [uv] c_hit: {c_hit:?}, s_hit: {s_hit:?}");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
c_hit.p, s_hit.p,
|
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!(
|
assert_eq!(
|
||||||
c_hit.normal, s_hit.normal,
|
c_hit.normal, s_hit.normal,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user