diff options
| author | aura <nw@moneybot.cc> | 2026-03-04 18:58:21 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-03-04 18:58:21 +0100 |
| commit | 73045b6642348c8d2fd8b45cae305bbf0344d444 (patch) | |
| tree | 9898f64cc14f4e95b147e0fab4b9004e41109780 /src/game/world/bsp.h | |
| parent | fc12cd41c56bc123f01bc073b703fb151dfde814 (diff) | |
more collision improv
Diffstat (limited to 'src/game/world/bsp.h')
| -rw-r--r-- | src/game/world/bsp.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/game/world/bsp.h b/src/game/world/bsp.h index 8892108..3b84e07 100644 --- a/src/game/world/bsp.h +++ b/src/game/world/bsp.h @@ -125,6 +125,16 @@ inline VEC3 bsp_face_get_normal( BSP_FACE* f ){ return vec_normalize( vec_cross( v1 - v0, v2 - v0 ) ); } +inline U8 bsp_face_is_axis_aligned( BSP_FACE* f ) { + VEC3 n = bsp_face_get_normal( f ); + for( U32 i = 0; i < 3; ++i ) { + if( n[i] && fabsf( n[i] ) != 1.f ) + return 0; + } + + return 1; +} + inline void bsp_face_calc_extents( BSP_FACE* f ) { VEC3 mins{ +INFINITY, +INFINITY, +INFINITY }, maxs{ -INFINITY, -INFINITY, -INFINITY }; for( U32 i = 0; i < f->verts.size; ++i ) { |
