aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-12-18 07:42:14 -0800
committerChris Robinson <[email protected]>2014-12-18 07:42:14 -0800
commit94ad5b289fe68ecd7ceee3a99ff47da0d9ce0497 (patch)
tree593e0070d807b7e71fe07cb022591669e92c324a
parent6086c344dcc0b8ec067a89193f900540dacec263 (diff)
Avoid duplicate calculations
-rw-r--r--Alc/ALu.c8
1 files 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;