diff options
Diffstat (limited to 'src/game/world/bsp.h')
| -rw-r--r-- | src/game/world/bsp.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/game/world/bsp.h b/src/game/world/bsp.h index 457bcb9..50e8764 100644 --- a/src/game/world/bsp.h +++ b/src/game/world/bsp.h @@ -38,10 +38,20 @@ struct BSP_NODE { I32 back; }; +struct BSP_EDGE { + BSP_PLANE plane; + U32 face; + U8 avgc; + + VEC3 v1, v2; +}; + struct BSP_LEAF { U32 first; U32 count; I32 cluster; + + LIST<BSP_EDGE> edges; }; struct BSP_WINDING { @@ -106,3 +116,10 @@ inline SURF_PROPS* bsp_face_get_props( WORLD_MAP* w, BSP_FACE* s ) { map_props_get_special( w, s->propid ) : &w->props[s->propid]; } + +inline VEC3 bsp_face_get_normal( const BSP_FACE* f ){ + const VEC3 v0 = f->verts.data[0].pos; + const VEC3 v1 = f->verts.data[1].pos; + const VEC3 v2 = f->verts.data[2].pos; + return vec_normalize( vec_cross( v1 - v0, v2 - v0 ) ); +} |
