From 73045b6642348c8d2fd8b45cae305bbf0344d444 Mon Sep 17 00:00:00 2001 From: aura Date: Wed, 4 Mar 2026 18:58:21 +0100 Subject: more collision improv --- src/game/world/bsp.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/game/world/bsp.h') 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 ) { -- cgit v1.2.3