diff options
author | Chris Robinson <[email protected]> | 2014-12-18 07:42:14 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-12-18 07:42:14 -0800 |
commit | 94ad5b289fe68ecd7ceee3a99ff47da0d9ce0497 (patch) | |
tree | 593e0070d807b7e71fe07cb022591669e92c324a /Alc | |
parent | 6086c344dcc0b8ec067a89193f900540dacec263 (diff) |
Avoid duplicate calculations
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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; |