mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
More robust approximation of distance attenuation at extreme settings.
Fixes artifacts that occur when attenuation zone coef = 1.0 and distance > 32m.
This commit is contained in:
parent
4c502cdbc9
commit
328809f008
1 changed files with 4 additions and 2 deletions
|
@ -43,8 +43,9 @@ static inline float fastLog2f(float x) {
|
|||
}
|
||||
|
||||
//
|
||||
// for -127 <= x < 128, returns exp2(x)
|
||||
// otherwise, returns undefined
|
||||
// for -126 <= x < 128, returns exp2(x)
|
||||
// for x < -126, returns 0
|
||||
// for x >= 128, returns undefined
|
||||
//
|
||||
// rel |error| < 9e-6, smooth (exact for x=N)
|
||||
//
|
||||
|
@ -60,6 +61,7 @@ static inline float fastExp2f(float x) {
|
|||
x -= xi.i;
|
||||
|
||||
// construct exp2(xi) as a float
|
||||
xi.i &= ~(xi.i >> 31); // MAX(xi.i, 0)
|
||||
xi.i <<= IEEE754_MANT_BITS;
|
||||
|
||||
// polynomial for exp2(x) over x=[0,1]
|
||||
|
|
Loading…
Reference in a new issue