Changed: Avoid some more sqrt calculations

This commit is contained in:
kaetemi 2012-06-03 02:00:32 +02:00
parent 971f753706
commit a3616abd5c

View file

@ -82,9 +82,9 @@ float ISource::computeManualRolloff(double alpha, float sqrdist, float distMin,
} }
else else
{ {
double dist = (double)sqrt(sqrdist);
if (alpha < 0.0f) if (alpha < 0.0f)
{ {
double dist = (double)sqrt(sqrdist);
// inverse distance rolloff // inverse distance rolloff
float rolloff = distMin / dist; float rolloff = distMin / dist;
if (alpha <= -1.0f) return rolloff; if (alpha <= -1.0f) return rolloff;
@ -100,6 +100,7 @@ float ISource::computeManualRolloff(double alpha, float sqrdist, float distMin,
// full attenuation // full attenuation
return 0.0f; return 0.0f;
} }
double dist = (double)sqrt(sqrdist);
if (alpha == 0.0f) if (alpha == 0.0f)
{ {
// linearly descending volume on a dB scale // linearly descending volume on a dB scale