aboutsummaryrefslogtreecommitdiffstats
path: root/common/vecmat.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-01-28 08:36:49 -0800
committerChris Robinson <[email protected]>2021-01-28 08:36:49 -0800
commit3702ee669b893ceb6ef7571c9f2134129af95dbe (patch)
treec4040278618d33b565bcd1d96146e8765ceb5ba5 /common/vecmat.h
parent27e8807a5b9ff1ced122834d70ea6612060d2cf1 (diff)
Add a panning "deadzone" for spatialized sources
It is now the greater of 'epsilon' (1 / 2**23) or ref_distance/1024.
Diffstat (limited to 'common/vecmat.h')
-rw-r--r--common/vecmat.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/vecmat.h b/common/vecmat.h
index d301cc30..997b535b 100644
--- a/common/vecmat.h
+++ b/common/vecmat.h
@@ -35,10 +35,11 @@ public:
return *this;
}
- T normalize()
+ T normalize(T lim = std::numeric_limits<T>::epsilon())
{
+ lim = std::max(lim, std::numeric_limits<T>::epsilon());
const T length{std::sqrt(mVals[0]*mVals[0] + mVals[1]*mVals[1] + mVals[2]*mVals[2])};
- if(length > std::numeric_limits<T>::epsilon())
+ if(length > lim)
{
T inv_length{T{1}/length};
mVals[0] *= inv_length;