fixed texture rendering in pxl8_bsp.c
This commit is contained in:
parent
2e2461c35a
commit
7dd32ec453
3 changed files with 4 additions and 14 deletions
|
|
@ -387,7 +387,7 @@ void pxl8_bsp_render_face(pxl8_gfx* gfx, const pxl8_bsp* bsp, u32 face_id, u32 t
|
|||
u32 num_verts = 0;
|
||||
|
||||
u32 color = 15;
|
||||
bool use_texture = (texture_id > 0);
|
||||
bool use_texture = (face->texinfo_id < bsp->num_texinfo);
|
||||
|
||||
|
||||
for (u32 i = 0; i < face->num_edges && num_verts < 64; i++) {
|
||||
|
|
|
|||
|
|
@ -440,7 +440,7 @@ void pxl8_procgen_tex(u8* buffer, const pxl8_procgen_tex_params* params) {
|
|||
|
||||
// Checkerboard dither
|
||||
if (((tile_x + tile_y) & 1) == 0 && (h & 0x100)) {
|
||||
color = (color < 15) ? color + 1 : color;
|
||||
color = (color < 255) ? color + 1 : color;
|
||||
}
|
||||
}
|
||||
// Large tile pattern (ceiling style)
|
||||
|
|
@ -489,17 +489,7 @@ void pxl8_procgen_tex(u8* buffer, const pxl8_procgen_tex_params* params) {
|
|||
}
|
||||
}
|
||||
|
||||
if (color > 31) color = 31;
|
||||
buffer[y * params->width + x] = color;
|
||||
}
|
||||
}
|
||||
|
||||
u8 min_color = 255, max_color = 0;
|
||||
u32 color_counts[256] = {0};
|
||||
for (i32 i = 0; i < params->width * params->height; i++) {
|
||||
if (buffer[i] < min_color) min_color = buffer[i];
|
||||
if (buffer[i] > max_color) max_color = buffer[i];
|
||||
color_counts[buffer[i]]++;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue