first working BVH tree builder