diff options
| author | aura <nw@moneybot.cc> | 2026-03-01 23:07:31 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-03-01 23:07:31 +0100 |
| commit | b3a92fa1ffc565c2fc72b1a531cae09cbbc219bd (patch) | |
| tree | fe3d9d411a8de92c48f39e10456e485ec91cda93 /src/game/world/bsp.h | |
| parent | 71dd7fcccb45a54d85ae23a95a8a8905ed21fe15 (diff) | |
wip on adding edge normals
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 ) ); +} |
