From 94ad5b289fe68ecd7ceee3a99ff47da0d9ce0497 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 18 Dec 2014 07:42:14 -0800 Subject: [PATCH] Avoid duplicate calculations --- Alc/ALu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Alc/ALu.c b/Alc/ALu.c index 7d95b101..781a986e 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -813,12 +813,12 @@ ALvoid CalcSourceParams(ALvoice *voice, const ALsource *ALSource, const ALCconte case InverseDistance: if(MinDist > 0.0f) { - if((MinDist + (Rolloff * (ClampedDist - MinDist))) > 0.0f) - Attenuation = MinDist / (MinDist + (Rolloff * (ClampedDist - MinDist))); + ALfloat dist = lerp(MinDist, ClampedDist, Rolloff); + if(dist > 0.0f) Attenuation = MinDist / dist; for(i = 0;i < NumSends;i++) { - if((MinDist + (RoomRolloff[i] * (ClampedDist - MinDist))) > 0.0f) - RoomAttenuation[i] = MinDist / (MinDist + (RoomRolloff[i] * (ClampedDist - MinDist))); + dist = lerp(MinDist, ClampedDist, RoomRolloff[i]); + if(dist > 0.0f) RoomAttenuation[i] = MinDist / dist; } } break; -- 2.11.4.GIT