X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world.h;h=98d7efbe611fdab0930a5e880f5bbf2a40b4accd;hb=63b5ac44f74599b21c4b9b18398c29b797337bea;hp=66b3b28f2c0b14a961cf7ea04ef4b27321332cc7;hpb=38e07d851915d4ea3d25eeb28a3ace78fb0d1c12;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world.h b/world.h index 66b3b28..98d7efb 100644 --- a/world.h +++ b/world.h @@ -681,12 +681,12 @@ VG_STATIC void world_update( world_instance *world, v3f pos ) v3_sub( pos, (v3f){ radius, radius, radius }, volume_proximity[0] ); bh_iter it; - bh_iter_init( 0, &it ); - int idx; + bh_iter_init_box( 0, &it, volume_proximity ); + i32 idx; int in_volume = 0; - while( bh_next( world->volume_bh, &it, volume_proximity, &idx ) ){ + while( bh_next( world->volume_bh, &it, &idx ) ){ ent_volume *volume = mdl_arritm( &world->ent_volume, idx ); boxf cube = {{-1.0f,-1.0f,-1.0f},{1.0f,1.0f,1.0f}}; @@ -776,9 +776,6 @@ VG_STATIC int ray_world( world_instance *world, VG_STATIC int spherecast_world( world_instance *world, v3f pa, v3f pb, float r, float *t, v3f n ) { - bh_iter it; - bh_iter_init( 0, &it ); - boxf region; box_init_inf( region ); box_addpt( region, pa ); @@ -798,8 +795,10 @@ VG_STATIC int spherecast_world( world_instance *world, int hit = -1; float min_t = 1.0f; - int idx; - while( bh_next( world->geo_bh, &it, region, &idx ) ){ + bh_iter it; + bh_iter_init_box( 0, &it, region ); + i32 idx; + while( bh_next( world->geo_bh, &it, &idx ) ){ u32 *ptri = &world->scene_geo.arrindices[ idx*3 ]; v3f tri[3];