clean up worldgen and remove verbose logging
This commit is contained in:
parent
4d84122ef3
commit
34e534b6f2
11 changed files with 359 additions and 174 deletions
|
|
@ -386,17 +386,8 @@ void pxl8_bsp_render_face(pxl8_gfx* gfx, const pxl8_bsp* bsp, u32 face_id, u32 t
|
|||
pxl8_vec3 verts[64];
|
||||
u32 num_verts = 0;
|
||||
|
||||
const pxl8_bsp_plane* plane = &bsp->planes[face->plane_id];
|
||||
|
||||
u32 color;
|
||||
bool use_texture = false;
|
||||
|
||||
if (fabsf(plane->normal.y) > 0.7f) {
|
||||
color = (plane->normal.y > 0) ? 4 : 3;
|
||||
} else {
|
||||
color = 15;
|
||||
use_texture = (texture_id > 0);
|
||||
}
|
||||
u32 color = 15;
|
||||
bool use_texture = (texture_id > 0);
|
||||
|
||||
|
||||
for (u32 i = 0; i < face->num_edges && num_verts < 64; i++) {
|
||||
|
|
@ -446,11 +437,10 @@ void pxl8_bsp_render_face(pxl8_gfx* gfx, const pxl8_bsp* bsp, u32 face_id, u32 t
|
|||
}
|
||||
}
|
||||
|
||||
void pxl8_bsp_render_solid(
|
||||
void pxl8_bsp_render_textured(
|
||||
pxl8_gfx* gfx,
|
||||
const pxl8_bsp* bsp,
|
||||
pxl8_vec3 camera_pos,
|
||||
u32 texture_id
|
||||
pxl8_vec3 camera_pos
|
||||
) {
|
||||
if (!gfx || !bsp || bsp->num_faces == 0) return;
|
||||
|
||||
|
|
@ -488,10 +478,22 @@ void pxl8_bsp_render_solid(
|
|||
|
||||
if (!face_in_frustum(bsp, face_id, frustum)) continue;
|
||||
|
||||
const pxl8_bsp_face* face = &bsp->faces[face_id];
|
||||
u32 texture_id = 0;
|
||||
if (face->texinfo_id < bsp->num_texinfo) {
|
||||
texture_id = bsp->texinfo[face->texinfo_id].miptex;
|
||||
} else {
|
||||
static bool warned = false;
|
||||
if (!warned) {
|
||||
pxl8_warn("Face %u has invalid texinfo_id %u (num_texinfo=%u)",
|
||||
face_id, face->texinfo_id, bsp->num_texinfo);
|
||||
warned = true;
|
||||
}
|
||||
}
|
||||
|
||||
pxl8_bsp_render_face(gfx, bsp, face_id, texture_id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void pxl8_bsp_render_wireframe(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue