and yet more cleanup...
This commit is contained in:
parent
26e855369d
commit
cf43538518
16 changed files with 80 additions and 107 deletions
|
|
@ -157,6 +157,15 @@ static inline bool demo3d_bsp_get_edge_vertex(const demo3d_bsp* bsp, i32 surfedg
|
|||
return *out_vert_idx < bsp->num_vertices;
|
||||
}
|
||||
|
||||
static inline u8 demo3d_bsp_vertex_light(const demo3d_bsp* bsp, u32 vert_idx, u8 ambient) {
|
||||
if (!bsp->vertex_lights || vert_idx >= bsp->num_vertex_lights) return 255;
|
||||
u32 packed = bsp->vertex_lights[vert_idx];
|
||||
u8 direct = (packed >> 24) & 0xFF;
|
||||
u8 ao = (packed >> 16) & 0xFF;
|
||||
f32 combined = (f32)direct + ((f32)ambient / 255.0f) * (f32)ao;
|
||||
return (u8)(combined > 255.0f ? 255.0f : combined);
|
||||
}
|
||||
|
||||
static inline i32 demo3d_bsp_find_leaf(const demo3d_bsp* bsp, pxl8_vec3 pos) {
|
||||
if (!bsp || bsp->num_nodes == 0) return -1;
|
||||
i32 node_id = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue