-VG_STATIC int bh_next( bh_tree *bh, bh_iter *it, boxf box, int *em )
-{
+VG_STATIC void bh_iter_init_ray( i32 root, bh_iter *it, v3f co,
+ v3f dir, f32 max_dist ){
+ it->query = k_bh_query_ray;
+ it->stack[0].id = root;
+ it->stack[0].depth = 0;
+ it->depth = 0;
+ it->i = 0;
+
+ v3_div( (v3f){1.0f,1.0f,1.0f}, dir, it->ray.inv_dir );
+ v3_copy( co, it->ray.co );
+ it->ray.max_dist = max_dist;
+}
+
+VG_STATIC i32 bh_next( bh_tree *bh, bh_iter *it, i32 *em ){