X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_physics.c;h=ebe8f89110b8b4d2a0793d48809ca502c6e91d45;hb=137d40d96fe923600d8378b8e138e3c276f27ff4;hp=96ffa2f47d56104f337a67ac6fab33044ca8e2a6;hpb=342fcbf6fda017bdd38d56ce0fa7c9e59e589f3b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_physics.c b/world_physics.c index 96ffa2f..ebe8f89 100644 --- a/world_physics.c +++ b/world_physics.c @@ -4,24 +4,26 @@ #include "world.h" #include "world_physics.h" -VG_STATIC void ray_world_get_tri( world_instance *world, +static void ray_world_get_tri( world_instance *world, ray_hit *hit, v3f tri[3] ) { for( int i=0; i<3; i++ ) v3_copy( world->scene_geo.arrvertices[ hit->tri[i] ].co, tri[i] ); } -VG_STATIC int ray_world( world_instance *world, - v3f pos, v3f dir, ray_hit *hit ) +static int ray_world( world_instance *world, + v3f pos, v3f dir, ray_hit *hit, u16 ignore ) { - return scene_raycast( &world->scene_geo, world->geo_bh, pos, dir, hit ); + return scene_raycast( &world->scene_geo, world->geo_bh, pos, dir, hit, + ignore ); } /* * Cast a sphere from a to b and see what time it hits */ -VG_STATIC int spherecast_world( world_instance *world, - v3f pa, v3f pb, float r, float *t, v3f n ) +static int spherecast_world( world_instance *world, + v3f pa, v3f pb, float r, float *t, v3f n, + u16 ignore ) { boxf region; box_init_inf( region ); @@ -47,11 +49,11 @@ VG_STATIC int spherecast_world( world_instance *world, i32 idx; while( bh_next( world->geo_bh, &it, &idx ) ){ u32 *ptri = &world->scene_geo.arrindices[ idx*3 ]; - v3f tri[3]; + if( world->scene_geo.arrvertices[ptri[0]].flags & ignore ) continue; + v3f tri[3]; boxf box; box_init_inf( box ); - for( int j=0; j<3; j++ ){ v3_copy( world->scene_geo.arrvertices[ptri[j]].co, tri[j] ); box_addpt( box, tri[j] ); @@ -78,7 +80,7 @@ VG_STATIC int spherecast_world( world_instance *world, return hit; } -VG_STATIC +static struct world_surface *world_tri_index_surface( world_instance *world, u32 index ) { @@ -95,13 +97,13 @@ struct world_surface *world_tri_index_surface( world_instance *world, return &world->surfaces[0]; } -VG_STATIC struct world_surface *world_contact_surface( world_instance *world, +static struct world_surface *world_contact_surface( world_instance *world, rb_ct *ct ) { return world_tri_index_surface( world, ct->element_id ); } -VG_STATIC struct world_surface *ray_hit_surface( world_instance *world, +static struct world_surface *ray_hit_surface( world_instance *world, ray_hit *hit ) { return world_tri_index_surface( world, hit->tri[0] );