Building a BVH (compiles and runs, correctness not yet tested).