mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
use a length check against source listener distance
This commit is contained in:
parent
e0cb8db914
commit
1a7738353a
1 changed files with 3 additions and 1 deletions
|
@ -169,7 +169,9 @@ float AudioMixer::azimuthForSource(const PositionalAudioStream& streamToAdd, con
|
|||
// project the rotated source position vector onto the XZ plane
|
||||
rotatedSourcePosition.y = 0.0f;
|
||||
|
||||
if (rotatedSourcePosition != glm::vec3()) {
|
||||
const float SOURCE_DISTANCE_THRESHOLD = 1e-12;
|
||||
|
||||
if (glm::length2(rotatedSourcePosition) > SOURCE_DISTANCE_THRESHOLD) {
|
||||
// produce an oriented angle about the y-axis
|
||||
return glm::orientedAngle(glm::vec3(0.0f, 0.0f, -1.0f), glm::normalize(rotatedSourcePosition), glm::vec3(0.0f, -1.0f, 0.0f));
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue