16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 03:09:18 +02:00

Replace interpolate with std::lerp and glm::mix

This commit is contained in:
docentYT
2026-05-02 01:31:38 +02:00
parent 362338ee5e
commit 3628eb0fc3
21 changed files with 108 additions and 116 deletions

View File

@@ -191,7 +191,7 @@ openal_source::sync_with( sound_properties const &State ) {
// adjust the volume to a suitable fraction of nominal value
auto const fadedistance { sound_range * 0.75f };
auto const rangefactor {
interpolate(
std::lerp(
1.f, 0.f, std::clamp(
( distancesquared - rangesquared ) / ( fadedistance * fadedistance ),
0.f, 1.f ) ) };

View File

@@ -781,7 +781,7 @@ sound_source::update_crossfade( sound_handle const Chunk ) {
// based on how far the current soundpoint is in the range of previous chunk
auto const &previouschunkdata{ m_soundchunks[ chunkindex - 1 ].second };
m_properties.pitch =
interpolate(
std::lerp(
previouschunkdata.pitch / chunkdata.pitch,
1.f,
std::clamp(
@@ -796,7 +796,7 @@ sound_source::update_crossfade( sound_handle const Chunk ) {
// based on how far the current soundpoint is in the range of this chunk
auto const &nextchunkdata { m_soundchunks[ chunkindex + 1 ].second };
m_properties.pitch =
interpolate(
std::lerp(
1.f,
nextchunkdata.pitch / chunkdata.pitch,
std::clamp(
@@ -816,7 +816,7 @@ sound_source::update_crossfade( sound_handle const Chunk ) {
auto const fadeinwidth { chunkdata.threshold - chunkdata.fadein };
if( soundpoint < chunkdata.threshold ) {
float lineargain =
interpolate(
std::lerp(
0.f, 1.f,
std::clamp(
( soundpoint - chunkdata.fadein ) / fadeinwidth,
@@ -836,7 +836,7 @@ sound_source::update_crossfade( sound_handle const Chunk ) {
auto const fadeoutstart { chunkdata.fadeout - fadeoutwidth };
if( soundpoint > fadeoutstart ) {
float lineargain =
interpolate(
std::lerp(
0.f, 1.f,
std::clamp(
( soundpoint - fadeoutstart ) / fadeoutwidth,