doin' some cleanup...

This commit is contained in:
asrael 2026-04-14 13:16:47 -05:00
parent 40f5cdcaa5
commit f6d6efea95
16 changed files with 136 additions and 182 deletions

View file

@ -138,6 +138,25 @@ typedef struct demo3d_bsp {
f32 bounds_max_z;
} demo3d_bsp;
static inline bool demo3d_bsp_get_edge_vertex(const demo3d_bsp* bsp, i32 surfedge_idx, u32* out_vert_idx) {
if (surfedge_idx >= (i32)bsp->num_surfedges) return false;
i32 edge_idx = bsp->surfedges[surfedge_idx];
u32 vertex_index;
if (edge_idx >= 0) {
if ((u32)edge_idx >= bsp->num_edges) return false;
vertex_index = 0;
} else {
edge_idx = -edge_idx;
if ((u32)edge_idx >= bsp->num_edges) return false;
vertex_index = 1;
}
*out_vert_idx = bsp->edges[edge_idx].vertex[vertex_index];
return *out_vert_idx < bsp->num_vertices;
}
#ifdef __cplusplus
extern "C" {
#endif