projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
whoopsie
[carveJwlIkooP6JGAAIwe30JlM.git]
/
world.h
diff --git
a/world.h
b/world.h
index ff2c2e3610b4bb79b809bbd1be2e289d641b8d92..9883b295d6916bb06b3466f057301b29cf2fe08e 100644
(file)
--- a/
world.h
+++ b/
world.h
@@
-731,16
+731,14
@@
VG_STATIC int spherecast_world( world_instance *world,
float min_t = 1.0f;
int idx;
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 );
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] );
}
v3_copy( world->scene_geo->arrvertices[ptri[j]].co, tri[j] );
box_addpt( box, tri[j] );
}
@@
-753,10
+751,8
@@
VG_STATIC int spherecast_world( world_instance *world,
float t;
v3f n1;
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 );
min_t = t;
hit = idx;
v3_copy( n1, n );
@@
-772,18
+768,16
@@
VG_STATIC
struct world_surface *world_tri_index_surface( world_instance *world,
u32 index )
{
struct world_surface *world_tri_index_surface( world_instance *world,
u32 index )
{
- for( int i=1; i<world->surface_count; i++ )
- {
- struct world_surface *mat = &world->surfaces[i];
+ for( int i=1; i<world->surface_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];
}
return &world->surfaces[0];
}