wip sw renderer...bsp is borked, also lots of other things

This commit is contained in:
asrael 2026-01-21 23:19:50 -06:00
parent 415d424057
commit c771fa665d
56 changed files with 8151 additions and 1261 deletions

View file

@ -9,6 +9,11 @@
#define VOICE_SCALE 0.15f
static inline f32 sanitize_audio(f32 x) {
union { f32 f; u32 u; } conv = { .f = x };
return ((conv.u & 0x7F800000) == 0x7F800000) ? 0.0f : x;
}
typedef enum envelope_state {
ENV_ATTACK = 0,
ENV_DECAY,
@ -716,8 +721,8 @@ void pxl8_sfx_mixer_process(pxl8_sfx_mixer* mixer) {
left = fmaxf(-1.0f, fminf(1.0f, left));
right = fmaxf(-1.0f, fminf(1.0f, right));
if (!isfinite(left)) left = 0.0f;
if (!isfinite(right)) right = 0.0f;
left = sanitize_audio(left);
right = sanitize_audio(right);
mixer->output_buffer[i * 2] = left;
mixer->output_buffer[i * 2 + 1] = right;