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

Replace clamp with std::clamp

This commit is contained in:
docentYT
2026-05-01 22:14:29 +02:00
parent 1bdd000443
commit d1f16411a1
36 changed files with 271 additions and 287 deletions

View File

@@ -192,8 +192,7 @@ openal_source::sync_with( sound_properties const &State ) {
auto const fadedistance { sound_range * 0.75f };
auto const rangefactor {
interpolate(
1.f, 0.f,
clamp<float>(
1.f, 0.f, std::clamp(
( distancesquared - rangesquared ) / ( fadedistance * fadedistance ),
0.f, 1.f ) ) };
::alSourcef( id, AL_GAIN, gain * rangefactor );
@@ -203,7 +202,7 @@ openal_source::sync_with( sound_properties const &State ) {
// pitch
if( State.pitch != properties.pitch ) {
// pitch value has changed
::alSourcef( id, AL_PITCH, clamp( State.pitch * pitch_variation, 0.1f, 10.f ) );
::alSourcef( id, AL_PITCH, std::clamp( State.pitch * pitch_variation, 0.1f, 10.f ) );
}
// all synced up
properties = State;