summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorEvgeny Savelyev <glados28@yandex.ru>2019-01-17 01:41:36 +0300
committerEvgeny Savelyev <glados28@yandex.ru>2019-01-17 01:41:36 +0300
commitfc086bc93d2acd7a7f4885773e6b640404400b32 (patch)
tree4eafd9af96131f9bd37a2a81d25e8e409617508a /scene/3d
parent9e820cdf200576cefaabc2021a800771cd6700a7 (diff)
fixed AudioStreamPlayer3D::_get_attenuation_db epsilon value
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/audio_stream_player_3d.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index cad7ff47c1..0f4d0383a4 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -33,6 +33,7 @@
#include "scene/3d/area.h"
#include "scene/3d/camera.h"
#include "scene/main/viewport.h"
+
void AudioStreamPlayer3D::_mix_audio() {
if (!stream_playback.is_valid() || !active ||
@@ -206,15 +207,15 @@ float AudioStreamPlayer3D::_get_attenuation_db(float p_distance) const {
float att = 0;
switch (attenuation_model) {
case ATTENUATION_INVERSE_DISTANCE: {
- att = Math::linear2db(1.0 / ((p_distance / unit_size) + 000001));
+ att = Math::linear2db(1.0 / ((p_distance / unit_size) + CMP_EPSILON));
} break;
case ATTENUATION_INVERSE_SQUARE_DISTANCE: {
float d = (p_distance / unit_size);
d *= d;
- att = Math::linear2db(1.0 / (d + 0.00001));
+ att = Math::linear2db(1.0 / (d + CMP_EPSILON));
} break;
case ATTENUATION_LOGARITHMIC: {
- att = -20 * Math::log(p_distance / unit_size + 000001);
+ att = -20 * Math::log(p_distance / unit_size + CMP_EPSILON);
} break;
default: {
ERR_PRINT("Unknown attenuation type");