X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;ds=sidebyside;f=world.h;h=80bf3b6bafad33620b4738fb314440cfd581a6d3;hb=0a33f65eecb5e75cddaefa08d3a5eb1a301d0479;hp=ff2c2e3610b4bb79b809bbd1be2e289d641b8d92;hpb=4fa1c611e0af4c32cdcc891f8c511217a2762d65;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world.h b/world.h index ff2c2e3..80bf3b6 100644 --- a/world.h +++ b/world.h @@ -154,7 +154,8 @@ struct world_instance ent_route_node, ent_path_index, ent_checkpoint, - ent_route; + ent_route, + ent_water; ent_gate *rendering_gate; @@ -731,16 +732,14 @@ VG_STATIC int spherecast_world( world_instance *world, float min_t = 1.0f; int idx; - while( bh_next( world->geo_bh, &it, region, &idx ) ) - { + while( bh_next( world->geo_bh, &it, region, &idx ) ){ u32 *ptri = &world->scene_geo->arrindices[ idx*3 ]; v3f tri[3]; boxf box; box_init_inf( box ); - for( int j=0; j<3; j++ ) - { + for( int j=0; j<3; j++ ){ v3_copy( world->scene_geo->arrvertices[ptri[j]].co, tri[j] ); box_addpt( box, tri[j] ); } @@ -753,10 +752,8 @@ VG_STATIC int spherecast_world( world_instance *world, float t; v3f n1; - if( spherecast_triangle( tri, pa, dir, r, &t, n1 ) ) - { - if( t < min_t ) - { + if( spherecast_triangle( tri, pa, dir, r, &t, n1 ) ){ + if( t < min_t ){ min_t = t; hit = idx; v3_copy( n1, n ); @@ -772,18 +769,16 @@ VG_STATIC struct world_surface *world_tri_index_surface( world_instance *world, u32 index ) { - for( int i=1; isurface_count; i++ ) - { - struct world_surface *mat = &world->surfaces[i]; + for( int i=1; isurface_count; i++ ){ + struct world_surface *surf = &world->surfaces[i]; - if( (index >= mat->sm_geo.vertex_start) && - (index < mat->sm_geo.vertex_start+mat->sm_geo.vertex_count ) ) + if( (index >= surf->sm_geo.vertex_start) && + (index < surf->sm_geo.vertex_start+surf->sm_geo.vertex_count ) ) { - return mat; + return surf; } } - /* error surface */ return &world->surfaces[0]; }