From 3702ee669b893ceb6ef7571c9f2134129af95dbe Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 28 Jan 2021 08:36:49 -0800 Subject: Add a panning "deadzone" for spatialized sources It is now the greater of 'epsilon' (1 / 2**23) or ref_distance/1024. --- common/vecmat.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'common/vecmat.h') 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::epsilon()) { + lim = std::max(lim, std::numeric_limits::epsilon()); const T length{std::sqrt(mVals[0]*mVals[0] + mVals[1]*mVals[1] + mVals[2]*mVals[2])}; - if(length > std::numeric_limits::epsilon()) + if(length > lim) { T inv_length{T{1}/length}; mVals[0] *= inv_length; -- cgit v1.2.3