Add Acceleration Structure Interface

This commit is contained in:
hal8174 2025-01-03 23:36:18 +01:00
parent 0b3daf9441
commit 24bf8753b2
8 changed files with 519 additions and 2 deletions

View file

@ -226,12 +226,12 @@ impl<R: Rng> TriangleBVH<R> {
count: triangles.len() as Index,
}];
let aabb = calculate_aabb(&vertices, &triangles);
build_bvh(&vertices, &mut triangles, &mut bvh, 0, aabb);
let lights: Vec<_> = triangles
.iter()
.filter(|f| materials[f.material as usize].light.is_some())
.map(Triangle::clone)
.collect();
build_bvh(&vertices, &mut triangles, &mut bvh, 0, aabb);
Self {
vertices,
bvh,