From: hgn Date: Sun, 26 Mar 2023 22:09:20 +0000 (+0100) Subject: dont remember X-Git-Url: https://skaterift.com/git/?a=commitdiff_plain;h=4413afbde4ade6c75ae2acf0404bf147c2e30d70;p=vg.git dont remember --- diff --git a/vg_audio.h b/vg_audio.h index 5b65ccb..279b7f4 100644 --- a/vg_audio.h +++ b/vg_audio.h @@ -836,28 +836,29 @@ static void audio_channel_mix( audio_channel *ch, float *buffer ) framevol_l = 0.0f; framevol_r = 0.0f; } + else{ + v3f delta; + v3_sub( ch->_.spacial_falloff, vg_audio.listener_pos, delta ); - v3f delta; - v3_sub( ch->_.spacial_falloff, vg_audio.listener_pos, delta ); + float dist = v3_length( delta ), + vol = vg_maxf( 0.0f, 1.0f - ch->_.spacial_falloff[3]*dist ); - float dist = v3_length( delta ), - vol = vg_maxf( 0.0f, 1.0f - ch->_.spacial_falloff[3]*dist ); + v3_muls( delta, 1.0f/dist, delta ); + float pan = v3_dot( vg_audio.listener_ears, delta ); + vol = powf( vol, 5.0f ); - v3_muls( delta, 1.0f/dist, delta ); - float pan = v3_dot( vg_audio.listener_ears, delta ); - vol = powf( vol, 5.0f ); + framevol_l *= (vol * 0.5f) * (1.0f - pan); + framevol_r *= (vol * 0.5f) * (1.0f + pan); - framevol_l *= (vol * 0.5f) * (1.0f - pan); - framevol_r *= (vol * 0.5f) * (1.0f + pan); + v3_muls( delta, 1.0f/dist, delta ); - v3_muls( delta, 1.0f/dist, delta ); - - const float vs = 100.0f; - float doppler = (vs+v3_dot(delta,vg_audio.listener_velocity))/vs; - doppler = vg_clampf( doppler, 0.6f, 1.4f ); - - if( fabsf(doppler-1.0f) > 0.01f ) - frame_samplerate *= doppler; + const float vs = 100.0f; + float doppler = (vs+v3_dot(delta,vg_audio.listener_velocity))/vs; + doppler = vg_clampf( doppler, 0.6f, 1.4f ); + + if( fabsf(doppler-1.0f) > 0.01f ) + frame_samplerate *= doppler; + } } u32 buffer_length = AUDIO_MIX_FRAME_SIZE; diff --git a/vg_m.h b/vg_m.h index ee8b107..4429aa7 100644 --- a/vg_m.h +++ b/vg_m.h @@ -2084,4 +2084,13 @@ static void eval_bezier_time( v3f p0, v3f p1, v3f h0, v3f h1, float t, v3f p ) v3_muladds( p, p0, 3.0f*tt -ttt -3.0f*t +1.0f, p ); } +static void eval_bezier3( v3f p0, v3f p1, v3f p2, float t, v3f p ) +{ + float u = 1.0f-t; + + v3_muls( p0, u*u, p ); + v3_muladds( p, p1, 2.0f*u*t, p ); + v3_muladds( p, p2, t*t, p ); +} + #endif /* VG_M_H */